Kimpton
Members-
Posts
40 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
Modder In Progress
Kimpton's Achievements
Tree Puncher (2/8)
0
Reputation
-
[Unresolved] IItem Renderer only works for 1 Block
Kimpton replied to Kimpton's topic in Modder Support
Hey using ISimpleBlockRenderingHandler - I have to remodel my model? I've made my model in techne... and it spits the code out in a format that isn't tessellator - or can tessellators import techne models? -
[Unresolved] IItem Renderer only works for 1 Block
Kimpton replied to Kimpton's topic in Modder Support
Hey so is there no alternative? -
[Unresolved] IItem Renderer only works for 1 Block
Kimpton replied to Kimpton's topic in Modder Support
So you're saying If I want this automation - I'd lose all nice rendering inhand? aha? hmm... That's upsetting - the alternative seems like alot of writing haha! -
[Unresolved] IItem Renderer only works for 1 Block
Kimpton replied to Kimpton's topic in Modder Support
http://gyazo.com/4dbbf53279b0a9213f1d9c382c6d76df Here you can see the problem visually. Both of these blocks are registered here: String[] vanillaBlocks = new String[]{ "Stone", "Brick" //all blocks I want }; for(int i = 0; i < vanillaBlocks.length; i++){ allLarge = new LargeColumnProperties(Material.rock).setBlockName("ModelColumn" + vanillaBlocks[i]).setHardness(20.0F).setResistance(1.0F); GameRegistry.registerBlock(allLarge, "ModelColumn" + vanillaBlocks[i]); GameRegistry.registerTileEntity(TileEntityBlock.class, "ModelColumn" + vanillaBlocks[i]); } in my client proxy to register the icon I have: @Override public void renderInfomation(){ /* Tile Entity Renderer Columns : * INDEX * 1 = ModelLargeColumn * 2 = ModelMediumColumn * 3 = ModelSmallColumn */ //All Large Columns TileEntitySpecialRenderer allLarge = new TileEntityRendererLargeColumn(KimptonCore.allLarge.getUnlocalizedName().substring(5), 1); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBlock.class, allLarge); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(KimptonCore.allLarge), new HandEntityRenderer(allLarge, new TileEntityBlock())); } and in my HandEntityRenderer I have: public class HandEntityRenderer implements IItemRenderer { TileEntitySpecialRenderer render; private TileEntity entity; public HandEntityRenderer(TileEntitySpecialRenderer render, TileEntity entity) { this.entity = entity; this.render = render; } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if(type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, 0.0F, -0.5F); this.render.renderTileEntityAt(this.entity, 0.0D, 0.0D, 0.0D, 0.0F); } } THIS CODE DOESNT DO ANYTHING FOR MY PROBLEM BUT YOU MENTIONED IT Here is my special renderer: public class TileEntityRendererLargeColumn extends TileEntitySpecialRenderer{ private ModelLargeColumn model; private ResourceLocation texture; public TileEntityRendererLargeColumn(String name, int x){ switch (x){ case 1: model = new ModelLargeColumn(); break; case 2: model = new ModelLargeColumn(); break; } this.texture = new ResourceLocation(KimptonCore.modid + ":" + "/textures/blocks/" + name + ".png"); } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f){ //Open GL open with PUSH and close with POP GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(180, 0F, 0F, 1F); this.bindTexture(texture); GL11.glPushMatrix(); this.model.renderModel(0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } } and I have registered my Tile Entity in my loop at the top -
[Unresolved] IItem Renderer only works for 1 Block
Kimpton replied to Kimpton's topic in Modder Support
I actually don't know - I was taught how todo this by a friend ''this is how all modders do this'' he says. So if you were me, you'd rewrite your client proxy? Ha? -
[Unresolved] IItem Renderer only works for 1 Block
Kimpton replied to Kimpton's topic in Modder Support
Could you try explain it and tell me where I would want to implement this; because I never call to that object in my code..? -
OOOO!! Okay I've found a location with the majority of the blocks I want; in the building blocks tab! Its easy enough to get rid of all ''slab'' and ''stair'' and ''wall'' blocks (I know how todo that) - okay I think I'm set
-
Iterator it = Block.blockRegistry.iterator(); Now regardless of our previous posts I have spotted a problem that spits out a lot of duplicate blocks.. and some blocks aren't even blocks, they're items such as: "redstone dust" - I'm starting to think I'm going to have to write these out by hand - because excluding the ones I don't want will be just as hard. Maybe I should have specified I was looking for; full shaped blocks that are placeable? this would be easier if the api docs had a search feature haha
-
[Unresolved] IItem Renderer only works for 1 Block
Kimpton replied to Kimpton's topic in Modder Support
OK UPDATE: I've tried making loops and objects to try store the other blocks - still no further. -
Iterator it = Block.blockRegistry.iterator(); ArrayList<String> vanillaBlocks = new ArrayList<String>(); while (it.hasNext()) { Block b = (Block)it.next(); vanillaBlocks.add(b.getLocalizedName()); } String[] blocks = (String[])vanillaBlocks.toArray(); for(int i = 0; i < blocks.length; i++){ allLarge = new LargeColumnProperties(Material.rock).setBlockName("ModelColumn" + blocks[i]).setHardness(20.0F).setResistance(1.0F); GameRegistry.registerBlock(allLarge, "ModelColumn" + blocks[i]); GameRegistry.registerTileEntity(TileEntityBlock.class, "ModelColumn" + blocks[i]); } That's not quite right is it? I would have thought I would need another loop to turn it into an array? BTW the for loop does not accept arraylist - so it does have to be an array. I suppose it doesn't like how the array list can be ''added to'' while an array if fixed?
-
String[] vanillaBlocks = {"Brick", "Stone", "Stone_Brick" //All vanilla blocks prefer if I didn't have to write them out}; for(int i = 0; i < vanillaBlocks.length; i++){ allLarge = new LargeColumnProperties(Material.rock).setBlockName("ModelColumn" + vanillaBlocks[i]).setHardness(20.0F).setResistance(1.0F); GameRegistry.registerBlock(allLarge, "ModelColumn" + vanillaBlocks[i]); GameRegistry.registerTileEntity(TileEntityBlock.class, "ModelColumn" + vanillaBlocks[i]); }
-
[Unresolved] IItem Renderer only works for 1 Block
Kimpton replied to Kimpton's topic in Modder Support
I've been playing around with the args I could put into TileEntityBlock() - Just gives me compile errors. -
I mean how would I put all the block names into a an array?
-
This might be a ''go learn java'' question, but how do I call all the block names in that class?
-
Hey, I have this setup to register a bunch of simular blocks; String[] vanillaBlocks = {"Brick", "Stone", "Stone_Brick", //all vanilla blocks}; for(int i = 0; i < vanillaBlocks.length; i++){ allLarge = new LargeColumnProperties(Material.rock).setBlockName("ModelColumn" + vanillaBlocks[i]).setHardness(20.0F).setResistance(1.0F); GameRegistry.registerBlock(allLarge, "ModelColumn" + vanillaBlocks[i]); GameRegistry.registerTileEntity(TileEntityBlock.class, "ModelColumn" + vanillaBlocks[i]); } In game I can only ever see my model in hand for the last registered block, the other blocks just the the texture colour filling the blocks inventory slot. I wouldn't have though I need to change this, but here is my hand renderer. public class HandEntityRenderer implements IItemRenderer { TileEntitySpecialRenderer render; private TileEntity entity; public HandEntityRenderer(TileEntitySpecialRenderer render, TileEntity entity) { this.entity = entity; this.render = render; } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if(type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, 0.0F, -0.5F); this.render.renderTileEntityAt(this.entity, 0.0D, 0.0D, 0.0D, 0.0F); } } In my client proxy I have //All Large Columns TileEntitySpecialRenderer allLarge = new TileEntityRendererLargeColumn(KimptonCore.allLarge.getUnlocalizedName().substring(5), 1); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBlock.class, allLarge); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(KimptonCore.allLarge), new HandEntityRenderer(allLarge, new TileEntityBlock())); Where it says, new TileEntityBlock() - I made this class empty, its pretty much a placeholder, can it only handle one block at a time? :L - All the best.