Trying (without luck) to get the inventory models rendering
This commit is contained in:
parent
abccb68208
commit
e53f48b08f
|
@ -40,13 +40,13 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockIronChest extends BlockContainer
|
||||
{
|
||||
public static final PropertyEnum VARIANT_PROP = PropertyEnum.func_177709_a("variant", IronChestType.class);
|
||||
public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", IronChestType.class);
|
||||
|
||||
public BlockIronChest()
|
||||
{
|
||||
super(Material.iron);
|
||||
|
||||
this.setDefaultBlockState(this.blockState.getBaseState().setProperty(VARIANT_PROP, IronChestType.IRON));
|
||||
this.setDefaultBlockState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON));
|
||||
|
||||
this.setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
this.setHardness(3.0F);
|
||||
|
@ -66,6 +66,12 @@ public class BlockIronChest extends BlockContainer
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumFacing direction, float p_180639_6_, float p_180639_7_, float p_180639_8_)
|
||||
{
|
||||
|
@ -112,13 +118,13 @@ public class BlockIronChest extends BlockContainer
|
|||
@Override
|
||||
public IBlockState getBlockStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultBlockState().setProperty(VARIANT_PROP, IronChestType.values()[IronChestType.validateMeta(meta)]);
|
||||
return this.getDefaultBlockState().withProperty(VARIANT_PROP, IronChestType.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromBlockState(IBlockState blockState)
|
||||
{
|
||||
return IronChestType.validateMeta(((IronChestType)blockState.getValue(VARIANT_PROP)).ordinal());
|
||||
return ((IronChestType)blockState.getValue(VARIANT_PROP)).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,12 +133,6 @@ public class BlockIronChest extends BlockContainer
|
|||
return new BlockState(this, new IProperty[] { VARIANT_PROP });
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return 22;
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@ public class IronChest
|
|||
ChestChangerType.buildItems();
|
||||
ironChestBlock = new BlockIronChest();
|
||||
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getBlockModelShapes().func_178123_a(ironChestBlock);
|
||||
ModelHelper.loadInventoryModel(ironChestBlock, "ironchest:BlockIronChest");
|
||||
|
||||
for (IronChestType typ : IronChestType.values())
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ public enum IronChestType implements IStringSerializable
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getID()
|
||||
public String getName()
|
||||
{
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public enum IronChestType implements IStringSerializable
|
|||
|
||||
public static int validateMeta(int i)
|
||||
{
|
||||
if (i < values().length && values()[i] != IronChestType.WOOD)
|
||||
if (i < values().length && values()[i].size > 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ClientProxy extends CommonProxy
|
|||
@Override
|
||||
public void registerRenderInformation()
|
||||
{
|
||||
//tileEntityRendererChestHelper.instance = new IronChestRenderHelper();
|
||||
TileEntityRendererChestHelper.instance = new IronChestRenderHelper();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Map;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererChestHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
|
@ -22,27 +23,30 @@ import cpw.mods.ironchest.IronChest;
|
|||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
|
||||
/*public class IronChestRenderHelper extends TileEntityRendererChestHelper {
|
||||
public class IronChestRenderHelper extends TileEntityRendererChestHelper
|
||||
{
|
||||
private Map<Integer, TileEntityIronChest> itemRenders = Maps.newHashMap();
|
||||
|
||||
public IronChestRenderHelper()
|
||||
{
|
||||
for (IronChestType typ : IronChestType.values())
|
||||
{
|
||||
itemRenders.put(typ.ordinal(), (TileEntityIronChest) IronChest.ironChestBlock.createTileEntity(null, typ.ordinal()));
|
||||
itemRenders.put(typ.ordinal(), (TileEntityIronChest) IronChest.ironChestBlock.createNewTileEntity(null, typ.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderChest(Block block, int i, float f)
|
||||
public void renderChest(ItemStack itemStack)
|
||||
{
|
||||
Block block = Block.getBlockFromItem(itemStack.getItem());
|
||||
|
||||
if (block == IronChest.ironChestBlock)
|
||||
{
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(itemRenders.get(i), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(itemRenders.get(itemStack.getMetadata()), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.renderChest(block, i, f);
|
||||
super.renderChest(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
|
||||
import cpw.mods.ironchest.BlockIronChest;
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.MappableItemStackWrapper;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
|
@ -94,12 +95,14 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer
|
|||
}
|
||||
int facing = 3;
|
||||
IronChestType type = tile.getType();
|
||||
if (tile != null && tile.hasWorldObj()) {
|
||||
|
||||
if (tile != null && tile.hasWorldObj() && tile.getWorld().getBlockState(tile.getPos()).getBlock() == IronChest.ironChestBlock) {
|
||||
facing = tile.getFacing();
|
||||
type = tile.getType();
|
||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
type = (IronChestType)state.getValue(BlockIronChest.VARIANT_PROP);
|
||||
}
|
||||
|
||||
bindTexture(locations.get(type));
|
||||
glPushMatrix();
|
||||
glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "blocks/clay"
|
||||
}
|
||||
}
|
|
@ -1,10 +1,3 @@
|
|||
{
|
||||
"parent": "ironchest:block/BlockIronChest",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
"parent": "builtin/entity"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue