Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Hi It looks to me like you might have added some custom rendering code (to one of the buttons or the background layer) that does a GL11.glTranslatef but forgets to undo it afterwards. Perhaps the fancy "level" gauges on the left? The reason I think that, is because your background layer plus the slots (all the graphics and slot positions) are totally fine, just the items themselves are shifted. I think the code responsible for drawing your screen is in GUIcontainer::drawScreen this.drawGuiContainerBackgroundLayer(par3, par1, par2); // ... some stuff super.drawScreen(par1, par2, par3); // some more stuff for (int j1 = 0; j1 < this.inventorySlots.inventorySlots.size(); ++j1) { Slot slot = (Slot)this.inventorySlots.inventorySlots.get(j1); this.drawSlotInventory(slot); The fastest way to test might be to remove some of the slots, or alternatively wrap the rendering of each one in a glPushMatrix and glPopMatrix. -TGG
  2. Hi It kind of depends on what you want to do. Is your entity like a sentinel or something, that sits and waits until a bat comes into range then hunts it down? Or do you want bats to never spawn at all if there is at least one of your entity in the world? Or do you want the entity to instantly know if a bat is spawned, then move to it and kill it? Different answers in each case... -TGG
  3. Hi Could you post a couple of screenshots - good vs bad? -TGG
  4. Hi Looks like something is wrong with the icon. tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMaxV()); I can't see what from your code. Are you sure this is the Item causing the problem? You could try adding a test breakpoint to the vanilla code; RenderItem:: public void renderIcon(int par1, int par2, Icon par3Icon, int par4, int par5) { if (par3Icon == null) { System.out.println("null par3Icon"); // put breakpoint here return; } Tessellator tessellator = Tessellator.instance; //.. etc.. } then go up the call stack a couple of calls to see which item it is, and why the icon is null. -TGG
  5. Hi If you look in the stacktrace, you'll notice these lines near the top and a bit further down So when I look at GameRegistry.java lines 215 and 233, I find try { assert block != null : "registerBlock: block cannot be null"; assert itemclass != null : "registerBlock: itemclass cannot be null"; int blockItemId = block.blockID - 256; // line 215 Constructor<? extends ItemBlock> itemCtor; Item i; // .. some extra code removed ... } catch (Exception e) { FMLLog.log(Level.SEVERE, e, "Caught an exception during block registration"); throw new LoaderException(e); //line 233 } Which means that an error occurred on line 215, it threw an exception which was caught at line 233 and re-thrown. The error in the log is "null pointer exception", which means you tried to use a variable which wasn't initialised. In this case, the only possible variable on line 215 which could cause that is block. The stack trace also shows me that GameRegistry.java line 233 was called from line 196, which was called from line 172, which was called from your ModPack.java line 67. line 172 is inside this function public static void registerBlock(net.minecraft.block.Block block, String name) so I can be pretty sure that your ModPack.java line 67 looks something like registerBlock(myBlock, "mymod:myblock"); and that you've previously declared MyNewBlock myBlock; but forgotten to do myBlock = new MyNewBlock(number, material); -TGG
  6. Hi The reason it was working in your hand but not the inventory is because the renderer doesn't read the block textures every frame, only when the blocks are changed. In contrast, the inventory render updates every frame. See also http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-world-more-details-including.html If you want your blocks to animate, you should use either tile animations like water/lava, or TileEntitySpecialRenderer. -TGG
  7. Hi It appears that the problem is in this part of the code assert block != null : "registerBlock: block cannot be null"; assert itemclass != null : "registerBlock: itemclass cannot be null"; int blockItemId = block.blockID - 256; block is null, which would normally be picked up by the assert (but I'm guessing you haven't enabled assertion testing) So I suspect your ModPack line 67 is calling registerBlock with a variable that you haven't initialised yet (is null) -TGG
  8. hi grass is rendered in renderStandardBlockWithAmbientOcclusion or renderStandardBlockWithColourMultiplier depending on whether the fancy lighting option is turned on or not. A lot of blocks are rendered in these two methods (basically the method draws a cube, asking the block for the texture for each of its sides in turn), but the difference for grass is that the methods are full of "special case for grass" code, eg if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) { tessellator.setColorOpaque_F(f11 * par5, f14 * par6, f17 * par7); this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); } Some more background information here, if you're interested - see the "Block rendering" topics http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html The colour for grass is set based on the biome and the temperature, from memory. But you want to apply the multiplier to the "grass" bit only, not the dirt. I'd suggest you draw the dirt, then draw the colour-multiplied grass on top of it. Could use two passes like Draco suggested, or write your own ISimpleBlockRenderingHandler to do it directly, similar to the code for vanilla grass. -TGG
  9. Hi http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-transparent-blocks.html -TGG
  10. Hi The ray tracing code for figuring out which block you're looking at is in World.rayTraceBlocks_do_do I think the problem might be that the ray-tracing code implicitly assumes all blocks are contained within a 1x1x1 cube. You could test this directly by adding some breakpoints or logging System.out.println to the code in this method. Perhaps you'd be better off to model your 2x2 block as 4 individual blocks. You could use the DrawBlockHighlightEvent to create your custom bounding-box renderer - i.e. normal render if looking at a normal block, 2x2 size render if looking at your custom block. See also RenderGlobal.drawSelectionBox. -TGG
  11. Hi I reckon you can probably do the extra drop in your harvest event eg something like public void myHarvestDropsEventHandler(HarvestDropsEvent event) { if (10% chance of special drop succeeded) then { float f = 0.7F; double d0 = (double)(par1World.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(par1World.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d2 = (double)(par1World.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem(par1World, (double)x + d0, (double)y + d1, (double)z + d2, mySpecialDropItemStack); entityitem.delayBeforeCanPickup = 10; par1World.spawnEntityInWorld(entityitem); } // code copied from Block.dropBlockAsItem_do } Haven't ever tried it but I think it will probably work with a bit of tweaking. -TGG
  12. Hi curious that world.updateAllLightTypes(x,y,z) didn't work. Did you try tracing in to see why not? - TGG
  13. Hi Show us your BlockMiner.java ? Are you sure that the case of your files match your code exactly? I've had plenty of subtle errors in the past where I've misspelled "MyClass" as "myClass", it works fine in Windows folder (which aren't case-sensitive) but doesn't work in zip files (which are case-sensitive) -TGG
  14. Hi Line 42 of ItemBlock appears to be return Block.blocksList[this.blockID].getItemIconName() != null ? 1 : 0; The NPE means that blocksList for that blockID is null. Problem is I'm not sure why that would ever be null for a vanilla blockID. I'd suggest you add the following line to ItemBlock.java: { if (Block.blocksList[this.blockID] == null) System.out.println("invalid blockID is " + this.blockID); return Block.blocksList[this.blockID].getItemIconName() != null ? 1 : 0; } It should print the invalid blockID immediately before the crash. If it's one of yours, that suggests you've done something wrong with that block. If it's a vanilla, who knows what's gone wrong, you might want to try a reinstall of forge because that's weird. -TGG
  15. Hi In addition to what DieSieben said, this link might help http://greyminecraftcoder.blogspot.com/2013/11/how-forge-starts-up-your-code.html -TGG
  16. No worries :-)
  17. Hi Your posted code there looks pretty messed up I have to say. Binding texture out of order, extra Pop and Pushes, a very large translate, and a strange looking rotate. I'd suggest you get rid of all the translates and rotates, see where it renders, then add them back one at a time, a little bit at a time. This link might help to figure out what range of coordinates you should be rendering over http://greyminecraftcoder.blogspot.com.au/2013/09/custom-item-rendering-using.html There's also some sample code which might be useful, although it uses Tessellator instead of Model. http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html -TGG
  18. Hi A quick look through BlockFluid gave me the checkForHarden method, which is called when lava and water mix. checkForHarden is called by BlockFluid.onBlockAdded and BlockFluid.onNeighbourBlockChange So it might help if you override onBlockAdded as well. -TGG
  19. Hi Could you provide some code and screenshots? It's hard for me to understand what you mean. -TGG
  20. Hi Hmmm The server side has a whole array of Worlds, at a guess you're seeing four loads because it is one for client plus overworld, ender, nether for server. You only want the data to save on the server side, yes? If the client needs the data, it will have to ask the server for it. Perhaps the multiple loads on the server side are overwriting your static Tracker with a new (blank) one each time? The problem has got me intrigued, I'll see if I can't code up a test framework to try it out. Might take me a few hours though. -TGG
  21. Hi What I mean is - you put a breakpoint in (say) attackEntityAsMob, and then when your player is attacked the code stops executing and you step through your code one line at a time. At some point it will do something different to what you expect (i.e. won't cause damage) and give you a clue what's wrong. Have you used breakpoints and watches like this before? They are extremely useful, not just for crashes, for example see here http://www.vogella.com/articles/EclipseDebugging/article.html Alternatively you can add logging statements to key points in your code, for example you might use: @Override public boolean attackEntityAsMob(Entity ent) { System.out.println("attackEntityAsMob entered"); if(super.attackEntityAsMob(ent)) { System.out.println("attackEntityAsMob -A "); if(ent instanceof EntityLivingBase) { System.out.println("ent instanceof EntityLivingBase "); //TODO add potion super.attackEntityAsMob(ent); } System.out.println("attackEntityAsMob returning true "); return true; } else { System.out.println("attackEntityAsMob returning false "); return false; } } That's a bit overdone but you get the idea. Any time you're not sure which parts of your code are being executed, or you want to know what the value of a variable is at a certain point, you add a logging statement. If you've chosen well, the logging statements will either confirm that a part of your code is working correctly or will show that it's not doing what you assumed. Once you narrow it down a bit, you add some more statements, recompile and run again, and keep doing that until you have tracked down the problem. You can add logging statements to the vanilla code too, just remember to remove them again later. -TGG
  22. Hi I don't see any obvious cause, and I suspect that adding a number of breakpoints of logging statements will be your best bet here, starting with your attackEntityAsMob. Why do you call super.attackEntityAsMob(ent) twice in your attackEntityAsMob? -TGG
  23. Hi The way to track down this type of error is to start by identifying the line that is causing the problem. In this case line 952 of NetClientHandler. It is trying to spawn an entity (probably one of your new ones) and is running into a problem. One of the variables on that line is null when it shouldn't be. The trick is then to figure out why it is null. Usually this is because you've forgotten to initialise something before using it. What is line 952 of NetClientHandler in your code? -TGG
  24. Hi TWItems.twsigilshard is null. Which probably means that either your TWItems.Init is not running for some reason, or you have accidentally overwritten it. I'd suggest you add a couple of breakpoints in your debugger, or alternatively add a few logging statements System.out.println to see what is happening. -TGG
  25. Hi It would help if you posted your code :-) Look at line 21 of your TWTab.java getTabIconItemIndex(TWTab.java:21) You are probably using a variable that you've forgotten to initialise. -TGG
×
×
  • Create New...

Important Information

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