TheGreyGhost
Members-
Posts
3280 -
Joined
-
Last visited
-
Days Won
8
Everything posted by TheGreyGhost
-
[1.6.2]Custom Model for Item not rendering in First Person
TheGreyGhost replied to DaNatin's topic in Modder Support
Hi. I suspect you need to change your handleRenderType to return true for EQUIPPED_FIRST_PERSON as well as EQUIPPED. EQUIPPED is 3rd person only. Likewise your renderItem code. This sample code might help: http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html https://github.com/TheGreyGhost/ItemRendering/blob/master/src/TestItemRendering/items/ItemLampshadeRenderer.java -
How do you get a custom modelled block to face the player?
TheGreyGhost replied to Jacknoshima's topic in Modder Support
It may be helpful to have a look at the piston. It is a block not a tile entity, and it uses metadata to record which direction the piston is pointing in (based on the player direction when the piston was placed). BlockPistonBase: public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { int l = determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase); par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2); //etc During the block render it looks at the metadata to figure out how to rotate the faces as necessary for proper rendering. RenderBlocks: public boolean renderPistonBase(Block par1Block, int par2, int par3, int par4, boolean par5) { int l = this.blockAccess.getBlockMetadata(par2, par3, par4); boolean flag1 = par5 || (l & != 0; int i1 = BlockPistonBase.getOrientation(l); float f = 0.25F; if (flag1) { switch (i1) { case 0: this.uvRotateEast = 3; this.uvRotateWest = 3; this.uvRotateSouth = 3; this.uvRotateNorth = 3; this.setRenderBounds(0.0D, 0.25D, 0.0D, 1.0D, 1.0D, 1.0D); break; case 1: this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D); break; -->Richard -
Need help with blocks changing depending on neighbours
TheGreyGhost replied to Jacknoshima's topic in Modder Support
Hi The answers you're looking for are probably in here: RenderBlocks.renderBlockRedstoneWire() There is a section near the top that figures out how many neighbouring redstone blocks there are: boolean flag = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3, par4, 1) || !this.blockAccess.isBlockNormalCube(par2 - 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3 - 1, par4, -1); boolean flag1 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3, par4, 3) || !this.blockAccess.isBlockNormalCube(par2 + 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3 - 1, par4, -1); boolean flag2 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3, par4 - 1, 2) || !this.blockAccess.isBlockNormalCube(par2, par3, par4 - 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 - 1, par4 - 1, -1); boolean flag3 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3, par4 + 1, 0) || !this.blockAccess.isBlockNormalCube(par2, par3, par4 + 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 - 1, par4 + 1, -1); {etc} par2, par3, par4 correspond to [x,y,z]. Based on these flags, the rendering code chooses the right icons to render (using tessellator.addVertexWithUV()...) See also http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html -
After three hours wrestling with this damn error: I finally figured out where to place my icons and textures so that Minecraft will find them. In order to find the icon corresponding to itemIcon = iconRegister.registerIcon("TestItemRendering:Error"); it is constructed as : In my case, this comes out as where my base path was The hardest bit was figuring out what the base path should be, it will be different for you of course. I finally found it by inserting a breakpoint in here. public AbstractResourcePack(File par1File) { this.basePath = par1File; } If that doesn't work for you, you might also try FolderResourcePack protected boolean makeFullPath(String par1Str) { return (new File(this.basePath, par1Str)).isFile(); } FileResourcePack protected boolean makeFullPath(String par1Str) { return (new File(this.basePath, par1Str)).isFile(); }
-
If you only do the positives, you will only get three of the six faces (Ypos Up, Zpos South, Xpos East). Try it and see....
-
Hi I'm slowly wrestling my way through the various rendering code and I think I've come across a couple of mistakes. RenderBlocks has six renderFace methods (eg renderFaceYNeg), and these renderFace methods use some flags (set by the caller) to alter how the faces are rendered, for example uvRotateEast. The problem I'm found is that some of these aren't properly named. For example- renderFaceZPos uses the uvRotateWest flag, but the positive Z face is south, not west. Is there a robust way I can change these? i.e. so I can write renderBlock.uvRotateSouth = 1; renderBlock.renderFaceZpos(); I don't understand how Forge decompiles the Minecraft jar and gives meaningful names to everything - is this something I can customise (for example - giving better names to the parameters of various interface functions (eg par1, par2)), without having to do it all from scratch every time I update to a new version of Forge? Cheers Richard