diff --git a/src/mantle/blocks/abstracts/AdaptiveInventoryLogic.java b/src/mantle/blocks/abstracts/AdaptiveInventoryLogic.java index d44910a..96162ab 100644 --- a/src/mantle/blocks/abstracts/AdaptiveInventoryLogic.java +++ b/src/mantle/blocks/abstracts/AdaptiveInventoryLogic.java @@ -6,7 +6,7 @@ import mantle.blocks.iface.IFacingLogic; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; +import cpw.mods.fml.common.FMLCommonHandler; public abstract class AdaptiveInventoryLogic extends InventoryLogic implements IFacingLogic { @@ -75,7 +75,7 @@ public abstract class AdaptiveInventoryLogic extends InventoryLogic implements I } stack.stackSize -= itemSize; - EntityItem entityitem = new EntityItem(getWorld(), (double) ((float) xCoord + jumpX + offsetX), (double) ((float) yCoord + jumpY), + EntityItem entityitem = new EntityItem(worldObj, (double) ((float) xCoord + jumpX + offsetX), (double) ((float) yCoord + jumpY), (double) ((float) zCoord + jumpZ + offsetZ), new ItemStack(stack.getItem(), itemSize, stack.getItemDamage())); if (stack.hasTagCompound()) @@ -87,7 +87,7 @@ public abstract class AdaptiveInventoryLogic extends InventoryLogic implements I entityitem.motionX = (double) ((float) random.nextGaussian() * offset); entityitem.motionY = (double) ((float) random.nextGaussian() * offset + 0.2F); entityitem.motionZ = (double) ((float) random.nextGaussian() * offset); - getWorld().spawnEntityInWorld(entityitem); + worldObj.spawnEntityInWorld(entityitem); } } } @@ -99,9 +99,4 @@ public abstract class AdaptiveInventoryLogic extends InventoryLogic implements I { return getRenderDirection(); } - - public World getWorld () - { - return this.getWorldObj(); - } -} +} \ No newline at end of file diff --git a/src/mantle/blocks/abstracts/ExpandableInventoryLogic.java b/src/mantle/blocks/abstracts/ExpandableInventoryLogic.java index a8b2bde..5eb58f4 100644 --- a/src/mantle/blocks/abstracts/ExpandableInventoryLogic.java +++ b/src/mantle/blocks/abstracts/ExpandableInventoryLogic.java @@ -1,15 +1,10 @@ package mantle.blocks.abstracts; -import java.util.ArrayList; -import java.util.Iterator; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; +import java.util.*; +import net.minecraft.entity.player.*; +import net.minecraft.inventory.*; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.*; import net.minecraft.world.World; public abstract class ExpandableInventoryLogic extends InventoryLogic implements IInventory @@ -110,7 +105,7 @@ public abstract class ExpandableInventoryLogic extends InventoryLogic implements @Override public boolean isUseableByPlayer (EntityPlayer entityplayer) { - if (getWorld().getTileEntity(xCoord, yCoord, zCoord) != this) + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) return false; else @@ -122,11 +117,11 @@ public abstract class ExpandableInventoryLogic extends InventoryLogic implements /* NBT */ @Override - public void writeToNBT (NBTTagCompound tags) + public void readFromNBT (NBTTagCompound tags) { - super.writeToNBT(tags); + super.readFromNBT(tags); this.invName = tags.getString("InvName"); - NBTTagList nbttaglist = tags.getTagList("Items", 000); //TODO wtf goes here??? + NBTTagList nbttaglist = tags.getTagList("Items", 9); inventory = new ArrayList(); inventory.ensureCapacity(nbttaglist.tagCount() > getMaxSize() ? getMaxSize() : nbttaglist.tagCount()); for (int iter = 0; iter < nbttaglist.tagCount(); iter++) @@ -141,9 +136,9 @@ public abstract class ExpandableInventoryLogic extends InventoryLogic implements } @Override - public void readFromNBT (NBTTagCompound tags) + public void writeToNBT (NBTTagCompound tags) { - super.readFromNBT(tags); + super.writeToNBT(tags); if (invName != null) tags.setString("InvName", invName); NBTTagList nbttaglist = new NBTTagList(); @@ -219,9 +214,4 @@ public abstract class ExpandableInventoryLogic extends InventoryLogic implements return false; } - public World getWorld () - { - return this.getWorldObj(); - } - -} +} \ No newline at end of file diff --git a/src/mantle/blocks/abstracts/InventoryBlock.java b/src/mantle/blocks/abstracts/InventoryBlock.java index ba1a9a2..0f6804b 100644 --- a/src/mantle/blocks/abstracts/InventoryBlock.java +++ b/src/mantle/blocks/abstracts/InventoryBlock.java @@ -2,6 +2,8 @@ package mantle.blocks.abstracts; import java.util.Random; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; import mantle.blocks.iface.IActiveLogic; import mantle.blocks.iface.IFacingLogic; import mantle.debug.DebugHelper; @@ -17,17 +19,12 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; -/** - * Abstract for blocks with inventories. - * - * @author mDiyo - */ public abstract class InventoryBlock extends BlockContainer { protected Random rand = new Random(); @@ -37,7 +34,6 @@ public abstract class InventoryBlock extends BlockContainer super(material); } - //TODO createNewTileEntity() /* Logic backend */ public TileEntity createNewTileEntity (World var1) { @@ -50,7 +46,6 @@ public abstract class InventoryBlock extends BlockContainer public abstract Object getModInstance (); - //TODO: onBlockActivated() @Override public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) { @@ -71,9 +66,8 @@ public abstract class InventoryBlock extends BlockContainer } /* Inventory */ - //TODO: breakBlock() @Override - public void breakBlock (World par1World, int x, int y, int z, Block block, int meta) + public void breakBlock (World par1World, int x, int y, int z, Block blockID, int meta) { TileEntity te = par1World.getTileEntity(x, y, z); @@ -118,7 +112,8 @@ public abstract class InventoryBlock extends BlockContainer } } } - super.breakBlock(par1World, x, y, z, block, meta); + + super.breakBlock(par1World, x, y, z, blockID, meta); } /* Placement */ @@ -126,7 +121,6 @@ public abstract class InventoryBlock extends BlockContainer int side = -1; //This class does not have an actual block placed in the world - //TODO onBlockPlaced @Override public int onBlockPlaced (World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) { @@ -134,7 +128,6 @@ public abstract class InventoryBlock extends BlockContainer return meta; } - //TODO onBlockPlacedBy @Override public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack) { @@ -199,7 +192,7 @@ public abstract class InventoryBlock extends BlockContainer this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]); } } - + /* IDebuggable */ @Override public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player) @@ -215,4 +208,4 @@ public abstract class InventoryBlock extends BlockContainer super.onBlockClicked(world, x, y, z, player); } -} +} \ No newline at end of file