Jump to content

Tomalla

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Tomalla

  1. Again, I haven't tested it, but I bet it is possible to render a model from within a custom block render handle class as well. It's just reading some data and setting up GL accordingly, this can be done from pretty much anywhere.
  2. @diesieben07 - thanks for correcting me. Didn't know that actually and I guess I would never know I've just run some tests with using a custom texture for our overlay, and as I suspected in my earlier post, binding another texture messed up the entire chunk. Here's the example using gui/items.png spritesheet: Here's the corrected code snippet with additional measures when binding a new texture to prevent this from happening: http://paste.minecraftforge.net/view/8d6e647f The result: Cheers!
  3. 1. The side of the block you want to test against. This value ranges from 0 to 5, each meaning one of the six sides of the cube. 2. Nothin', pretty much. 3. Again, I didn't try it really, but that's what I'd do: int nTex= Minecraft.getMinecraft().renderEngine.getTexture("/my_custom_texture.png"); GL11.glBindTexture(GL11.GL_TEXTURE_2D, nTex); Use it with caution though. Hopefully it won't mess up the rendering process of any more blocks following it. Maybe there's a Minecraft method for binding a texture automatically? 4. Do you know what UV coordinates are? These coordinates determine what piece of a texture to use. (0,0) means down-left corner of a texture, while (1,1) means the opposite corner ( or top-left corner and down-right corner accordingly, I can't remember. Not that it's hard to sort out anyways ). Do the math 5. I didn't have opportunity to use TileEntities just yet. Remember though that you still have coordinates of your block so I don't see why not just call world.getBlockTileEntity(x, y, z) to get your tile entity and have it at hand.
  4. That is actually easy. I've been playing around with the renderers the other day and this is what I have come up with. First follow this short tutorial: http://www.minecraftforge.net/wiki/Upgrading_To_Forge_for_1.3.1#Custom_Block_renders In order to check if the block rendering handler has been setup correctly, put a System.out.println(); in renderWorldBlock(...) method. If the message pops out in your console after placing the block, you're on the good track. Then you can actually try to render the block. Here's the sample: http://paste.minecraftforge.net/view/5ed53601 The result: All you have to do is to determine what side you want your overlay to be on. Correct the UV parameters so that you render one specific tile and coordinates if you want the overlay to be on the other side of the block, or simply to scale it. You name it. @Reika, this green cage is even simpler to do. I haven't tried it, but I'm pretty sure you just have to call GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(0.0F, 1.0F, 0.0F, 0.4F); ... before using the Tessellator and GL11.glEnable(GL11.GL_TEXTURE_2D); after it. If that doesn't work, flush the Tessellator by calling t.draw(); t.startDrawingQuads(); after addVertex calls. Oh, and since you're not using textures, just use addVertex(x,y,z) method instead. Just play around with it. Cheers
  5. Hi there. I've been recently fiddling around with Entities and DataWatchers. I've added a new entity which is a block with settable width, height and length. The entities have the first two already implemented so I had to add length field which is a float variable. I'm using DataWatcher to synch this field with the same entity on the client side. I'm surprised there's no methods in DataWatcher to actually retrieve a float value! The permitted Object classes are: Byte, Short, Integer, Float, String, ItemStack and ChunkCoordinates, as listed in DataWatcher.java at the end of the file. However only methods for retrieving Byte, Short, Integer, String and ItemStack values are provided, which is ridiculous. Here's an example of such a method: public short getWatchableObjectShort(int par1) { return ((Short)this.getWatchedObject(par1).getObject()).shortValue(); } It's easy to make another method by analogy for retrieving float values, but there's one problem: DataWatcher.getWatchedObject(int) method is private - it can be accessed only from within the DataWatcher class itself. Solutions? I could either use Integer for storing a float value ( i.e. value 5.3F would be stored as int value of 530, 12.56F as 1256 and so on ) - this field is not supposed no be big so it should work, however it's not a method for all of the applications obviously. Or ... modify the DataWatcher class, which I'd like to avoid doing. Thoughts? Am I doing something wrong or am I missing something completely?
×
×
  • Create New...

Important Information

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