Attempted to get the upgrade items working, they are rendering as blocks for some reason...

This commit is contained in:
Adubbz 2014-09-25 20:08:22 +10:00
parent 9bdaeb6ed5
commit de51748243
16 changed files with 301 additions and 84 deletions

View File

@ -51,12 +51,23 @@ func_175641_c - addBlockEvent
func_180501_a - setBlock func_180501_a - setBlock
func_175726_f - getChunkFromBlockCoords func_175726_f - getChunkFromBlockCoords
—Entity—
func_174818_b - getDistanceSq
—RegistryNamespaced— —RegistryNamespaced—
func_177775_a - addObject func_177775_a - addObject
—IInventory—- —IInventory—-
func_174889_b - openInventory func_174889_b - openInventory
func_174886_c - closeInventory func_174886_c - closeInventory
func_174888_l - clearInventory
func_174887_a_ - getField
func_174885_b - setField
func_174890_g - getFieldCount
func_174876_a - createContainer
—IInteractionObject—
func_174875_k - getGuiID
—RenderItem— —RenderItem—
func_180451_a - renderEffect func_180451_a - renderEffect
@ -171,10 +182,42 @@ func_176610_l - getID
func_177580_d - getModelLocation func_177580_d - getModelLocation
func_177584_b - getBlockStateLocation func_177584_b - getBlockStateLocation
func_177586_a - getModelBlockDefinition func_177586_a - getModelBlockDefinition
func_177590_d - loadItemModels
func_177592_e - registerSubModels
func_177596_a - getSubModels
field_177608_m - itemModelGenerator
field_177613_u - subModels
—ItemModelGenerator—
field_178398_a - LAYERS
—Minecraft— —Minecraft—
field_175617_aL - modelManager field_175617_aL - modelManager
—IWorldNamable—
getCommandSenderName - getName
isCustomInventoryName - hasCustomName
getFormattedCommandSenderName - getFormattedName
—LockCode-
func_180159_b - getLock
func_180158_b - fromNBT
func_180157_a - toNBT
func_180160_a - isEmpty
field_180161_b - lock
field_180162_a - EMPTY_CODE
—ILockableContainer—
func_174891_i - getLockCode
func_174892_a - setLockCode
func_174893_q_ - isLocked
—TileEntityLockable—
field_174901_a - lockCode
—————————— ——————————
FIXES FIXES
—————————— ——————————

View File

@ -10,6 +10,8 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest; package cpw.mods.ironchest;
import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -18,10 +20,17 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockIronChest extends BlockContainer public class BlockIronChest extends BlockContainer
@ -129,14 +138,14 @@ public class BlockIronChest extends BlockContainer
return items; return items;
}*/ }*/
/*@Override @Override
public void onBlockAdded(World world, BlockPos pos, IBlockState blockState) public void onBlockAdded(World world, BlockPos pos, IBlockState blockState)
{ {
super.onBlockAdded(world, pos, blockState); super.onBlockAdded(world, pos, blockState);
world.markBlockForUpdate(pos); world.markBlockForUpdate(pos);
}*/ }
/*@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase entityliving, ItemStack itemStack) public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase entityliving, ItemStack itemStack)
{ {
byte chestFacing = 0; byte chestFacing = 0;
@ -165,7 +174,7 @@ public class BlockIronChest extends BlockContainer
teic.setFacing(chestFacing); teic.setFacing(chestFacing);
world.markBlockForUpdate(pos); world.markBlockForUpdate(pos);
} }
}*/ }
/*@Override /*@Override
public int damageDropped(int i) public int damageDropped(int i)
@ -173,7 +182,7 @@ public class BlockIronChest extends BlockContainer
return i; return i;
}*/ }*/
/*@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState blockState) public void breakBlock(World world, BlockPos pos, IBlockState blockState)
{ {
TileEntityIronChest tileentitychest = (TileEntityIronChest) world.getTileEntity(pos); TileEntityIronChest tileentitychest = (TileEntityIronChest) world.getTileEntity(pos);
@ -187,6 +196,8 @@ public class BlockIronChest extends BlockContainer
public void dropContent(int newSize, IInventory chest, World world, BlockPos pos) public void dropContent(int newSize, IInventory chest, World world, BlockPos pos)
{ {
Random random = world.rand;
for (int l = newSize; l < chest.getSizeInventory(); l++) for (int l = newSize; l < chest.getSizeInventory(); l++)
{ {
ItemStack itemstack = chest.getStackInSlot(l); ItemStack itemstack = chest.getStackInSlot(l);
@ -218,7 +229,7 @@ public class BlockIronChest extends BlockContainer
world.spawnEntityInWorld(entityitem); world.spawnEntityInWorld(entityitem);
} }
} }
}*/ }
/*@Override /*@Override
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
@ -235,12 +246,12 @@ 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 @Override
public boolean hasComparatorInputOverride() { public boolean hasComparatorInputOverride() {
return true; return true;
}*/ }
/*@Override @Override
public int getComparatorInputOverride(World world, BlockPos pos) public int getComparatorInputOverride(World world, BlockPos pos)
{ {
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
@ -249,7 +260,7 @@ public class BlockIronChest extends BlockContainer
return Container.calcRedstoneFromInventory((IInventory)te); return Container.calcRedstoneFromInventory((IInventory)te);
} }
return 0; return 0;
}*/ }
/*private static final ForgeDirection[] validRotationAxes = new ForgeDirection[] { UP, DOWN }; /*private static final ForgeDirection[] validRotationAxes = new ForgeDirection[] { UP, DOWN };
@Override @Override

View File

@ -36,7 +36,7 @@ public class IronChest {
Version.init(event.getVersionProperties()); Version.init(event.getVersionProperties());
event.getModMetadata().version = Version.fullVersionString(); event.getModMetadata().version = Version.fullVersionString();
//ChestChangerType.buildItems(cfg); ChestChangerType.buildItems();
ironChestBlock = new BlockIronChest(); ironChestBlock = new BlockIronChest();
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest"); GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
PacketHandler.INSTANCE.ordinal(); PacketHandler.INSTANCE.ordinal();

View File

@ -202,30 +202,6 @@ public enum IronChestType implements IStringSerializable
return this == OBSIDIAN; return this == OBSIDIAN;
} }
/*TODO @SideOnly(Side.CLIENT)
private IIcon[] icons;
@SideOnly(Side.CLIENT)
public void makeIcons(IIconRegister par1IconRegister)
{
if (isValidForCreativeMode())
{
icons = new IIcon[3];
int i = 0;
for (String s : sideNames)
{
icons[i++] = par1IconRegister.registerIcon(String.format("ironchest:%s_%s",name().toLowerCase(),s));
}
}
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side)
{
return icons[sideMapping[side]];
}*/
private static String[] sideNames = { "top", "front", "side" }; private static String[] sideNames = { "top", "front", "side" };
private static int[] sideMapping = { 0, 0, 2, 1, 2, 2, 2 }; private static int[] sideMapping = { 0, 0, 2, 1, 2, 2, 2 };

View File

@ -22,17 +22,17 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemChestChanger extends Item { public class ItemChestChanger extends Item
{
private ChestChangerType type; private ChestChangerType type;
public ItemChestChanger(ChestChangerType type) public ItemChestChanger(ChestChangerType type)
{ {
super();
setMaxStackSize(1);
this.type = type; this.type = type;
setUnlocalizedName("ironchest:"+type.name());
setCreativeTab(CreativeTabs.tabMisc); this.setMaxStackSize(1);
this.setUnlocalizedName("ironchest:" + type.name());
this.setCreativeTab(CreativeTabs.tabMisc);
} }
/*@Override /*@Override

View File

@ -10,7 +10,8 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest; package cpw.mods.ironchest;
public class TileEntityDiamondChest extends TileEntityIronChest { public class TileEntityDiamondChest extends TileEntityIronChest
{
public TileEntityDiamondChest() public TileEntityDiamondChest()
{ {
super(IronChestType.DIAMOND); super(IronChestType.DIAMOND);

View File

@ -16,6 +16,8 @@ import java.util.List;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
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;
@ -23,10 +25,12 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.server.gui.IUpdatePlayerListBox; import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityLockable;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IChatComponent; import net.minecraft.util.IChatComponent;
public class TileEntityIronChest extends TileEntity implements IUpdatePlayerListBox, IInventory { public class TileEntityIronChest extends TileEntityLockable implements IUpdatePlayerListBox, IInventory
{
private int ticksSinceSync = -1; private int ticksSinceSync = -1;
public float prevLidAngle; public float prevLidAngle;
public float lidAngle; public float lidAngle;
@ -37,6 +41,7 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
private int facing; private int facing;
private boolean inventoryTouched; private boolean inventoryTouched;
private boolean hadStuff; private boolean hadStuff;
private String customName;
public TileEntityIronChest() public TileEntityIronChest()
{ {
@ -67,12 +72,6 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
return this.facing; return this.facing;
} }
@Override
public String getCommandSenderName()
{
return type.name();
}
public IronChestType getType() public IronChestType getType()
{ {
return type; return type;
@ -207,13 +206,39 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
} }
markDirty(); markDirty();
} }
@Override
public String getName()
{
return this.hasCustomName() ? this.customName : type.name();
}
@Override
public boolean hasCustomName()
{
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name)
{
this.customName = name;
}
@Override @Override
public void readFromNBT(NBTTagCompound nbttagcompound) public void readFromNBT(NBTTagCompound nbttagcompound)
{ {
super.readFromNBT(nbttagcompound); super.readFromNBT(nbttagcompound);
//10 - TAG_COMPOUND
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", 10); NBTTagList nbttaglist = nbttagcompound.getTagList("Items", 10);
chestContents = new ItemStack[getSizeInventory()]; this.chestContents = new ItemStack[getSizeInventory()];
//8 - TAG_STRING
if (nbttagcompound.hasKey("CustomName", 8))
{
this.customName = nbttagcompound.getString("CustomName");
}
for (int i = 0; i < nbttaglist.tagCount(); i++) for (int i = 0; i < nbttaglist.tagCount(); i++)
{ {
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
@ -245,6 +270,11 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
nbttagcompound.setTag("Items", nbttaglist); nbttagcompound.setTag("Items", nbttaglist);
nbttagcompound.setByte("facing", (byte)facing); nbttagcompound.setByte("facing", (byte)facing);
if (this.hasCustomName())
{
nbttagcompound.setString("CustomName", this.customName);
}
} }
@Override @Override
@ -387,7 +417,7 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
int newSize = newEntity.chestContents.length; int newSize = newEntity.chestContents.length;
System.arraycopy(chestContents, 0, newEntity.chestContents, 0, Math.min(newSize, chestContents.length)); System.arraycopy(chestContents, 0, newEntity.chestContents, 0, Math.min(newSize, chestContents.length));
BlockIronChest block = IronChest.ironChestBlock; BlockIronChest block = IronChest.ironChestBlock;
//block.dropContent(newSize, this, this.worldObj, pos); block.dropContent(newSize, this, this.worldObj, pos);
newEntity.setFacing(facing); newEntity.setFacing(facing);
newEntity.sortTopStacks(); newEntity.sortTopStacks();
newEntity.ticksSinceSync = -1; newEntity.ticksSinceSync = -1;
@ -491,11 +521,7 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
return type.acceptsStack(itemstack); return type.acceptsStack(itemstack);
} }
@Override
public boolean isCustomInventoryName()
{
return false;
}
/*void rotateAround(ForgeDirection axis) /*void rotateAround(ForgeDirection axis)
{ {
@ -507,43 +533,41 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
{ {
} }
public void removeAdornments() public void removeAdornments() {}
{
@Override
public int getField(int id)
{
return 0;
} }
@Override @Override
public IChatComponent getFormattedCommandSenderName() public void setField(int id, int value) {}
@Override
public int getFieldCount()
{
return 0;
}
@Override
public void clearInventory()
{
for (int i = 0; i < this.chestContents.length; ++i)
{
this.chestContents[i] = null;
}
}
@Override
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer player)
{ {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public int func_174887_a_(int p_174887_1_) public String getGuiID()
{ {
// TODO Auto-generated method stub return "IronChest:" + type.name();
return 0;
}
@Override
public void func_174885_b(int p_174885_1_, int p_174885_2_)
{
// TODO Auto-generated method stub
}
@Override
public int func_174890_g()
{
// TODO Auto-generated method stub
return 0;
}
@Override
public void func_174888_l()
{
// TODO Auto-generated method stub
} }
} }

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated,
"textures": {
"layer0": ironchest:items/copperIronUpgrade
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/copperSilverUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/diamondCrystalUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/diamondObsidianUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "items/apple"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/ironGoldUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/silverGoldUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/woodCopperUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "ironchest:items/woodIronUpgrade"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}