Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class InventoryDeci extends InventoryBasic {
- public boolean editing = false;
- EntityPlayer player;
- ContainerDeciInventory cdi;
- public InventoryDeci(ContainerDeciInventory cdi, EntityPlayer p) {
- super("", true, 47);
- player = p;
- this.cdi = cdi;
- }
- @Override
- public void markDirty() {
- CommonPlayerData data = CommonPlayerData.get(player);
- if (data.getBackpack() != getStackInSlot(0) && (getStackInSlot(0) == null || getStackInSlot(0).getItem() instanceof ItemBackpack)) {
- data.setBackpack(getStackInSlot(0));
- player.inventory.setItemStack((ItemStack)null);
- if (!player.worldObj.isRemote) {
- Decimation.mainNetworkChannel.sendToAll(new Message_ArmorPack(data));
- }
- if (data.getBackpack() != null && data.getBackpack().stackTagCompound == null) {
- data.getBackpack().setTagCompound(new NBTTagCompound());
- }
- cdi.initContainer(player.inventory, false, player, cdi.w, cdi.h, cdi.type);
- }
- if (data.getMask() != getStackInSlot(1) && (getStackInSlot(1) == null || getStackInSlot(1).getItem() instanceof ItemMaskDeci)) {
- data.setMask(getStackInSlot(1));
- player.inventory.setItemStack((ItemStack)null);
- if (!player.worldObj.isRemote) {
- Decimation.mainNetworkChannel.sendToAll(new Message_ArmorPack(data));
- }
- cdi.initContainer(player.inventory, false, player, cdi.w, cdi.h, cdi.type);
- }
- if (data.getVest() != getStackInSlot(2) && (getStackInSlot(2) == null || getStackInSlot(2).getItem() instanceof ItemVestDeci)) {
- data.setVest(getStackInSlot(2));
- player.inventory.setItemStack((ItemStack)null);
- if (!player.worldObj.isRemote) {
- Decimation.mainNetworkChannel.sendToAll(new Message_ArmorPack(data));
- }
- cdi.initContainer(player.inventory, false, player, cdi.w, cdi.h, cdi.type);
- }
- super.markDirty();
- }
- @Override
- public boolean isItemValidForSlot(int i, ItemStack itemstack) {
- return i == 0 ? itemstack.getItem() instanceof ItemBackpack : i == 1 ? itemstack.getItem() instanceof ItemMaskDeci :
- i == 2 && itemstack.getItem() instanceof ItemVestDeci;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment