Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Hi >Also, in one of my other models I used this in the constructor and it seemed to work fine... Using breakpoints also showed that this is infact ModelPowerBeam at that point... Hmmm. It still makes me nervous. Perhaps ModelPowerBeam only looks like it's valid, even though 'this' is not null. http://www.javapractices.com/topic/TopicAction.do?Id=252 So when you're using the breakpoint and stepping through line by line, which variable is null (causes the NPE) then? -TGG
  2. Hi Personally, I would do this completely without TileEntities, just using Blocks and Metadata. There are quite a few vanilla examples of this (fence, for example, like you said, or panes). Whenever a block is placed or destroyed, it makes a call to all its neighbors (I forget which method but it's easy to spot) so that they can update their metadata and change their displayed texture. You can do the same thing with TileEntities too (just trigger the model change from the block update-my-neighbor method), but I suspect you don't need them. -TGG PS your method UpdateModel should be updateModel, otherwise it looks like a constructor.
  3. Hi Just a comment, it's generally considered best practice to name your classes starting with a capital, and your objects starting with a lower case eg ModelRenderer muzzle not ModelRenderer Muzzle Apart from that - I suspect the crash might be something to do with the fact that you're creating a Muzzle in the constructor of ModelPowerBeam using this, but then you call a method on the Muzzle before the ModelPowerBeam has finished constructing, i.e. the "this" is not valid yet. I'm kind of fuzzy on the details but I'm pretty sure that's a really bad idea if the method uses the this. Do you know how to use breakpoints? That would be the most direct way to troubleshoot this. If you don't, you really should, it makes things so much easier and won't take you long to learn http://www.vogella.com/tutorials/EclipseDebugging/article.html -TGG
  4. Hi No obvious cause springs to mind, I would suggest troubleshooting it by setting a breakpoint just before performing the updateAllLightTypes on one of the black blocks, then tracing in to see why it stays dark. This link might give useful background info too (even if it probably doesn't contain a direct answer to your problem...) http://greyminecraftcoder.blogspot.com.au/2013/08/lighting.html -TGG
  5. Hi Yes it is. This link might be of interest http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html -TGG
  6. Keen. One thing though - if you use a console command to change the player's mode mid-game, the blocks won't change appearance immediately; they will be changed when the blocks update (or when you walk a long distance away then come back). If you want them to change immediately, the animated texture will let you do that. -TGG
  7. Hi The stack underflow is because the number of your glPopMatrix doesn't match your glPushMatrix in RenderWorkSurface, you have one extra. The moving around might be because you have mixed up the order of x, y, and z in your renderTileEntityAt(TileEntity tileentity, double y, double z, double x, float f) -TGG
  8. Hi If you want your lasers to look like lightning bolts, I suggest looking at RenderLightningBolt and making sure you understand how it works - it can be very helpful to rename the variables to something meaningful - and then modifying the code so that it steps along in the x and/or z coordinates instead of the y coordinate. BTW tessellator.startDrawing(5) is actually tessellator.startDrawing(GL_TRIANGLE_STRIP); http://en.wikipedia.org/wiki/Triangle_strip -TGG
  9. Hi Yes it is possible. Minecraft.getMinecraft().playerController.isInCreativeMode() gives the mode You can change the block rendering based on that. The best way would be to use an "animated texture" - it's a bit tricky but there was a series of posts on the forum recently about something very similar to this http://www.minecraftforge.net/forum/index.php/topic,18829.msg95202.html#msg95202 -TGG
  10. Hi Probably this line at a guess. public static IIcon[] textures = new IIcon[47]; If you're not sure what I mean, a quick google on the static keyword in Java will show you :-) -TGG
  11. Hi From memory, items in your hand are rendered with alpha blending turned off. So the partially-transparent parts of your block are rendered as totally opaque. You could get around this by implementing an ISimpleBlockRenderingHandler and drawing your icon with alpha blending enabled eg http://greyminecraftcoder.blogspot.com.au/2013/07/block-rendering.html and try { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // do your rendering here } finally { GL11.glPopAttrib(); } -TGG
  12. Search in RenderBlocks(package net.minecraft.client.renderer;).Its just blocktype , like torch rails and other that kind of renderers. public boolean renderBlockBeacon(BlockBeacon par1BlockBeacon, int par2, int par3, int par4) { float f = 0.1875F; this.setOverrideBlockTexture(this.getBlockIcon(Block.glass)); this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); this.renderStandardBlock(par1BlockBeacon, par2, par3, par4); this.renderAllFaces = true; this.setOverrideBlockTexture(this.getBlockIcon(Block.obsidian)); this.setRenderBounds(0.125D, 0.0062500000931322575D, 0.125D, 0.875D, (double)f, 0.875D); this.renderStandardBlock(par1BlockBeacon, par2, par3, par4); this.setOverrideBlockTexture(this.getBlockIcon(Block.beacon)); this.setRenderBounds(0.1875D, (double)f, 0.1875D, 0.8125D, 0.875D, 0.8125D); this.renderStandardBlock(par1BlockBeacon, par2, par3, par4); this.renderAllFaces = false; this.clearOverrideBlockTexture(); return true; } Thanks Do you know how to create a new renderBlockByRenderType? Hi Some background information in this link that might help http://greyminecraftcoder.blogspot.com.au/2013/07/block-rendering.html A few of the other links in the "Blocks" section might also be interesting http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html -TGG
  13. Hi What I did: 1) Open TileBeacon 2) search for usage of getRenderType 3) --> RenderBlocks.renderBlockByRenderType 4) --> search for type 34 gives case 34: return this.renderBlockBeacon((BlockBeacon)par1Block, par2, par3, par4); 5) ---> RenderBlocks.renderBlockBeacon -TGG
  14. Hi Try TileEntityBeaconRenderer -TGG
  15. The thing is, there is no custom render. Some of them work fine, some just don't. Hi As described in the link, Items which are derived from ItemBlock are rendered as 3D. The others aren't. Look in RenderItem.renderItemIntoGUI for more details. -TGG
  16. Hi Some background information here that might help http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-items.html and linked pages eg http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-inventory-items.html -TGG
  17. Hi This link might help http://greyminecraftcoder.blogspot.com.au/2013/09/custom-item-rendering-using.html -TGG
  18. Hi Do you know how to use the debugger? If so, I'd suggest you keep trying until you get immortal particles, then put a breakpoint in Sprinkles.onUpdate and/or EffectRenderer.renderParticles. That should hopefully give you a clue. -TGG
  19. Hi If you're intending for your metadata to match minecraft's "side", you've got them mixed up. See here http://greyminecraftcoder.blogspot.com.au/2013/07/blocks.html -TGG
  20. Hi Could you be a bit more specific about what you want to do? Vanilla has plenty of examples of metadata, such as BlockFurnace - see onBlockPlacedBy You can use this.setBlockBounds to change the bounds Are you familiar with the coordinate system minecraft uses? http://greyminecraftcoder.blogspot.com.au/2013/07/blocks.html -TGG
  21. Hi Here is some code I have used to render a wire frame; there is a lot of extra irrelevant stuff in there but it might give you some clues about what is going wrong. Perhaps disable GL_TEXTURE_2D? BTW what do you mean a "glitchy black face"? if you are trying to draw lines (a wire frame), you shouldn't see any faces? -TGG public void render(RenderPhase renderPhase, EntityPlayer player, int animationTickCount, float partialTick) { boolean shouldIRender = infoProvider.refreshRenderInfo(renderInfo); if (!shouldIRender) return; try { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(Colour.BLACK_40.R, Colour.BLACK_40.G, Colour.BLACK_40.B, Colour.BLACK_40.A); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); double expandDistance = 0.002F; Vec3 playerOrigin = player.getPosition(partialTick); AxisAlignedBB boundingBox = AxisAlignedBB.getAABBPool().getAABB(0, 0, 0, 0, 0, 0); for (ChunkCoordinates block : renderInfo.currentlySelectedBlocks) { boundingBox.setBounds(block.posX, block.posY, block.posZ, block.posX + 1, block.posY + 1, block.posZ + 1); boundingBox = boundingBox.expand(expandDistance, expandDistance, expandDistance).getOffsetBoundingBox(-playerOrigin.xCoord, -playerOrigin.yCoord, -playerOrigin.zCoord); switch (SELECTION_BOX_STYLE) { case 0: { SelectionBoxRenderer.drawCube(boundingBox); break; } case 1: { SelectionBoxRenderer.drawFilledCube(boundingBox); break; } } } } finally { GL11.glDepthMask(true); GL11.glPopAttrib(); } } and public static void drawCube(AxisAlignedBB cube) { double xa = cube.minX; double xb = cube.maxX; double ya = cube.minY; double yb = cube.maxY; double za = cube.minZ; double zb = cube.maxZ; // OpenGLdebugging.dumpAllIsEnabled(); Tessellator tessellator = Tessellator.instance; tessellator.startDrawing(GL11.GL_LINE_STRIP); tessellator.addVertex(xa, ya, za); tessellator.addVertex(xa, yb, za); tessellator.addVertex(xb, yb, za); tessellator.addVertex(xb, ya, za); tessellator.addVertex(xa, ya, za); tessellator.addVertex(xa, ya, zb); tessellator.addVertex(xa, yb, zb); tessellator.addVertex(xb, yb, zb); tessellator.addVertex(xb, ya, zb); tessellator.addVertex(xa, ya, zb); tessellator.draw(); tessellator.startDrawing(GL11.GL_LINES); tessellator.addVertex(xa, ya, za); tessellator.addVertex(xa, ya, zb); tessellator.addVertex(xa, yb, za); tessellator.addVertex(xa, yb, zb); tessellator.addVertex(xb, ya, za); tessellator.addVertex(xb, ya, zb); tessellator.addVertex(xb, yb, za); tessellator.addVertex(xb, yb, zb); tessellator.draw(); }
  22. Did you try the technique in this link I posted earlier? http://www.minecraftforge.net/forum/index.php/topic,11963.0.html -TGG
  23. Hi A few things to try This link shows where the files should go http://greyminecraftcoder.blogspot.com.au/2013/12/overview-of-forge-and-what-it-can-do.html If you still can't find it, this might help http://www.minecraftforge.net/forum/index.php/topic,11963.0.html Keep in mind that the upper/lower case must match exactly. You should use Main.modid + ":BlockTulipTreeLeaves" otherwise it will look in the minecraft resources folder (that's what the minecraft: in your error log means) It also looks like you've forgotten to setTextureName your BlockTulipSapling_Tulip properly (hence the MISSING_ICON_TILE_203). -TGG
  24. Hi Thanks for the pics, that makes it much clearer. A few thoughts 1) I don't think that parameter is actually the player [x,y,z]. I think it's actually the coordinates of the point on the block face where the player's line of sight intersects. 2) I think you will need to retrieve the player's coordinates using player.posX, .posY etc. This is not ideal but it should work I think. 3) when comparing dirx with dirz, in order to see whether the wall is east-west or north-south, you should take Math.abs(), because they can be negative or positive. 4) what happens if dirx == dirz? 5) I understand how you want it to work for clicking on the top or bottom of block; but I'm not sure your east, west, north, south will do something reasonable /** * Handles a players right click. Args: player, world, x, y, z, side, hitVec */ public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, Vec3 par8Vec3) { this.syncCurrentPlayItem(); float f = (float)par8Vec3.xCoord - (float)par4; float f1 = (float)par8Vec3.yCoord - (float)par5; float f2 = (float)par8Vec3.zCoord - (float)par6; (f, f1, f2 are eventually passed to onItemUse(). re hitVec - see class MovingObjectPosition) -TGG
  25. Hi This link shows the coordinate system (you seem to have it right already?) http://greyminecraftcoder.blogspot.com.au/2013/07/blocks.html I don't understand what you mean "the wall was only facing one direction", and I'm not sure what you intend those ++bx etc to do? Perhaps you could show some screenshots of what it actually looks like, compared with what you want? -TGG
×
×
  • Create New...

Important Information

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