
Kimpton
Members-
Posts
40 -
Joined
-
Last visited
Everything posted by Kimpton
-
[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.
-
Hey I downloaded the api so I could look through a web browser however there's no 'search' feature What I'm trying todo is register all blocks with a prefix (in a sense making a bunch of new blocks that equals the quantity of Minecraft's current blocks. I thought maybe if I we're to swim around the api I could find it - shamefully not. (So in a sense I'm looking for an array with all the blocks - or at least trying to make one without writing the array out) Could someone point to roughly where I could look? Thanks.
-
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
Hey diesieben - that worked Although you came across there a little rude, I thank you for telling me how todo it I can move forward with my code That was a learning curve for me, although I have spent the last month solidly working on fundamentals of java, its all still rather raw in my mind and I'm still struggling with basic concepts *sigh*. Sorry about the bumping there, won't happen again. Hey jabelar - idk why but I've taken a like to you aha You're very knowledgeable (just like most of you) and I thank you in taking an interest. General: I've solved it - exactly how diesieben said how to set it out Issue: SOLVED! -
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
BUMP help Please -
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
Here I declare basic block properties and this is what I call the ''Calling Block'' This is in Kimpton Core collumStone = new BlockProperties(Material.rock).setBlockName("ModelCollumStone"); it says ''new BlockProperies'' In BlockProperties I'm able to use these lines to set the particles texture: @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister){ this.blockIcon = iconRegister.registerIcon(KimptonCore.modid + ":" + this.getUnlocalizedName().substring(5)); } NOTE: I didn't make a reference the the specific texture but used the calling blocks name to grab the texture. Basically I want todo this in this: public ResourceLocation texture = new ResourceLocation(KimptonCore.modid + ":" + KimptonCore.collumStone.getLocalizedName()); Which is in Tile entity Renderer - where it says ''KimptonCore.collumStone.getLocalizedName'' I need it to say "getUnlocalizedName().substring(5)" (not that that obviously, as that doesn't work). Therefore I need a way around this so I don't have to keep making more tile entity render classes for each block. I don't want a mod with over 100 classes with slight alterations - that's stupid. -
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
Okay that's understood - sometimes I mix the terms people who code in java use - it was alot simpler when learning the arduino code ahah Anyway - as i said in my last post - is there a way i can skip it looking for a specific block (in this case .collumStone) and rather just call getUnlocalizedName and use the calling blocks name? -
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
Ok so here is where I am at: This is from KimptonCore (my main class) //Define Block Properties CollumStone = new BlockProperties(Material.rock).setBlockName("ModelCollumStone"); //Registering Blocks GameRegistry.registerBlock(CollumStone, "ModelCollumStone"); //Registering Tile Entities GameRegistry.registerTileEntity(TileEntityBlock.class, "ModelCollumStone"); by setting my Block Name I have set an ''Unlocalized Name'' correct? Here is my code from the texture of the particles breaking when the block is destroyed This is from my BlockProperties class. @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister){ this.blockIcon = iconRegister.registerIcon(KimptonCore.modid + ":" + this.getUnlocalizedName().substring(5)); } Where is says getUnlocalizedName is where its grabbing the calling block's texture by using its name I have set. Why can't I apply the same logic to this: This is from my tile entity render class. public ResourceLocation texture = new ResourceLocation(KimptonCore.modid + ":" + KimptonCore.CollumStone.getUnlocalizedName()); I understand why I cant use ''this.'' as its calling something from a different class... but having ''.CollumStone." means that for every time I wish to call the tile entity I would have to make a different ResourceLocation depending on what's calling it. Jabelar everything you have said I understand except from this: "Instead of KimptonCore.CollumStone. (the class) you should be using the instance name you stored somewhere in your main class or proxy." How do I do that? -
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
I knew that also I'm having difficulty executing this.. basically this piece of code... public ResourceLocation texture = new ResourceLocation(KimptonCore.modid + ":" + KimptonCore.CollumStone.getLocalizedName()); where it says KimptonCore.CollumStone.getLocalizedName()) needs to say something along the lines of ''getUnlocalizedName" so that depending on what block is calling this class it grabs the appropriate texture depending on the name of the instance that's calling it. How do I do this...? -
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
ClassWhereYouDeclareYourBlockIn.YOUR_BLOCK.getLocalizedName(); Now I know that works.. I have to rush about 100 blocks using the same model, render class and they all having the same properties - It would have been nice if I just took the name without me having to make a new class for every rendered block... That was my ultimate aim -
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
Hey, so do i need to call the names from my preInit or setup the calling method to a string in there? -
[SOLVED] getLocalizedName() - How do I call this properly?
Kimpton replied to Kimpton's topic in Modder Support
Ok before I do any more I need to understand this... why does it think 'this' is a static method? http://gyazo.com/daee525b8fcb55eb8a631cf1265d4201