1.5 update
This commit is contained in:
parent
ad0fe8a429
commit
66fe3656fa
|
@ -23,10 +23,12 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -41,7 +43,6 @@ public class BlockIronChest extends BlockContainer {
|
||||||
super(id, Material.iron);
|
super(id, Material.iron);
|
||||||
setBlockName("IronChest");
|
setBlockName("IronChest");
|
||||||
setHardness(3.0F);
|
setHardness(3.0F);
|
||||||
setRequiresSelfNotify();
|
|
||||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||||
random = new Random();
|
random = new Random();
|
||||||
setCreativeTab(CreativeTabs.tabDecorations);
|
setCreativeTab(CreativeTabs.tabDecorations);
|
||||||
|
@ -107,21 +108,21 @@ public class BlockIronChest extends BlockContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public int getBlockTextureFromSideAndMetadata(int i, int j)
|
// public Icon getBlockTextureFromSideAndMetadata(int i, int j)
|
||||||
{
|
// {
|
||||||
IronChestType typ = IronChestType.values()[j];
|
// IronChestType typ = IronChestType.values()[j];
|
||||||
switch (i)
|
// switch (i)
|
||||||
{
|
// {
|
||||||
case 0:
|
// case 0:
|
||||||
case 1:
|
// case 1:
|
||||||
return typ.getTextureRow() * 16 + 1;
|
// return typ.getTextureRow() * 16 + 1;
|
||||||
case 3:
|
// case 3:
|
||||||
return typ.getTextureRow() * 16 + 2;
|
// return typ.getTextureRow() * 16 + 2;
|
||||||
default:
|
// default:
|
||||||
return typ.getTextureRow() * 16;
|
// return typ.getTextureRow() * 16;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int i1, float f1, float f2, float f3)
|
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
|
@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;
|
byte chestFacing = 0;
|
||||||
int facing = MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
|
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);
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class ItemChestChanger extends Item {
|
||||||
super(id);
|
super(id);
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
setIconIndex(type.ordinal());
|
// setIconIndex(type.ordinal());
|
||||||
setItemName(type.itemName);
|
setItemName(type.itemName);
|
||||||
setCreativeTab(CreativeTabs.tabMisc);
|
setCreativeTab(CreativeTabs.tabMisc);
|
||||||
}
|
}
|
||||||
|
@ -73,33 +73,25 @@ public class ItemChestChanger extends Item {
|
||||||
chestContents[i] = null;
|
chestContents[i] = null;
|
||||||
}
|
}
|
||||||
// Clear the old block out
|
// 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
|
// Force the Chest TE to reset it's knowledge of neighbouring blocks
|
||||||
tec.updateContainingBlockInfo();
|
tec.updateContainingBlockInfo();
|
||||||
// Force the Chest TE to update any neighbours so they update next
|
// Force the Chest TE to update any neighbours so they update next
|
||||||
// tick
|
// tick
|
||||||
tec.checkForAdjacentChests();
|
tec.checkForAdjacentChests();
|
||||||
// And put in our block instead
|
// 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
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
world.setBlockTileEntity(X, Y, Z, newchest);
|
world.setBlockTileEntity(X, Y, Z, newchest);
|
||||||
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal());
|
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal(), 3);
|
||||||
world.notifyBlocksOfNeighborChange(X, Y, Z, world.getBlockId(X, Y, Z));
|
|
||||||
world.markBlockForUpdate(X, Y, Z);
|
|
||||||
stack.stackSize = 0;
|
stack.stackSize = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTextureFile()
|
|
||||||
{
|
|
||||||
return "/cpw/mods/ironchest/sprites/item_textures.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTargetChestOrdinal(int sourceOrdinal)
|
public int getTargetChestOrdinal(int sourceOrdinal)
|
||||||
{
|
{
|
||||||
return type.getTarget();
|
return type.getTarget();
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue