• Recently Browsing

    No registered users viewing this page.

  • Posts

    • I'm wondering how I can render fixed lines between tile entities in a simular way to buildcraft markers or immersive engineering wires. The actual rendering and render types i've figured out and I have it rendering from a single tile to a player mostly using mcjtys tutorial https://wiki.mcjty.eu/modding/index.php?title=Tut15_Ep15 for tile entity rendering. the issue is that I essentially have a kind of linked list of a bunch of points that are all linked together using real world positions but to draw this on the clientside relative to the player seems incredibly difficult since the only event I can think of is the client tick events and then I don't know how I would grab the matrix stack equivalent positions relative to the player from the actual positions within the world. I'm not sure if thats even possible.   The vast majority of the code is essentially very simular to mcjtys tutorial code with a few very minor edits so for a better reference: https://wiki.mcjty.eu/modding/index.php?title=Tut15_Ep15 for tile entity rendering. Tile > player method (currently works) static void drawTileToPlayer(TileEntity tile, ClientPlayerEntity player, MatrixStack matrixStack){ IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource(); IVertexBuilder lineBuilder = buffer.getBuffer(CustomRenderTypes.THICK_LINES); BlockPos playerPos = player.getPosition(); BlockPos tilePos = tile.getPos(); int px = playerPos.getX(); int py = playerPos.getY(); int pz = playerPos.getZ(); float[] lineColour = getLineColour(tile.getBlockState().getBlock()); drawLine(lineBuilder, generateProjectedMatrix(matrixStack),tilePos.getX() + 0.5f,tilePos.getY() + 0.6f,tilePos.getZ() + 0.5f, px + 0.5f, py + 0.5f, pz + 0.5f, lineColour); matrixStack.pop(); buffer.finish(CustomRenderTypes.THICK_LINES); } This draws a line from the tile to the player position using a matrix stack from the renderworldlastevent event. Generate projected matrix private static Matrix4f generateProjectedMatrix(MatrixStack matrixStack){ // Begin pushing to the matrix stack. matrixStack.push(); // Get actual position of player and translate back to the actual location. E.g. blockpos is discrete integers. projected view isn't. Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView(); matrixStack.translate(-projectedView.x, -projectedView.y, -projectedView.z); return matrixStack.getLast().getMatrix(); }   Drawline method private static void drawLine(IVertexBuilder builder, Matrix4f posMatrix, float x1, float y1, float z1, float x2, float y2, float z2, float[] colour){ builder.pos(posMatrix, x1, y1, z1) .color(colour[0], colour[1], colour[2], colour[3]) .endVertex(); builder.pos(posMatrix, x2, y2, z2) .color(colour[0], colour[1], colour[2], colour[3]) .endVertex(); } I did think of using blocks simular to string that would generate between the marker points as they are placed but unlike buildcraft i'm fixing where you can place the markers in the X & Z planes but not in the Y plane so that wont work.  
    • I'm trying to create a new dimension, but I've realized I need to make a custom chunk generator for what I need. But I'm having a hard time figuring out what I need to do to register the chunk generator type, or finding info on how to do so. Does anyone know how I could go about that, or have any examples of how to make a custom chunk generator?
    • Or refactor your code to access the capability directly instead of through a method so you can use ifPresent properly.  (That is, your method serves no purpose)
    • I had set it to take damage when I am sneaking for testing, and when I removed the exclamation point I still didn't take damage sneaking
    • Are you saying you want the entity to take damage when you are sneaking on it?  Not damage except when you're sneaking on it (i.e. magma blocks)?  If so, you'll want to check entityIn.isSneaking(), not !entityIn.isSneaking().  The latter returns true when the entity isn't sneaking.
  • Topics

  • Who's Online (See full list)