Jump to content

Draco18s

Members
  • Posts

    16559
  • Joined

  • Last visited

  • Days Won

    156

Everything posted by Draco18s

  1. /** * Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag */ public boolean canCollideCheck(int par1, boolean par2) { return this.isCollidable(); } The par2 boolean is a flag that relates to collision raycasts, say, by the player's mouse cursor. I had a dispenser-like block that I wanted to fire multiple arrows from, found that because of some offsets (so that they would be emitted from different locations, regardless of orientation) was causing some arrows to collide with the block itself. So I looked into making the block non-collidable for that purpose. Found the above function (well, knew it existed, but implemented it for an override and did this: public boolean canCollideCheck(int par1, boolean par2) { return this.isCollidable() & par2; } I could now no longer right-click interact with my block, but the arrows passed through it as desired. Changed to public boolean canCollideCheck(int par1, boolean par2) { return this.isCollidable() | par2; } And retained the desired behavior and regained the ability to interact with it. Scratch that, was a total fluke due to the RNG. (There are 4 spots my arrows fire from, two of them collide, two don't, the test I thought things worked right was just a fluke of the RNG picking the two that worked). Back-tracing the code it appears that this boolean is true if and only if the player right-clicks while holding a boat. I suspect that this code is used to place the boat on top of water rather than underneath.
  2. new ItemStack(Item.itemList[theID]) Check for null.
  3. Maybe? I don't recognize those two classes at the moment.
  4. Items != blocks. ITEM IDs can go as high as 31999. BLOCK IDs can go up to 4095.
  5. I'd gone looking. And...I missed that version (apparently I skimmed the quicklinks which only went back to 1.7, so I'd moved on down to Alpha).
  6. Did this: int brightness = Block.blocksList[block.stone.blockID].getMixedBrightnessForBlock(world, x, y, z); Instead of this: int brightness = block.getMixedBrightnessForBlock(world, x, y, z); And it got better. Only "flaw" is that it has the brightness/color of the top face rather than the side face of that location (specifically, the brightness/color of the top face of the block below where I'm rendering).
  7. Still need help with this. Brightness integers are weird. I solved the alpha problem (seems that bits 9 to 16 effect the alpha, 21 to 24 are brightness, and the lowest 8 are color; 17 to 20 appear unused) but now I have an absolute brightness issue and color problem. I'm actually stripping out the 3rd bit of the absolute brightness to tone it down some (helps, but not enough in some cases; 4th bit too much in all cases). And this is what it looks like under various conditions: Full sun. Color is off. Absolute brightness perfect. Near-full darkness. Very slight color difference. Absolute brightness perfect. Torch light. Color perfect. Absolute brightness out of whack.
  8. Whichever. A lot of tutorials and such always do it as MyFoo and MyBar
  9. Modifying tool usage values might be tricky (without base class editing). I'm not familiar with how it would be done, but essentially you'd have to overwrite EnumToolMaterial which has a private constructor. (Amusingly, it also uses "Emerald" for diamond tools. Hehe.)
  10. And before me, though not by much. (*cough* also I think you meant 1.0.5_01) I can't find my original registration date, but it's around Alpha v1.1.2_01, which is the earliest reference I have to my having played, only two weeks later.
  11. If you want an actually-blank third row* then just omit that parameter. GameRegistry.addRecipe(new ItemStack(ModItems.ClayIngot), new Object[]{ "x x", " x ", Character.valueOf('x'), ModItems.ClayIngot}); Also, you can do 'x' instead of Character.valueOf('x'), Java distinguishes between " (for strings) and ' (for chars). *It's not a colum, DELTA_12, it's a row
  12. Step 1: class MyTileEntityBlock extends BlockContainer Yes, it creates a container but that's because the original vanilla TE objects have inventories. You don't need to utilize this fact, nor do you need to utilize the NBT data that can easily get saved via entities. Step 2: class MyTileEntityEntity extends TileEntity This class is what's created when you place the block. The parent class (BlockContainer) will throw an "add unimplemented methods" error, one of which will be function that returns a tile entity. You'd add "return new MyTileEntityEntity()" there. WARNING: do not pass parameters or change properties of the TE at this point, as you will want to read these values from the NBT data or they'll get reset on world load. Step 3 public class MyTileEntityRenderer extends TileEntitySpecialRenderer This will handle your TE rendering. You may also have a model that you're using or you might use the tessalator directly. I've done both. Step 4 In your base mod class: RenderingRegistry.registerBlockHandler(new MyTileEntityRenderer()); You should also use RenderingRegistry.getNextAvailableRenderId() to get a rendering ID and pass it to both your block and render class.
  13. Thank you, I'll be here all week. *Bows*
  14. Doable: yes "Easy" without base class editing: yes Simple: hell no. At least, not for your first mod. (I still fuck up simple block rendering now and then)
  15. That seems to be working better, but... :\
  16. OpenGL can't render to Physical World; there appears to be a lack of a drawing API into real space. (Google Glass is providing a work around soon, though)
  17. We'll start with a picture of what I have http://s11.postimg.org/k3dpbpw83/2013_06_10_17_42_07.png[/img] The block itself actually exists in a different place than its rendering. One block down and one block "in" (the block attaches to a solid surface, like a ladder, and renders 1 block below that in order to cover an open space, for tripwire hooks). Problem is, I can't get it to render at the correct brightness. The getMixedBrightnessForBlock function seems to return full sun despite the fact that that space is not under full sun (if I cover things over it still renders too bright, although it does dim as the light value is reduced). How can I fix this? Render code: package draco18s.traps.client; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderCoverPlate implements ISimpleBlockRenderingHandler { private int renderType; public RenderCoverPlate(int r) { renderType = r; } @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; int l = world.getBlockMetadata(x, y, z); //gets the texture based on block location, the block blends in to neighbors, grabbing their texture Icon icon = block.getBlockTexture(world, x, y, z, 2); double f = 1F/64; switch(l) { case 2: z++; break; case 3: z--; break; case 4: x++; break; case 5: x--; break; } y--; int brightness = block.getMixedBrightnessForBlock(world, x, y, z); tessellator.setBrightness(brightness); tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F); double d0 = (double)icon.getMinU(); double d1 = (double)icon.getMinV(); double d2 = (double)icon.getMaxU(); double d3 = (double)icon.getMaxV(); double d5 = (double)(x + 1); double d7 = (double)(x); double d9 = (double)(z); double d11 = (double)(z + 1); double d13 = (double)(y + 1); double d15 = (double)(y); tessellator.addVertexWithUV(d7, d13, d9, d2, d1); tessellator.addVertexWithUV(d7, d15, d9, d2, d3); tessellator.addVertexWithUV(d5, d15, d9, d0, d3); tessellator.addVertexWithUV(d5, d13, d9, d0, d1); tessellator.addVertexWithUV(d5, d13, d9, d2, d1); tessellator.addVertexWithUV(d5, d15, d9, d2, d3); tessellator.addVertexWithUV(d5, d15, d11, d0, d3); tessellator.addVertexWithUV(d5, d13, d11, d0, d1); tessellator.addVertexWithUV(d7, d13, d11, d0, d1); tessellator.addVertexWithUV(d7, d15, d11, d0, d3); tessellator.addVertexWithUV(d7, d15, d9, d2, d3); tessellator.addVertexWithUV(d7, d13, d9, d2, d1); tessellator.addVertexWithUV(d5, d13, d11, d2, d1); tessellator.addVertexWithUV(d5, d15, d11, d2, d3); tessellator.addVertexWithUV(d7, d15, d11, d0, d3); tessellator.addVertexWithUV(d7, d13, d11, d0, d1); //gets the little "hole" texture from the blocks registered texture, renders ever so slightly in front to avoid z-fighting icon = block.getIcon(0, 0); d0 = (double)icon.getMinU(); d1 = (double)icon.getMinV(); d2 = (double)icon.getMaxU(); d3 = (double)icon.getMaxV(); d5 = (double)(x + 1 + f); d7 = (double)(x - f); d9 = (double)(z - f); d11 = (double)(z + 1 + f); d13 = (double)(y + 1); d15 = (double)(y); tessellator.addVertexWithUV(d7, d13, d9, d2, d1); tessellator.addVertexWithUV(d7, d15, d9, d2, d3); tessellator.addVertexWithUV(d5, d15, d9, d0, d3); tessellator.addVertexWithUV(d5, d13, d9, d0, d1); tessellator.addVertexWithUV(d5, d13, d9, d2, d1); tessellator.addVertexWithUV(d5, d15, d9, d2, d3); tessellator.addVertexWithUV(d5, d15, d11, d0, d3); tessellator.addVertexWithUV(d5, d13, d11, d0, d1); tessellator.addVertexWithUV(d7, d13, d11, d0, d1); tessellator.addVertexWithUV(d7, d15, d11, d0, d3); tessellator.addVertexWithUV(d7, d15, d9, d2, d3); tessellator.addVertexWithUV(d7, d13, d9, d2, d1); tessellator.addVertexWithUV(d5, d13, d11, d2, d1); tessellator.addVertexWithUV(d5, d15, d11, d2, d3); tessellator.addVertexWithUV(d7, d15, d11, d0, d3); tessellator.addVertexWithUV(d7, d13, d11, d0, d1); return false; } @Override public boolean shouldRender3DInInventory() { return true; } @Override public int getRenderId() { return renderType; } }
  18. You need a EntityRegistry.registerModEntity call. Example: EntityRegistry.registerModEntity(EntityMyEnt.class, "MyEntity", 1, this, 350, 5, false);
  19. Yeah, dispenser behaviors are very easy to make. I actually made my own version of the dispenser recently (fires twice per trigger*) and has some special effects (like for fire I have it create a line of fire four wide in front of it, rather than only the first block). I had to copy most of the net.minecraft.dispenser package to do it, but once I had that and had things registered, it was really easy to create custom behaviors. *Was originally four, but seeing as there's a damage-delay only one would effect the player, so I had it trigger only twice, but do twice as much damage. Kept it at two so that it would cause arrow clusters to pepper the walls.
  20. And.... this is the 15th time I've posted this.
  21. Check your config files. It's saying one of your blocks has an ID that is greater than 4095. (Specifically, an ID of 5000)
  22. Don't know, the only thing I used the dictionary for was to listen for IDs of ore blocks so I could have my custom ore maps register the block as valuable.
×
×
  • Create New...

Important Information

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