diff options
| author | Lance5057 <Lance5057@gmail.com> | 2015-07-09 02:03:28 -0500 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2015-07-09 02:03:28 -0500 |
| commit | b4040374ce7af8b219b0273c92ed48aaf84fb32b (patch) | |
| tree | ce02b76ae1f1e7963e43b39dda2c7be5e1584404 /src/main/java/gmail/Lance5057/tileentities | |
| parent | e9c02857b01d7c4afe887c612fc3a1a70a973837 (diff) | |
Revert "Worked on the Finishing Anvil"
This reverts commit e9c02857b01d7c4afe887c612fc3a1a70a973837.
Diffstat (limited to 'src/main/java/gmail/Lance5057/tileentities')
| -rw-r--r-- | src/main/java/gmail/Lance5057/tileentities/TileEntity_ArmorAnvil.java | 8 | ||||
| -rw-r--r-- | src/main/java/gmail/Lance5057/tileentities/TileEntity_FinishingAnvil.java | 176 |
2 files changed, 8 insertions, 176 deletions
diff --git a/src/main/java/gmail/Lance5057/tileentities/TileEntity_ArmorAnvil.java b/src/main/java/gmail/Lance5057/tileentities/TileEntity_ArmorAnvil.java new file mode 100644 index 0000000..59b823e --- /dev/null +++ b/src/main/java/gmail/Lance5057/tileentities/TileEntity_ArmorAnvil.java @@ -0,0 +1,8 @@ +package gmail.Lance5057.tileentities; + +import net.minecraft.tileentity.TileEntity; + +public class TileEntity_ArmorAnvil extends TileEntity +{ + +} diff --git a/src/main/java/gmail/Lance5057/tileentities/TileEntity_FinishingAnvil.java b/src/main/java/gmail/Lance5057/tileentities/TileEntity_FinishingAnvil.java deleted file mode 100644 index 91188b1..0000000 --- a/src/main/java/gmail/Lance5057/tileentities/TileEntity_FinishingAnvil.java +++ /dev/null @@ -1,176 +0,0 @@ -package gmail.Lance5057.tileentities; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.Constants; - -public class TileEntity_FinishingAnvil extends TileEntity implements IInventory -{ - public static int invSize = 2; - public ItemStack[] inventory; - - private final String name = "Anvil Inventory"; - - public TileEntity_FinishingAnvil() - { - super(); - inventory = new ItemStack[invSize]; - } - - @Override - public void updateEntity() - { - super.updateEntity(); - } - - @Override - public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag); - } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - readFromNBT(pkt.func_148857_g()); - } - - @Override - public int getSizeInventory() { - return invSize; - } - - @Override - public ItemStack getStackInSlot(int slot) { - return inventory[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - ItemStack stack = getStackInSlot(slot); - if (stack != null) - { - if (stack.stackSize > amount) - { - stack = stack.splitStack(amount); - - if (stack.stackSize == 0) - { - setInventorySlotContents(slot, null); - } - } - else - { - setInventorySlotContents(slot, null); - } - - this.markDirty(); - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - ItemStack stack = getStackInSlot(slot); - - if (stack != null) - { - setInventorySlotContents(slot, stack); - } - return stack; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack itemstack) { - this.inventory[slot] = itemstack; - - if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) - { - itemstack.stackSize = this.getInventoryStackLimit(); - } - - this.markDirty(); - } - - @Override - public String getInventoryName() { - return name; - } - - @Override - public boolean hasCustomInventoryName() { - return name.length() > 0; - } - - @Override - public int getInventoryStackLimit() { - return 1; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { - return true; - } - - @Override - public void openInventory() { - - } - - @Override - public void closeInventory() { - - } - - @Override - public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { - return true; - } - - @Override - public void writeToNBT(NBTTagCompound compound) - { - super.writeToNBT(compound); - writeInventoryToNBT(compound); - } - - @Override - public void readFromNBT(NBTTagCompound compound) - { - super.readFromNBT(compound); - readInventoryFromNBT(compound); - } - - public void readInventoryFromNBT(NBTTagCompound tags) { - NBTTagList nbttaglist = tags.getTagList("Items", Constants.NBT.TAG_COMPOUND); - for (int iter = 0; iter < nbttaglist.tagCount(); iter++) { - NBTTagCompound tagList = (NBTTagCompound) nbttaglist.getCompoundTagAt(iter); - byte slotID = tagList.getByte("Slot"); - if (slotID >= 0 && slotID < inventory.length) { - inventory[slotID] = ItemStack.loadItemStackFromNBT(tagList); - } - } - } - - -public void writeInventoryToNBT(NBTTagCompound tags) { - NBTTagList nbttaglist = new NBTTagList(); - for (int iter = 0; iter < inventory.length; iter++) { - if (inventory[iter] != null) { - NBTTagCompound tagList = new NBTTagCompound(); - tagList.setByte("Slot", (byte) iter); - inventory[iter].writeToNBT(tagList); - nbttaglist.appendTag(tagList); - } - } - - tags.setTag("Items", nbttaglist); - } -} |
