Jump to content

skullywag

Members
  • Posts

    102
  • Joined

  • Last visited

Everything posted by skullywag

  1. ok think ive stepped into yet another part of minecraft modding i dont fully get. So normally I have a model to render which is the line I now realise im missing (derp). How does one go about rendering an "icon" for an item only item (only going to show in inventory, hand, floor), my texture in the code above is the icon itself (imagine the vanilla apple item texture, desaturated) does the glColor4f apply the rgb to the whole image or just the "grey" parts, or do I have to do something else. The custom 2d item tutorial doesnt seem to give me the info mm missing for what im trying to do.
  2. hmm think I might be doing something wrong here, first of minecaft uses decimals not hexadecimals (my bad) so using: Color color = new Color(colorStr); int red = color.getRed(); int green = color.getGreen(); int blue = color.getBlue(); return color; obviously works perfectly fine in this case. So my problem now is im getting no image appearing in inventory. Now im not sure if this is a translate problem (its off the screen or soemthing..) or something else ive missed. heres the relevant code from my item renderer: Now that to me should work....but im betting as its me ive missed something bloody obvious.
  3. Hi all, Ive got a meta item with all 16 slots used and im trying to colour said item using 1 texture. First off ive created the texture and desaturated it (I assume this is correct, im no artist) Now ive gone the IItemRenderer renderer route as after my last issue ive become quite familiar with it and even some GL stuff. So my plan was to use"GL11.glColor4f(float,float,float,float)" but I have hex code format from vanilla dyes and that takes RGB, so these are the numbers im playing with (and associated colours) Is there some clever way of converting between the 2 or am i being silly and there is a simpler way of doing this?
  4. ok yes i was being a dullard there, got that bit sorted and im now getting to the renderer but im back to where i started in terms of the problem, te.getblockdata in the renderTileEntityAt method returns null. How do I get the block metadata from a non world block? Edit - OK in the end I seem to have fallen back on the simplistic way of doing this, in renderItem and doing the whole case switch on ENTITY EQUIPPED_FIRST_PERSON INVENTORY etc.. means fiddling with the rotation and translates but hey it works.
  5. and now im back to NPE on: MinecraftForgeClient.registerItemRenderer(BlockCrystal.instance.blockID, new RenderItemBlockCrystal(render, new TileEntityCrystal())); Ive managed to get my block to be a block container without breaking anything it seems so ive added: public static BlockContainer instance; but as above still no dice...what am I missing?
  6. Well it doesnt exist in the class so "this." wont work based on the code supplied above, but I cant see how to override it correctly, im sure im missing something very simple here.
  7. So im still in the same boat in that: getSpecialRendererForClass is erroring and I cannot for the life of me figure out the solution, I know I need that method in this ISimpleBlockRenderingHandler class but what goes in it, nothing I try works, I dont want to be spoon fed here but theres something about this that just isnt clicking with me.
  8. ok so still a little lost here it seems, I can see what getSpecialRendererForClass does but it errors for me constantly, I mean It looks like I need to override it but not done this bit before, looking into it....
  9. Ok im getting confused now theres seems to be multiple ways of doing this and I think im mixing them together. Let me clear things up for a sec and explain what im doing: I have a crystal Block that "grows" it is the return in getPlantID in an Iplantable seed (think this was why I didnt use BlockContainer, been a while since I made that change, maybe something to do with ticking randomly...). The block has 5 metadata subblocks, theres is 1 model that contains all the shapes for all of the subblocks. The Block implements a Tile Entity thats blank (as in the class is empty pretty much). My Model class: My TESR: So with this setup as it is, what do I implement now to make Item rendering work correctly.
  10. Does my block have to extend block container? or can it simply extend block. There are reasons for me not extending BlockContainer and I will explain if its required it could be ive got this very wrong. Anyways using your code Draco im getting an NPE due to BlockCrystal.instance.blockID being null in: TileEntitySpecialRenderer render = new TileEntityCrystalRenderer(); MinecraftForgeClient.registerItemRenderer(BlockCrystal.instance.blockID, new ItemCrystalRenderer(render, new TileEntityCrystal())); when registering it in my client proxy.
  11. I think im being rather dense here but how can I pass a Metadata value when I have no block in my itemrenderer. this: public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { TESR.renderParticularModel("WHAT GOES HERE", 0.5F, 0.5F, 0.5F, metadata); } I have no reference to a meta of any kind here as far as I can tell. Block doesnt contain one....
  12. But that would stop the in world block representaion of the models working correctly. Theres a metadata block containing 5 meta blocks, the model class has ALL of the shapes needed for rendering all of the blocks I just disable some shapes based on the metadata passed in. Now I could just have 1 of the models for the Item render yes (just check if te is null and set the meta) but id rather each item block show the correct model for its meta...if this isnt possible and I need to split the model into multiple classes thats not an issue just not what I had in mind for this.
  13. Well you already have an array at the top to hold different names of slabs why not extend it while using the meta data of the block.
  14. ok so doing this: public void renderItem(ItemRenderType type, ItemStack item, Object... data) { TileEntityRenderer.instance.renderTileEntityAt(null, 0.0D, 0.0D, 0.0D, 0.0f); } measn that no TE is passed to my renderer, which means I cannot get the block metadata to work out which model to show. My TESR currently looks like this: public TileEntityCrystalRenderer() { this.model = new ModelMymodell(); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { int blockmeta = te.getBlockMetadata(); this.model.meta = blockmeta; GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); ResourceLocation textures = (new ResourceLocation("mymod:textures/blocks/texture.png")); Minecraft.getMinecraft().renderEngine.bindTexture(textures); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glEnable(GL11.GL_BLEND); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); GL11.glPopMatrix(); }
  15. The way I did it was to extend BlockHalfSlab then youll need to have the methods createStackedBlock and getFullSlabName, everything else is pretty much a normal block.
  16. That much I get, my question still stands, how do you render an ItemBlock when it has a dummy TE to hold a custom model?
  17. Tried with a completely plain flat old texture does the same thing. If I add the GL11.glEnable(GL11.GL_BLEND); I get the nice transparency of my texture but the moment I set a light level it makes the texture go nuts, I cant seem to have both together, examples:
  18. Hi all, Ive been having issues with displaying custom 3d models in the inventory, ive got them working fine (I say fine, but techne like to over rotate, which is annoying) in the world but the moment I try to add an item renderer I get a crash, I think I know why but EVERY thread I find with the same issue nobody posts what the solution was and for those where I think ive worked it out myself the solution doesnt work, so I ask: What is the correct way of rendering custom block models as items, so the item displays the same in the inventory when you are using a dummy tile entity for the block that obviousy contains no world info so doesnt end up doing this: java.lang.NullPointerException 2014-01-28 10:25:13 [iNFO] [sTDERR] at net.minecraft.tileentity.TileEntity.getBlockType(TileEntity.java:224) 2014-01-28 10:25:13 [iNFO] [sTDERR] at net.minecraft.tileentity.TileEntity.func_85027_a(TileEntity.java:283) 2014-01-28 10:25:13 [iNFO] [sTDERR] at net.minecraft.client.renderer.tileentity.TileEntityRenderer.renderTileEntityAt(TileEntityRenderer.java:178) 2014-01-28 10:25:13 [iNFO] [sTDERR] at spawnCrystalsProto.ItemCrystalRenderer.renderItem(ItemCrystalRenderer.java:29) I have tried: public void renderItem(ItemRenderType type, ItemStack item, Object... data) { TileEntityRenderer.instance.renderTileEntityAt(new TileEntityCrystal(), 0.0D, 0.0D, 0.0D, 0.0f); } In an item renderer class but then the crash points to that line. ive also tried: public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { TileEntityRenderer entityRenderer = TileEntityRenderer.instance; if (modelID == spawnCrystalsProto.Crystal.getRenderType()) { entityRenderer.renderTileEntityAt(crystal, POSITION_FIX, POSITION_FIX, POSITION_FIX, 0.0F); } } In a blockitemrenderhandler and again it points to the same line. Ive tired implementing "IItemRenderer" and "ISimpleBlockRenderingHandler" (as im using a TE thought this was the one to go for). Help me forgeyonekenobi youre my only hope. edit - oh and I have checked for world != null in my renderer for "adjustLightFixture".
  19. Weird but ive removed that code and my models are still getting a bright VERY transparent version of my texture. They werent before.... ok so it seems that the GL blend and light values do not mix, does anyone know a solution to this issue?
  20. So your error isnt the one thats mentioned on that page? for sure?
  21. Have you followed this: http://www.minecraftforge.net/wiki/Using_wavefront_model
  22. Hi all, I just want to apply a light level to 1 meta of a block so have used: public int getLightValue(IBlockAccess world, int x, int y, int z) { this.setLightValue(world.getBlockMetadata(x, y, z) == 4 ? 1 : 0); return lightValue[blockID]; } this works fine, however my texture has gone bright and really transparent, the block in question is a custom model and does have a slightly transparent texture (90&) the renderer is using GL11.glEnable(GL11.GL_BLEND); and GL11.glDisable(GL11.GL_BLEND); Im also calling adjustLightFixture in the renderer but not sure if I need to add something here to take into account the light level added.
  23. Dont know what I did but realised I was getting meta 0 even when placing 1 2 or 3 and after id removed the renderer it was still happening, deleted and recreated my block class and now it works, albeit im getting openGL errors (stack overflow) but ill figure them out. (I hope) Edit - ITS ALIVE, (forgot to pop twice in my renderat)
  24. Youl'll want to look into the onBlockActivated method for starters, then find out how to "spawn" "item" "entities" in the "world" (those are keywords to search for) and Id start my search in net.minecraft.world in the world.java file.
  25. Where is this Update Ticker? Block? Tile Entity? Also as I put above put some debug in there to be sure its even being called, you could be staring at this code and it not be the problem.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.