Merge branch 'mc1.5'

This commit is contained in:
Christian 2013-03-09 15:38:24 -05:00
commit 37ca1113ba
15 changed files with 86 additions and 62 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;
@ -39,9 +41,8 @@ public class BlockIronChest extends BlockContainer {
public BlockIronChest(int id)
{
super(id, Material.iron);
setBlockName("IronChest");
setUnlocalizedName("IronChest");
setHardness(3.0F);
setRequiresSelfNotify();
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
random = new Random();
setCreativeTab(CreativeTabs.tabDecorations);
@ -78,50 +79,50 @@ public class BlockIronChest extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int metadata)
public TileEntity createTileEntity(World world, int metadata)
{
return IronChestType.makeEntity(metadata);
}
public int getBlockTexture(IBlockAccess worldAccess, int i, int j, int k, int l)
{
int meta = worldAccess.getBlockMetadata(i, j, k);
IronChestType type = IronChestType.values()[meta];
TileEntity te = worldAccess.getBlockTileEntity(i, j, k);
TileEntityIronChest icte = null;
if (te != null && te instanceof TileEntityIronChest)
{
icte = (TileEntityIronChest) te;
}
if (l == 0 || l == 1)
{ // Top and Bottom
return type.getTextureRow() * 16 + 1;
}
else if (icte != null && l == icte.getFacing())
{ // Front
return type.getTextureRow() * 16 + 2;
}
else
{ // Back and Sides
return type.getTextureRow() * 16;
}
}
// public Icon getBlockTexture(IBlockAccess worldAccess, int i, int j, int k, int l)
// {
// int meta = worldAccess.getBlockMetadata(i, j, k);
// IronChestType type = IronChestType.values()[meta];
// TileEntity te = worldAccess.getBlockTileEntity(i, j, k);
// TileEntityIronChest icte = null;
// if (te != null && te instanceof TileEntityIronChest)
// {
// icte = (TileEntityIronChest) te;
// }
// if (l == 0 || l == 1)
// { // Top and Bottom
// return type.getTextureRow() * 16 + 1;
// }
// else if (icte != null && l == icte.getFacing())
// { // Front
// return type.getTextureRow() * 16 + 2;
// }
// else
// { // Back and Sides
// return type.getTextureRow() * 16;
// }
// }
@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

@ -10,6 +10,7 @@
******************************************************************************/
package cpw.mods.ironchest;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -18,6 +19,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemChestChanger extends Item {
@ -28,11 +31,17 @@ public class ItemChestChanger extends Item {
super(id);
setMaxStackSize(1);
this.type = type;
setIconIndex(type.ordinal());
setItemName(type.itemName);
setUnlocalizedName(type.itemName);
setCreativeTab(CreativeTabs.tabMisc);
}
@Override
@SideOnly(Side.CLIENT)
public void func_94581_a(IconRegister par1IconRegister)
{
this.iconIndex = par1IconRegister.func_94245_a("ironchest:"+type.itemName);
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side, float hitX, float hitY, float hitZ)
{
@ -73,33 +82,25 @@ public class ItemChestChanger extends Item {
chestContents[i] = null;
}
// Clear the old block out
world.setBlockWithNotify(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.setBlockWithNotify(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

@ -29,7 +29,7 @@ public class ItemIronChest extends ItemBlock {
}
@Override
public String getItemNameIS(ItemStack itemstack)
public String getUnlocalizedName(ItemStack itemstack)
{
return IronChestType.values()[itemstack.getItemDamage()].name();
}

View File

@ -339,7 +339,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
}
@Override
public void receiveClientEvent(int i, int j)
public boolean receiveClientEvent(int i, int j)
{
if (i == 1)
{
@ -354,6 +354,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
facing = (byte) (j & 0x7);
numUsingPlayers = (j & 0xF8) >> 3;
}
return true;
}
@Override
@ -496,4 +497,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;
}
}

View File

@ -73,9 +73,9 @@ public class GUIChest extends GuiContainer {
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
int tex = mc.renderEngine.getTexture(type.guiTexture);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(tex);
// new "bind tex"
mc.renderEngine.func_98187_b(type.guiTexture);
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);

View File

@ -73,11 +73,11 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
renderBlocks = new RenderBlocks();
itemRenderer = new RenderItem() {
@Override
public byte getMiniBlockCountForItemStack(ItemStack stack) {
public byte getMiniBlockCount(ItemStack stack) {
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 15) + 1);
}
@Override
public byte getMiniItemCountForItemStack(ItemStack stack) {
public byte getMiniItemCount(ItemStack stack) {
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 7) + 1);
}
@Override
@ -168,7 +168,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
glTranslatef(shiftX, shiftY, shiftZ);
glRotatef(timeD, 0.0F, 1.0F, 0.0F);
glScalef(blockScale, blockScale, blockScale);
customitem.func_92058_a(item);
customitem.setEntityItemStack(item);
itemRenderer.doRenderItem(customitem, 0, 0, 0, 0, 0);
glPopMatrix();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B