Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Hi This probably means you need to save and restore the OpenGL settings Try wrapping your model render call in these try { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); // render your model here } finally { GL11.glPopAttrib(); GL11.glPopMatrix(); } -TGG
  2. Hi This might be related to your issue? http://www.minecraftforge.net/forum/index.php/topic,21195.msg108136.html#msg108136 To be honest I don't really understand your code but if the error is related to vanilla sided classes then it's worth a look. -TGG
  3. Hi I suggest you look at using IItemRenderer. The renderer is given the ItemStack when rendering, and has access to the NBT information See here for some background info http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-items.html http://greyminecraftcoder.blogspot.com.au/2013/09/custom-item-rendering-using.html http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html (1.6.4 but the code is very similar) -TGG
  4. Hi Where (which class) have you put those methods? I don't recognise them? Are you sure they get called at all? (Have you tried putting a breakpoint or System.out.println("here"); in there?) And why are you returning an ItemStack with a stack size of 0? -TGG
  5. Allow me to present an existence proof to refute your hypothesis https://github.com/TheGreyGhost/ItemRendering/blob/master/src/TestItemRendering/blocks/BlockPyramidRenderer.java eg in the ISimpleBlockRenderingHandler... works fine... // east face tessellator.setNormal(FACE_XZ_NORMAL, FACE_Y_NORMAL, 0.0F); tessellator.addVertexWithUV(x+1.0, y+0.0, z+0.0, maxU1, maxV1); tessellator.addVertexWithUV(x+1.0, y+0.0, z+0.0, maxU1, minV1); tessellator.addVertexWithUV(x+0.5, y+1.0, z+0.5, minU1, minV1); tessellator.addVertexWithUV(x+1.0, y+0.0, z+1.0, minU1, maxV1); tessellator.draw(); // west face tessellator.startDrawingQuads(); tessellator.setNormal(-FACE_XZ_NORMAL, FACE_Y_NORMAL, 0.0F); tessellator.addVertexWithUV(x+0.0, y+0.0, z+1.0, minU1, maxV1); tessellator.addVertexWithUV(x+0.0, y+0.0, z+1.0, minU1, minV1); tessellator.addVertexWithUV(x+0.5, y+1.0, z+0.5, maxU1, minV1); tessellator.addVertexWithUV(x+0.0, y+0.0, z+0.0, maxU1, maxV1); tessellator.draw(); // north face tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, FACE_Y_NORMAL, -FACE_XZ_NORMAL); tessellator.addVertexWithUV(x+0.0, y+0.0, z+0.0, minU1, maxV1); tessellator.addVertexWithUV(x+0.0, y+0.0, z+0.0, minU1, minV1); tessellator.addVertexWithUV(x+0.5, y+1.0, z+0.5, maxU1, minV1); tessellator.addVertexWithUV(x+1.0, y+0.0, z+0.0, maxU1, maxV1); tessellator.draw(); I admit I haven't tried a switch to the Item texture sheet between the .draw() and .startDrawingQuads(), but I've previously bound other textures like that with no problem. -TGG
  6. Hi Some background http://www.leepoint.net/notes-java/data/expressions/bitops.html This code from vanilla might help you figure it out too public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int wx, int wy, int wz, int side) { if (side != 1 && side != 0) { int metadata = this.getFullMetadata(par1IBlockAccess, wx, wy, wz); int doorFacingDirection = metadata & 3; boolean doorIsOpen = (metadata & 4) != 0; boolean flipLeftRight = false; boolean topHalf = (metadata & != 0; if (doorIsOpen) { if (doorFacingDirection == 0 && side == 2) { flipLeftRight = !flipLeftRight; } else if (doorFacingDirection == 1 && side == 5) { flipLeftRight = !flipLeftRight; } else if (doorFacingDirection == 2 && side == 3) { flipLeftRight = !flipLeftRight; } else if (doorFacingDirection == 3 && side == 4) { flipLeftRight = !flipLeftRight; } } else { if (doorFacingDirection == 0 && side == 5) { flipLeftRight = !flipLeftRight; } else if (doorFacingDirection == 1 && side == 3) { flipLeftRight = !flipLeftRight; } else if (doorFacingDirection == 2 && side == 4) { flipLeftRight = !flipLeftRight; } else if (doorFacingDirection == 3 && side == 2) { flipLeftRight = !flipLeftRight; } if ((metadata & 16) != 0) { flipLeftRight = !flipLeftRight; } } return topHalf ? this.upperIcon[flipLeftRight ? 1 : 0] : this.lowerIcon[flipLeftRight ? 1 : 0]; } else { return this.lowerIcon[0]; } } -TGG
  7. Why do you need to send a packet, assuming that you are using TileEntity to synchronise the max_ID (and max_stage?) from the server to the client? -TGG
  8. Hi Cut and paste from my install... ForgeHooks:: /** * Called when a player uses 'pick block', calls new Entity and Block hooks. */ public static boolean onPickBlock(MovingObjectPosition target, EntityPlayer player, World world) { ItemStack result = null; boolean isCreative = player.capabilities.isCreativeMode; if (target.typeOfHit == MovingObjectType.BLOCK) { int x = target.blockX; int y = target.blockY; int z = target.blockZ; Block block = world.getBlock(x, y, z); if (block.isAir(world, x, y, z)) { return false; } result = block.getPickBlock(target, world, x, y, z); } else { if (target.typeOfHit != MovingObjectType.ENTITY || target.entityHit == null || !isCreative) { return false; } result = target.entityHit.getPickedResult(target); } if (result == null) { return false; } for (int x = 0; x < 9; x++) { ItemStack stack = player.inventory.getStackInSlot(x); if (stack != null && stack.isItemEqual(result) && ItemStack.areItemStackTagsEqual(stack, result)) { player.inventory.currentItem = x; return true; } } if (!isCreative) { return false; } int slot = player.inventory.getFirstEmptyStack(); if (slot < 0 || slot >= 9) { slot = player.inventory.currentItem; } player.inventory.setInventorySlotContents(slot, result); player.inventory.currentItem = slot; return true; } If that doesn't give you the clues you need, show us your code and an explanation of the problem (what you expect vs what you actually get), see if we can help -TGG
  9. Hi You could access that hashmap a hundred thousand times a second and the user would never notice the difference. There might be a more efficient way, but if it works how it is, I wouldn't bother trying to fix it. -TGG
  10. Hi It looks to me like you have either bound the wrong texture sheet (do you mean to use vanilla block sheet?) or you are using the wrong texture coordinates for your icon - i.e. something is wrong in your "cut" calculations. -TGG
  11. Hi Try looking in ForgeHooks.onPickBlock() to see what "vanilla" does. -TGG
  12. Hi I don't think there is any any such suitable hook. However you can probably change the texture by overwriting the texture taken from the resource pack. Vanilla "stitches" the icon images together into a single texture. You might be able to overwrite the vanilla block texture by messing with that process. I'm not sure exactly how it works, but it's probably worth looking in TextureMap.loadTextureAtlas - the ForgeHooksClient.onTextureStitchedPre(this); looks very promising. Perhaps you can alter mapRegisteredSprites in that event. Or alternatively in ForgeHooksClient.onTextureStitchedPost(this); you might be able to modify the OpenGL texture sheet directly. -TGG
  13. Hi You might find this topic interesting. http://www.minecraftforge.net/forum/index.php/topic,14315.msg73758.html#msg73758 Easiest solution = derive from EntityArrow not Entity. Not 100% sure it still works but it's worth a try. -TGG
  14. Hi These links might help with some background on item rendering (see the "Item Rendering" topics) http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html And this link with a missing texture error http://www.minecraftforge.net/forum/index.php/topic,18371.msg92948.html#msg92948 -TGG
  15. keen, glad we solved it -TGG
  16. Reflection made easy..!
  17. Hi Those lists are declared private final so I think you're out of luck manipulating them without modifying vanilla. I don't see any relevant forge events in the code either. -TGG
  18. Hi This link might help bring you up to speed on some of the background stuff http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html especially the sections on Forge. Also this http://www.minecraftforge.net/forum/index.php/topic,16784.msg84954.html#msg84954 But really important - keep it simple. Start off with small bite-size pieces that you can develop one small part at a time, test it thoroughly, and then gradually integrate them as you go. Otherwise you'll wind up with a big lump of code that doesn't work and you'll get frustrated and give up. -TGG
  19. no worries, you're welcome. That's the joy of programming, every day I find out that I didn't understand something as much as I thought Ah yeah (facepalm), I always forget that taking % of a negative number gives a negative number. -TGG
  20. Hi You may find the background info in this link helpful. It's written for 1.6.4 but the concepts are still the same. http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html See especially http://greyminecraftcoder.blogspot.com.au/2013/11/how-forge-starts-up-your-code.html and http://greyminecraftcoder.blogspot.com.au/2013/10/client-server-communication-using.html -TGG
  21. Hi This line in vanilla retrieves your list of spawnable creatures List list = par1BiomeGenBase.getSpawnableList(EnumCreatureType.creature); 1) Place the breakpoint in your code here SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); 2) Step into performWorldGenSpawning When you get to List list = par1BiomeGenBase.getSpawnableList(EnumCreatureType.creature); Then inspect the list. It will have a number of elements in it like this public static class SpawnListEntry extends WeightedRandom.Item { /** Holds the class of the entity to be spawned. */ public Class entityClass; public int minGroupCount; public int maxGroupCount; One of these will have maxGroupCount less than minGroupCount. This is causing the problem. Use your debugger to print the list item, which will tell you which Entity it is. That should hopefully give you a clue. If you have no joy with the debugger, you could use ordinary code instead, eg From your code: if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS)) { List list = biomegenbase.getSpawnableList(EnumCreatureType.creature); System.out.println("biomegenbase.getSpawnableList:"); for (Object entry : list) { System.out.println((BiomeGenBase.SpawnListEntry)entry); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); } Run it, wait for it to crash, then look at the debug log and see which entry might have caused the problem. -TGG
  22. Apart from trying something quite different, eg below, then no, I can't really help, not familiar with the generator myself. have the portal appear a couple of seconds later after generation is finished (a scheduled update for the portal), or have a fixed relationship between your portals so that your generator in one dimension automatically knows where the portals are in other dimensions based only on the [x,y,z] coordinate. -TGG
  23. Hi If this loop is called once per chunk, you will get on average one ore per chunk regardless of how much randomness you add to x and z. And if you use this in the wrong place it will probably cause unintended problems. I think ShieldBug1's idea is the right one. Something like 1) generate a random number from 0 - 100 2) if the random number is less than your PERCENTAGE_OF_CHUNKS_WITH_ONE_ORE, eg 35, then place an ore. Otherwise, don't place it. On average you will then wind up with one ore in 35% of the chunks. -TGG
  24. The bed block isn't like other items. It has its own Item, ItemBed - use that instead. For more background, check out the construction of CraftingManager this.addRecipe(new ItemStack(Items.bed, 1), new Object[] {"###", "XXX", '#', Blocks.wool, 'X', Blocks.planks}); -TGG
  25. Hmmm In that case, perhaps there is something wrong in FluidTank.getInfo(), or perhaps there is no tileEntity at the location in the message, so that tileentity is null. I'd suggest adding a System.out.println("TileEntity at [" + x + ", " + y + ", " + z + "]:" + tileentity); just before the line which crashes. Or alternatively, set a breakpoint on NPE in your debugger and have a look directly. Not sure why the tileEntity might be missing - or rather, why you might be getting a message for that location before the tileEntity has been created on the client. -TGG
×
×
  • Create New...

Important Information

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