1.5 update

This commit is contained in:
Christian 2013-01-22 11:23:32 -05:00
parent ad0fe8a429
commit 66fe3656fa
3 changed files with 43 additions and 29 deletions

View File

@ -23,10 +23,12 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -41,7 +43,6 @@ public class BlockIronChest extends BlockContainer {
super(id, Material.iron);
setBlockName("IronChest");
setHardness(3.0F);
setRequiresSelfNotify();
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
random = new Random();
setCreativeTab(CreativeTabs.tabDecorations);
@ -107,21 +108,21 @@ public class BlockIronChest extends BlockContainer {
}
}
@Override
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
IronChestType typ = IronChestType.values()[j];
switch (i)
{
case 0:
case 1:
return typ.getTextureRow() * 16 + 1;
case 3:
return typ.getTextureRow() * 16 + 2;
default:
return typ.getTextureRow() * 16;
}
}
// @Override
// public Icon getBlockTextureFromSideAndMetadata(int i, int j)
// {
// IronChestType typ = IronChestType.values()[j];
// switch (i)
// {
// case 0:
// case 1:
// return typ.getTextureRow() * 16 + 1;
// case 3:
// return typ.getTextureRow() * 16 + 2;
// default:
// return typ.getTextureRow() * 16;
// }
// }
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int i1, float f1, float f2, float f3)
@ -155,7 +156,7 @@ public class BlockIronChest extends BlockContainer {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemStack)
{
byte chestFacing = 0;
int facing = MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
@ -263,4 +264,11 @@ public class BlockIronChest extends BlockContainer {
}
return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
}
@Override
public int func_94328_b_(World par1World, int par2, int par3, int par4, int par5)
{
return Container.func_94526_b((TileEntityIronChest) par1World.getBlockTileEntity(par2, par3, par4));
}
}

View File

@ -28,7 +28,7 @@ public class ItemChestChanger extends Item {
super(id);
setMaxStackSize(1);
this.type = type;
setIconIndex(type.ordinal());
// setIconIndex(type.ordinal());
setItemName(type.itemName);
setCreativeTab(CreativeTabs.tabMisc);
}
@ -73,33 +73,25 @@ public class ItemChestChanger extends Item {
chestContents[i] = null;
}
// Clear the old block out
world.setBlock(X, Y, Z, 0);
world.setBlockAndMetadataWithNotify(X, Y, Z, 0, 0, 3);
// Force the Chest TE to reset it's knowledge of neighbouring blocks
tec.updateContainingBlockInfo();
// Force the Chest TE to update any neighbours so they update next
// tick
tec.checkForAdjacentChests();
// And put in our block instead
world.setBlock(X, Y, Z, block.blockID);
world.setBlockAndMetadataWithNotify(X, Y, Z, block.blockID, newchest.getType().ordinal(), 3);
}
else
{
return false;
}
world.setBlockTileEntity(X, Y, Z, newchest);
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal());
world.notifyBlocksOfNeighborChange(X, Y, Z, world.getBlockId(X, Y, Z));
world.markBlockForUpdate(X, Y, Z);
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal(), 3);
stack.stackSize = 0;
return true;
}
@Override
public String getTextureFile()
{
return "/cpw/mods/ironchest/sprites/item_textures.png";
}
public int getTargetChestOrdinal(int sourceOrdinal)
{
return type.getTarget();

View File

@ -470,4 +470,18 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
{
}
@Override
public boolean func_94041_b(int i, ItemStack itemstack)
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean func_94042_c()
{
// TODO Auto-generated method stub
return false;
}
}