Jump to content

calclavia

Forge Modder
  • Posts

    2281
  • Joined

  • Last visited

Everything posted by calclavia

  1. Oh I didn't know bed was made out of two blocks. How about doors? I don't see doors having two blocks. 3 blocks tall is the brand new missile launcher of course.
  2. I have a custom rendered tile entity block. I setted the block bounds for it: this.setBlockBounds(-0.5F, 0.0F, -0.5F, 1.5F, 3F, 1.5F); I also gave it a collision and selection bound: @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int x, int y, int z) { return AxisAlignedBB.getBoundingBoxFromPool((double)x-0.5, (double)y, (double)z-0.5, (double)x+1.5, (double)y+3, (double)z+1.5); } @Override public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int x, int y, int z) { return this.getCollisionBoundingBoxFromPool(par1World, x, y, z); } My tile entity is three blocks tall. There are two problems. First is that you can walk right through the block even if the collision bounds are set. The second problem is that when your mouse hovers over the top part of the block, it doesn't show the selection bound. Why is this? I already set all the bounds and it does not seem to work. I can see the selection bound being correct, but it only shows the selection bound when I hover my mouse over the actual block, not when I hover the mouse above the block (since the tile entity is 3 blocks tall).
  3. OH right. I had an error there. Thanks for finding it for me
  4. THANKS! renderInvBlock function worked perfectly!
  5. I looked at ModLoader.getUniqueBlockModelID. I am not sure how I can assign my block renderer to render that specific block. Also I did a bunch of searching about this topic on Google and there doesn't seem to be tutorial that is really relevent. It would be great if you could provide me with a link to one. Sorry if the questions are very noob to you. I am not an experienced modder afterall. This is the closest thing I found: http://www.minecraftforum.net/topic/946596-modloader-using-a-custom-2d-texture-for-a-customly-rendered-block/ Is the renderInvBlock function supposed to be in the BaseMod/NetworkMod?
  6. Right. I found a way but it requires modifying base files of the Render class. I had to add a new render number to make the item render as a block instead of a flat texture =_= Is there a way to do this withou modifying base files?
  7. For some reason my my metadata block started having problems with names. Whenever I use ModLoader.addname(), it will replace all the previous block's metadata. I also registered the block via ModLoader.registerBlock(BlockMachine[3], ItemUniversalMachine.class); It doesn't seem to work properly...
  8. Ok since there was no response I looked around and found this function called ModLoader.renderInvsBlock(). The java doc says it will render a block in the inventory. I am not sure how this function can be called to work. Anyone can help?
  9. How would I create a custom Item Renderer? I've looked for tutorials and no one seems to have done it before... My tile entity is basically shaped exactly like a block. The reason why I am using a custom render is because the textures will change without the metadata or the block changing (hence it will update the texture). More about this here: http://minecraftforge.net/forum/index.php/topic,244.msg1589.html How can I render the item to be just like a normal block instead of becoming a flat piece of texture when I set the renderType in the block to -1? I see that the enchantment table seems to have created their item texture file based on the enchantment table block. How do they do this?
  10. I think I found the error! @Override public boolean isOpaqueCube() { return false; } Forgot to do this.... =_=
  11. Alright, I am still stumped. I tried rendering it like this: public void renderBlockAsItemWithMetaData(Block par1Block, int par2, float par3, int metadata) { Tessellator var4 = Tessellator.instance; int var10; par1Block.setBlockBoundsForItemRender(); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); var4.startDrawingQuads(); var4.setNormal(0.0F, -1.0F, 0.0F); this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, par1Block.getBlockTextureFromSideAndMetadata(0, metadata)); var4.draw(); var4.startDrawingQuads(); var4.setNormal(0.0F, 1.0F, 0.0F); this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, par1Block.getBlockTextureFromSideAndMetadata(1, metadata)); var4.draw(); var4.startDrawingQuads(); var4.setNormal(0.0F, 0.0F, -1.0F); this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, par1Block.getBlockTextureFromSideAndMetadata(2, metadata)); var4.draw(); var4.startDrawingQuads(); var4.setNormal(0.0F, 0.0F, 1.0F); this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, par1Block.getBlockTextureFromSideAndMetadata(3, metadata)); var4.draw(); var4.startDrawingQuads(); var4.setNormal(-1.0F, 0.0F, 0.0F); this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, par1Block.getBlockTextureFromSideAndMetadata(4, metadata)); var4.draw(); var4.startDrawingQuads(); var4.setNormal(1.0F, 0.0F, 0.0F); this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, par1Block.getBlockTextureFromSideAndMetadata(5, metadata)); var4.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); } I'm not very good at rendering things, so I am not sure how would I set a light value. Basically what I am trying to do is to render a normal standard block in a specific position. Why am I doing this? 2 reasons: The block's texture file is unknown and can change. The block will rotate when right clicked with a wrench. Having a custom render should make the change happen.
  12. Ok thanks. I will look into it and get back to you.
  13. Ok thanks. Just wanted to know
  14. I wanted to do a custom render for my block. The textures are all correctly place. The problem is that the tile entity becomes a black box. The problem is with the lighting of the block I think, but I am not sure how to solve it. It is a tile entity special renderer of course. @Override public void renderTileEntityAt(TileEntity par1, double par2, double par4, double par6, float par8) { UETileEntity blockToBeRendered = (UETileEntity)par1; this.bindTextureByName(blockToBeRendered.getTextureFile()); GL11.glPushMatrix(); GL11.glTranslatef((float)par2+0.5F, (float)par4+0.5F, (float)par6+0.5F); this.blockRenderer.renderBlockAsItemWithMetaData(UniversalElectricity.getMachine(0), 0, blockToBeRendered.getBlockBrightness(), blockToBeRendered.getBlockMetadata()); GL11.glPopMatrix(); }
  15. I tried using the function par1World.scheduleBlockUpdate(), but that didn't work. Also tried the function par1World.notifyBlocksOfNeighborChange(). Is there a function that will make the block update it's texture?
  16. This is not really a forge question but a modding question in general. How can I use java obfuscators like yguard with mcp to reduce the size of my files and obfuscate the variable names of m mod?
  17. I tried using ModLoader.addOverride for this problem, but it didn't seem to work. An error keeps saying java.lang.Exception: No registry for this texture: /UniversalElectricity/ores.png How would I register my texture file so that it can be overridden? What I am trying to do is to have different texture files used for different metadata in a block. I need this because my API uses different texture files from different people. Forge getTextureFile seems to not be metadata sensitive. Is there a a way around this?
  18. If you look at the Universal Electricity hook for addMachine you will understand what I mean. For different metadata blocks, they use different textures.
  19. What if I wanted to use the function getTextureFile but I need to know the metadata of the block? Is there a metadata sensitive version of getTextureFile?
  20. There seems to be no custom item class for the compass. It uses the Item class. The item stack does not seem to have any code that updates the render of the item. The onUpdate function works, but I can't find any function that would update the render of the damage bar....
  21. I changed my code to setBlockMetadataWithNotify . The texture still doesn't update unless there is a block change nearby. EDIT: I figured it out. I need to set this: this.setRequiresSelfNotify(); EDIT 2: OK I have another problem now. I decided NOT to use metadata to save the direction and to use the tile entity instead. After the change, the texture of the block will not change or update unless a block besides it changes. Same problem. I tried cheating by setting the block metadata into the same metadata but it doesn't work.
  22. You saw the Universal Components page right? I included in there the object reference for the wrench item. Basically do this. //First of course you import the Universal Components package import net.minecraft.src.universalelectricity.components //Then in the on the blockActivated method check if the user is holding a wrench. If so, then rotate it! /** * Check if the player is holding a wrench or an electric item. If so, do not open the GUI. */ if(par5EntityPlayer.inventory.getCurrentItem() != null) { if(par5EntityPlayer.inventory.getCurrentItem().itemID == UniversalComponents.ItemWrench.shiftedIndex) { //Reorient the block int metadata = par1World.getBlockMetadata(par2, par3, par4); switch(metadata) { //In your case, set the tile entity data. case 2: par1World.setBlockMetadataWithNotify(par2, par3, par4, 5); break; case 5: par1World.setBlockMetadataWithNotify(par2, par3, par4, 3); break; case 3: par1World.setBlockMetadataWithNotify(par2, par3, par4, 4); break; case 4: par1World.setBlockMetadataWithNotify(par2, par3, par4, 2); break; } return true; } else if(par5EntityPlayer.inventory.getCurrentItem().getItem() instanceof UEItemElectric) { return false; } }
  23. I have a question. I have a similar block that rotates but when right clicked with a wrench. Everything rotates fine. The problem is that the block doesn't update it's texture unless another block is either broken or placed. How can I update the block's texture?
  24. You're right. Thanks this thread helped me also.
×
×
  • Create New...

Important Information

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