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_175726_f - getChunkFromBlockCoords
—Entity—
func_174818_b - getDistanceSq
—RegistryNamespaced—
func_177775_a - addObject
—IInventory—-
func_174889_b - openInventory
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—
func_180451_a - renderEffect
@ -171,10 +182,42 @@ func_176610_l - getID
func_177580_d - getModelLocation
func_177584_b - getBlockStateLocation
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—
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
——————————

View File

@ -10,6 +10,8 @@
******************************************************************************/
package cpw.mods.ironchest;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
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.IBlockState;
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.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.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockIronChest extends BlockContainer
@ -129,14 +138,14 @@ public class BlockIronChest extends BlockContainer
return items;
}*/
/*@Override
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState blockState)
{
super.onBlockAdded(world, pos, blockState);
world.markBlockForUpdate(pos);
}*/
}
/*@Override
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase entityliving, ItemStack itemStack)
{
byte chestFacing = 0;
@ -165,7 +174,7 @@ public class BlockIronChest extends BlockContainer
teic.setFacing(chestFacing);
world.markBlockForUpdate(pos);
}
}*/
}
/*@Override
public int damageDropped(int i)
@ -173,7 +182,7 @@ public class BlockIronChest extends BlockContainer
return i;
}*/
/*@Override
@Override
public void breakBlock(World world, BlockPos pos, IBlockState blockState)
{
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)
{
Random random = world.rand;
for (int l = newSize; l < chest.getSizeInventory(); l++)
{
ItemStack itemstack = chest.getStackInSlot(l);
@ -218,7 +229,7 @@ public class BlockIronChest extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
}
}*/
}
/*@Override
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);
}*/
/*@Override
@Override
public boolean hasComparatorInputOverride() {
return true;
}*/
}
/*@Override
@Override
public int getComparatorInputOverride(World world, BlockPos pos)
{
TileEntity te = world.getTileEntity(pos);
@ -249,7 +260,7 @@ public class BlockIronChest extends BlockContainer
return Container.calcRedstoneFromInventory((IInventory)te);
}
return 0;
}*/
}
/*private static final ForgeDirection[] validRotationAxes = new ForgeDirection[] { UP, DOWN };
@Override

View File

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

View File

@ -202,30 +202,6 @@ public enum IronChestType implements IStringSerializable
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 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.SideOnly;
public class ItemChestChanger extends Item {
public class ItemChestChanger extends Item
{
private ChestChangerType type;
public ItemChestChanger(ChestChangerType type)
{
super();
setMaxStackSize(1);
this.type = type;
setUnlocalizedName("ironchest:"+type.name());
setCreativeTab(CreativeTabs.tabMisc);
this.setMaxStackSize(1);
this.setUnlocalizedName("ironchest:" + type.name());
this.setCreativeTab(CreativeTabs.tabMisc);
}
/*@Override

View File

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

View File

@ -16,6 +16,8 @@ import java.util.List;
import net.minecraft.entity.EntityLivingBase;
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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -23,10 +25,12 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityLockable;
import net.minecraft.util.AxisAlignedBB;
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;
public float prevLidAngle;
public float lidAngle;
@ -37,6 +41,7 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
private int facing;
private boolean inventoryTouched;
private boolean hadStuff;
private String customName;
public TileEntityIronChest()
{
@ -67,12 +72,6 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
return this.facing;
}
@Override
public String getCommandSenderName()
{
return type.name();
}
public IronChestType getType()
{
return type;
@ -207,13 +206,39 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
}
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
public void readFromNBT(NBTTagCompound nbttagcompound)
{
super.readFromNBT(nbttagcompound);
//10 - TAG_COMPOUND
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++)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
@ -245,6 +270,11 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
nbttagcompound.setTag("Items", nbttaglist);
nbttagcompound.setByte("facing", (byte)facing);
if (this.hasCustomName())
{
nbttagcompound.setString("CustomName", this.customName);
}
}
@Override
@ -387,7 +417,7 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
int newSize = newEntity.chestContents.length;
System.arraycopy(chestContents, 0, newEntity.chestContents, 0, Math.min(newSize, chestContents.length));
BlockIronChest block = IronChest.ironChestBlock;
//block.dropContent(newSize, this, this.worldObj, pos);
block.dropContent(newSize, this, this.worldObj, pos);
newEntity.setFacing(facing);
newEntity.sortTopStacks();
newEntity.ticksSinceSync = -1;
@ -491,11 +521,7 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
return type.acceptsStack(itemstack);
}
@Override
public boolean isCustomInventoryName()
{
return false;
}
/*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
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;
}
@Override
public int func_174887_a_(int p_174887_1_)
public String getGuiID()
{
// TODO Auto-generated method stub
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
return "IronChest:" + type.name();
}
}

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 ]
}
}
}