mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 16:27:45 +00:00
Fix all issues with ghost items on the autochisel render
This commit is contained in:
1 parent
7bfafb16a6
commit
76331d04af
2 files changed
+22
-4
No files matched your search
@@ -272,7 +272,6 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
|
||||
if (worldObj.isRemote && slot == BASE && stack != null) {
|
||||
lastBase = stack.copy();
|
||||
lastBase.stackSize++;
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
@@ -8,15 +8,17 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import com.cricketcraft.chisel.network.PacketHandler;
|
||||
import com.cricketcraft.chisel.network.message.MessageAutoChisel;
|
||||
|
||||
public class ContainerAutoChisel extends Container {
|
||||
|
||||
public static TileEntityAutoChisel autoChisel;
|
||||
public static EntityPlayer player;
|
||||
public TileEntityAutoChisel autoChisel;
|
||||
public EntityPlayer player;
|
||||
|
||||
public ContainerAutoChisel(InventoryPlayer player, TileEntityAutoChisel tileEntityAutoChisel) {
|
||||
|
||||
ContainerAutoChisel.player = player.player;
|
||||
this.player = player.player;
|
||||
autoChisel = tileEntityAutoChisel;
|
||||
|
||||
addSlot(tileEntityAutoChisel, 0, 53, 15);
|
||||
@@ -92,6 +94,23 @@ public class ContainerAutoChisel extends Container {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int p_75144_2_, int p_75144_3_, EntityPlayer player) {
|
||||
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotId);
|
||||
ItemStack stack = slot.getStack();
|
||||
ItemStack ret = super.slotClick(slotId, p_75144_2_, p_75144_3_, player);
|
||||
|
||||
if (!player.worldObj.isRemote && slot.slotNumber == TileEntityAutoChisel.BASE && !ItemStack.areItemStacksEqual(stack, slot.getStack())) {
|
||||
int chiseled = stack == null ? 0 : slot.getStack() == null ? stack.stackSize : stack.stackSize - slot.getStack().stackSize;
|
||||
PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(autoChisel, chiseled, false), player.worldObj.provider.dimensionId);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
return super.slotClick(slotId, p_75144_2_, p_75144_3_, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Added validation of slot input
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user