add single item crafting

This commit is contained in:
Sen 2025-07-05 17:13:02 +02:00
parent 5c68feedbb
commit f6b036b517
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
9 changed files with 106 additions and 158 deletions

View file

@ -2809,6 +2809,22 @@ public class Player extends User implements ICrafting, Executor, IPlayer
if(this.isAdmin())
this.profiling = false;
break;
case CRAFT_ITEM: {
if(this.entity.inventory.getItemStack() == null) {
Slot slot = this.entity.openContainer.getSlot(packetIn.getAuxData());
if(slot != null && slot.canCheatItem() && slot.getHasStack()) {
ItemStack stack = this.entity.inventoryContainer.getSingleRecipe(slot.getStack());
if(stack != null) {
slot.putStack(this.entity.inventoryContainer.craftSingleRecipe(slot.getStack()));
this.entity.inventory.setItemStack(stack);
this.entity.openContainer.detectAndSendChanges();
this.updateHeldItem();
}
}
}
break;
}
default:
throw new IllegalArgumentException("Ungültige Aktion!");