This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
I have managed to fix the recipe system for my sawmill and now I face a new problem:
When I remove the items from the sawmill they do not enter the first available inventory slots. How do I fix?
Here is the sawmill's container code:
package kenneths_mods.kenneths_medieval_mod.objects.machines.sawmill; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IContainerListener; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.SlotItemHandler; public class SawmillContainer extends Container { private final SawmillTE tileentity; private int sawTime; public SawmillContainer(InventoryPlayer player, SawmillTE tileentity) { this.tileentity = tileentity; IItemHandler handler = tileentity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); this.addSlotToContainer(new SlotItemHandler(handler, 0, 39, 34)); this.addSlotToContainer(new SlotItemHandler(handler, 1, 72, 34) { public boolean isItemValid (ItemStack stack) { return false; } }); for(int y = 0; y < 3; y++) { for(int x = 0; x < 9; x++) { this.addSlotToContainer(new Slot(player, x + y * 9 + 9, 8 + x * 18, 84 + y * 18)); } } for(int x = 0; x < 9; x++) { this.addSlotToContainer(new Slot(player, x, 8 + x * 18, 142)); } } @Override public boolean canInteractWith(EntityPlayer playerIn) { return true; } @Override public void detectAndSendChanges() { super.detectAndSendChanges(); for(int i = 0; i < this.listeners.size(); i++) { IContainerListener listener = (IContainerListener)this.listeners.get(i); if(this.sawTime != this.tileentity.getField(0)) { listener.sendWindowProperty(this, 0, this.tileentity.getField(0)); } } this.sawTime = this.tileentity.getField(0); } @Override public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = (Slot) this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (index < 9) { if (!this.mergeItemStack(itemstack1, 9, (45 - 9), true)) return ItemStack.EMPTY; } else if (!this.mergeItemStack(itemstack1, 0, 9, false)) { return ItemStack.EMPTY; } if (itemstack1.getCount() == 0) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } slot.onTake(playerIn, itemstack1); } return itemstack; } public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); } }
Finds a server that says "No PvP"
*Pushes AFK player off cliff*
Steals Player's Stuff
Admin Can't do anything cause I didn't hit him so "no actual PvP".
Note the items used in the video are placeholder items.
Bump
Does anyone have a solution to this? I still can't find it.
I have managed to fix the recipe system for my sawmill and now I face a new problem:
When I remove the items from the sawmill they do not enter the first available inventory slots. How do I fix?
Here is the sawmill's container code:
Finds a server that says "No PvP"
*Pushes AFK player off cliff*
Steals Player's Stuff
Admin Can't do anything cause I didn't hit him so "no actual PvP".
Note the items used in the video are placeholder items.
Finds a server that says "No PvP"
*Pushes AFK player off cliff*
Steals Player's Stuff
Admin Can't do anything cause I didn't hit him so "no actual PvP".
Bump
Finds a server that says "No PvP"
*Pushes AFK player off cliff*
Steals Player's Stuff
Admin Can't do anything cause I didn't hit him so "no actual PvP".
Does anyone have a solution to this? I still can't find it.
Finds a server that says "No PvP"
*Pushes AFK player off cliff*
Steals Player's Stuff
Admin Can't do anything cause I didn't hit him so "no actual PvP".