Jump to content

Draco18s

Members
  • Posts

    16559
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by Draco18s

  1. Here's how I do mine: TileEntitySpecialRenderer render = new PedestalRenderer(); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayPedestal.class, render); MinecraftForgeClient.registerItemRenderer(BlockPedestal.instance.blockID, new ItemRenderPedestal(render, new TileEntityDisplayPedestal())); public class ItemRenderPedestal implements IItemRenderer { TileEntitySpecialRenderer render; private TileEntity dummytile; public ItemRenderPedestal(TileEntitySpecialRenderer render, TileEntity dummy) { this.render = render; this.dummytile = dummy; } @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.dummytile, 0.0D, 0.0D, 0.0D, 0.0F); } } }
  2. Make an EntityItem of the item you want to display and then render it. I put this in my model class, because of rendering order, but you can put it in the render class as well. if(es.itemEnt != null) { GL11.glPushMatrix(); double angle = Math.toRadians(es.rotation); float sin = (float)(Math.sin(angle)); float cos = (float)(Math.cos(angle)); sin = Math.round(sin*100)/100; cos = Math.round(cos*100)/100; GL11.glTranslatef((float)x + 0.5F + (float)(sin*0.25), (float)y + 0.76F, (float)z + 0.5F - (float)(cos*0.25)); GL11.glRotatef(-1*es.rotation, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); RenderManager.instance.renderEntityWithPosYaw(es.itemEnt, 0, 0, 0, 0, 0); GL11.glPopMatrix(); } The rotation math was because the (2D) item was laying flat on the top of the TE.
  3. Easier to maintain. You don't need to recompile to make changes.
  4. http://www.minecraftforge.net/wiki/Packet_Handling http://www.minecraftforge.net/wiki/Advanced_Packet_Handling
  5. But you don't need a LanguageRegistry at all ;_;
  6. /assets are not moved into /reobf, you have to do that yourself.
  7. Yes. I'm doing it with a 1.6.2 mod. It's standard BBCode. [i ], [b ], etc. Only without a space. There's also a toolbar if you do a full reply instead of a quick reply.
  8. Personally I do registration right in my mod's main class file. Keep the static references there too (though I experimented with each block/item holding its own reference, as I'd seen someone else do, but I decided that there was no advantage to that). Did make my main class extremely large, but as things are broken out into sections (config, instanciation, registration, recipes) it's not difficult to navigate. As for the LanguageRegistry, don't use it. It's much much better to use language files. You just create a text file called en_US.lang inside your /assets/lang directory. Then add translations like so: this.to.translate=translate this Bam. Done.
  9. Take a look at what I did here https://github.com/Draco18s/Decaying-World/blob/master/draco18s/decay/blocks/HealthFence.java
  10. public boolean interact(EntityPlayer player)?
  11. What? Thats a thing...wow.. i feel dumb....ive never had that problem. Ill change them to well below that then i suppose then give it a shot. Thank you Item IDs are shifted by 255 to avoid conflicts with (originally) vanilla blocks.
  12. @Override { return false; } @Override public boolean renderAsNormalBlock() { return false; } People will still bump into it and you will still be able to highlight it with the reticule. If you want something that is truly not-there, take a look at this class: https://github.com/Draco18s/Artifacts/blob/master/draco18s/artifacts/block/BlockLight.java
  13. This is both really easy to do and really difficult, due to edge cases and weirdness the player can do if you're not careful. Namely if someone places this light block on top of another one. Here's some code I have that will steal the texture for the next not-this block in an orthogonal direction (that is, it looks for a not itself block in a direction until it hits air, if it finds air it tries another direction, if it fails it uses grass). Its not the greatest code, but it works. public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side) { //int mymeta = world.getBlockMetadata(x, y, z); //if(mymeta == 0) { int[] id = {world.getBlockId(x, y-1, z),world.getBlockId(x-1, y, z),world.getBlockId(x+1, y, z),world.getBlockId(x, y, z-1),world.getBlockId(x, y, z+1),world.getBlockId(x, y+1, z)}; int[] meta = {world.getBlockMetadata(x, y-1, z),world.getBlockMetadata(x-1, y, z),world.getBlockMetadata(x+1, y, z),world.getBlockMetadata(x, y, z-1),world.getBlockMetadata(x, y, z+1),world.getBlockMetadata(x, y+1, z)}; //.get.getBlockTextureFromSideAndMetadata(par5, par1IBlockAccess.getBlockMetadata(par2, par3, par4)); for(int i = 0; i < id.length; i++) { Block block = Block.blocksList[id[i]]; if(block != null) { if(block != this && block.isOpaqueCube()) { Icon icon = block.getIcon(side, meta[i]); if(icon != null) { return icon; } } else if(block == this) { Icon icon = Block.grass.getBlockTextureFromSide(1); switch(i) { case 0: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y-1, z, side, 0); break; case 1: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x-1, y, z, side, 2); break; case 2: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x+1, y, z, side, 3); break; case 3: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y, z-1, side, 4); break; case 4: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y, z+1, side, 5); break; case 5: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y+1, z, side, 1); break; } if(icon != null && icon != Block.grass.getBlockTextureFromSide(1)) { return icon; } } } } return Block.grass.getBlockTextureFromSide(1); /*} else { return blockIcon; }*/ } public Icon getBlockTextureDirectional(IBlockAccess world, int x, int y, int z, int side, int direction) { int id = world.getBlockId(x, y, z); int meta = world.getBlockMetadata(x, y, z); Block block = Block.blocksList[id]; if(block != null) { if(block != this) { Icon icon = block.getIcon(side, meta); if(icon != null) { return icon; } } else { Icon icon = Block.grass.getBlockTextureFromSide(1); switch(direction) { case 0: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y-1, z, side, 0); break; case 1: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y+1, z, side, 1); break; case 2: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x-1, y, z, side, 2); break; case 3: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x+1, y, z, side, 3); break; case 4: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y, z-1, side, 4); break; case 5: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y, z+1, side, 5); break; } return icon; } } return Block.grass.getBlockTextureFromSide(1); } The cast to BlockIllusionary will need to be replaced with a cast to your block type. (Bad intenting due to copy/paste from github, original here: https://github.com/Draco18s/Artifacts/blob/master/draco18s/artifacts/block/BlockIllusionary.java )
  14. Packets aren't that bad. There are some tutorials out there, and while it takes some getting used to, it's basically "write this data, now send the packet" and "oh I got a packet, lets read the data." It's always best practice to write an integer to your packets first, indicating how the packet handler should proceed from there (essentially a packet ID).
  15. What on earth. I doubt you know what you are doing. It means if a, b, c, d, e and f are equal... You can also do this and get the same result. if(a == b && a == c && a == d && a == e && a == f) if a == b and a == c, you don't need to then check b == c. It's called the transitive property of mathematics.
  16. [me=Draco18s]sees code and no crash, still doesn't know what kind of problem to look for.[/me]
  17. You'd need to set the metadata as well, as metadata 0 implies a source block.
  18. Well you could clone the mob's own bounding box and then use .expand() instead of creating a new AABB.
  19. Yeah, it was really annoying not being able to do anything with them outside the changing the radius. Feel free to use and modify that class however you need. It's pretty flexible already, but there's always room for improvement At the time I had been trying to make shaped explosions. But yeah. I might get back to it eventually, little too deep in other things right now.
  20. You should probably use a tab other than tabAllSearch, too.
  21. It's probably not removed. Just not deobfuscated. In any case, I don't know the answer.
×
×
  • Create New...

Important Information

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