Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Hi Well to be honest I was noob once (and still am in plenty of areas) so that doesn't really bother me much Best way for a noob to ascend to coder god is to start by imitating the experts, I reckon... Awesome, thanks! Any particular areas you're thinking of? -TGG
  2. Hi Vanilla has a good example of this in ItemModelGenerator - it uses the texture of a given item to build the 3D IBlockModel of the item - starts from makeItemModel, the accessing of the texels is in func_178393_a using getFrameTextureData(). You just need to provide the TextureAtlasSprite from the texture map (see makeItemModel) -TGG
  3. Hi >So i know i can render an overlay over my block without having to render two blocks at once, Are you sure that's still possible in 1.8? I haven't found a way yet except using TileEntity (without ASM+reflection that is). BlockGrass now uses a model with snowed property, it doesn't render with overlays. You could perhaps do something similar if you have a custom ore- your block state could have a property of light level - say 0 - 15: 1) you override getMixedBrightnessForBlock() to always return full brightness for rendering, 2) in getActualState() you change the property depending on the true mixed brightness, and the renderer chooses the IBlockModel corresponding to the It might work but it's pretty clumsy. Personally I'd suggest using ASM+Reflection to add a custom renderer (eg override Block.getRenderType() to return 4, and add a case to BlockRenderDispatcher.renderBlock and .renderBlockDamage) public boolean renderBlock(IBlockState p_175018_1_, BlockPos p_175018_2_, IBlockAccess p_175018_3_, WorldRenderer p_175018_4_) { try { int i = p_175018_1_.getBlock().getRenderType(); if (i == -1) { return false; } else { switch (i) { case 1: return this.fluidRenderer.renderFluid(p_175018_3_, p_175018_1_, p_175018_2_, p_175018_4_); case 2: return false; case 3: IBakedModel ibakedmodel = this.getModelFromBlockState(p_175018_1_, p_175018_3_, p_175018_2_); return this.blockModelRenderer.renderModel(p_175018_3_, ibakedmodel, p_175018_1_, p_175018_2_, p_175018_4_); default: return false; } } } Let me know if you decide to try it and it works -TGG
  4. Hi I had the same problem (worked around it by generating a new world), wasted a couple of hours trying to track it down. I think it's a bug, Forge should handle that automatically. I think it may be the same as this issue: https://github.com/MinecraftForge/MinecraftForge/issues/1530 -TGG
  5. Hi This code snippet may help, if all you want to do is draw a circle (ring) /** * Draw an arc centred around the zero point. Setup translatef, colour and line width etc before calling. * @param radius * @param startAngle clockwise starting from 12 O'clock (degrees) * @param endAngle (degreesO */ void drawArc(double radius, double startAngle, double endAngle, double zLevel) { final double angleIncrement = Math.toRadians(10.0); float direction = (endAngle >= startAngle) ? 1.0F : -1.0F; double deltaAngle = Math.abs(endAngle - startAngle); deltaAngle %= 360.0; startAngle -= Math.floor(startAngle/360.0); startAngle = Math.toRadians(startAngle); deltaAngle = Math.toRadians(deltaAngle); GL11.glBegin(GL11.GL_LINE_STRIP); double x, y; double arcPos = 0; boolean arcFinished = false; do { double truncAngle = Math.min(arcPos, deltaAngle); x = radius * Math.sin(startAngle + direction * truncAngle); y = -radius * Math.cos(startAngle + direction * truncAngle); GL11.glVertex3d(x, y, zLevel); arcFinished = (arcPos >= deltaAngle); arcPos += angleIncrement; } while (!arcFinished && arcPos <= Math.toRadians(360.0)); // arcPos test is a fail safe to prevent infinite loop in case of problem with angle arguments GL11.glEnd(); } -TGG
  6. PS forgot to mention - you will need to do the collision checking yourself. look at BlockTorch.collisionRayTrace for a good example. -TGG
  7. Hi I think you might be mixing up the Collision boxes and the Bounding boxes? i.e. getSelectedBoundingBoxFromPool() not addCollisionBoxesToList(). The only way I know to have multiple selection bounding boxes is to hook into the DrawBlockHighlightEvent event, check if your block is being highlighted, and if so render the outline yourself using the tessellator. RenderGlobal.drawOutlinedBoundingBox has good clues on how to do that. -TGG
  8. Not to mention why we could use a proper web interface to the database... -TGG
  9. Hi It's not possible yet unless you convert your model to the IBlockModel format. See here for more information: http://greyminecraftcoder.blogspot.com.au/2014/12/item-rendering-18.html -TGG
  10. Hi The diagrams in this link might help http://greyminecraftcoder.blogspot.co.at/2014/12/the-tessellator-and-worldrenderer-18.html -TGG
  11. I was having trouble from your video trying to figure out what was happening; maybe it would be better to test your code using a few "fake" fixed entity positions. Are you sure your calculation of rotation is correct? It looks like you are calculating a quadrant number, but rotateAroundY uses radians. -TGG
  12. Ah OK, my bad... -TGG
  13. Hi The world.getStarBrightness() and world.getSunBrightness() methods look promising. You might be able to implement this through the corresponding WorldProvider methods, for example by DimensionManager.unregisterProviderType and then DimensionManager.registerProviderType for the surface world with your new customised WorldProvider. Otherwise ASM+Reflection is probably necessary. -TGG
  14. Hi Why do you want to use packets? I suggest it would be better to hook into the appropriate forge events instead. If you really want to use packets, I would suggest you intercept the appropriate methods in INetHandlerPlayClient. You will probably need to use ASM+Reflection for that. -TGG
  15. Hi I don't know when Lex plans to add AdvancedModelLoader back in; if you have some experience you could add it yourself, I can't imagine it will be very complicated since it's the same OpenGL renderering as before, just needs adaption to the new Tessellator (WorldRenderer) classes. At the moment I think the only way to custom render blocks and items is to use ASM/Reflection to modify the vanilla rendering classes, for example overriding Block.getRenderType() to return (eg) 4, and then modifying eg BlockRendererDispatcher: public boolean renderBlock(IBlockState p_175018_1_, BlockPos p_175018_2_, IBlockAccess p_175018_3_, WorldRenderer p_175018_4_) { try { int i = p_175018_1_.getBlock().getRenderType(); if (i == -1) { return false; } else { switch (i) { case 1: return this.fluidRenderer.renderFluid(p_175018_3_, p_175018_1_, p_175018_2_, p_175018_4_); case 2: return false; case 3: IBakedModel ibakedmodel = this.getModelFromBlockState(p_175018_1_, p_175018_3_, p_175018_2_); return this.blockModelRenderer.renderModel(p_175018_3_, ibakedmodel, p_175018_1_, p_175018_2_, p_175018_4_); // add case 4: here default: return false; } } } I imagine Forge will be updated to add the equivalent of the old ISBRH and IItemRenderer if enough people ask; don't know when though. You could ask on the suggestions forum. AFAIK TileEntitySpecialRenderers should still work, you would just need to port the AdvancedModelLoader across -TGG
  16. Hi DataWatchers are one-way communication only, from Server to Client. From memory, you can't even read them on the Server side. So I suggest you use a member variable instead if you are on the server side. -TGG
  17. Hi setBlock has become setBlockState. BlockID and metadata are now combined into a single class called IBlockState. See here for more info: http://greyminecraftcoder.blogspot.co.at/2014/12/blocks-18.html Re the shader - I know zip about shaders. But it's quite easy to make a private field public; just use Reflection (there are several tutorials on using it for Forge, alternatively you could look at this example: https://github.com/TheGreyGhost/SpeedyTools/blob/master/src/main/java/speedytools/clientside/userinput/KeyBindingInterceptor.java (It uses Reflection to make four private fields in KeyBinding public). -TGG
  18. Hi This is a working example that might be useful. https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe03_block_variants -TGG
  19. Hi What happens if you put your Logger .isRemote statement before the super.onUpdate(), does it get called server side too? -TGG
  20. Hi You might want to look at world.setSkylightSubtracted(int newSkylightSubtracted) and/or calculatedSkyLightSubtracted() I think what you're proposing might work, but it probably won't be as robust as using a built-in method (with minor tweak if reqd). -TGG
  21. Hi You might try overriding Entity.canBeCollidedWith() to return true. Not sure if it will do what you want but might be worth a try. -TGG
  22. Hi Keen, thanks, that does look useful, I will incorporate it (when I get to overlays which might be a while ) -TGG
  23. Hi These links might also help http://greyminecraftcoder.blogspot.co.at/2014/12/blocks-18.html http://greyminecraftcoder.blogspot.com.au/2014/12/block-rendering-18.html http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-18.html http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-texturing-quads-faces.html -TGG
  24. Hi The coordinate system that minecraft uses is shown on this page http://greyminecraftcoder.blogspot.co.at/2014/12/blocks-18.html By 3D to 2D, do you mean you want an overhead view? i.e. someone looking straight down from up high? If so, your code looks about right except that your 64x64 rectangle should actually be a circle. I would suggest you make sure to clip the result to a valid range (i.e. cull if it's outside the valid range) before drawing. Does it work how you expect or is there a problem? -TGG
  25. then try other values until it looks right... For example GL11.glTranslated(10, 0, 0); then change it to GL11.glTranslated(100,0,0); then change it to GL11.glTranslated(-50,0,0); etc eventually you will find the value of deltax which translates the image to the correct location. -TGG
×
×
  • Create New...

Important Information

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