Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/16/20 in all areas

  1. You means modding ? If yes just follow https://mcforge.readthedocs.io/en/1.15.x/ If you means mcp, unzip the version that you want (http://www.modcoderpack.com/website/releases) then follow a tutorial If you think it's eclipse, check if you're using JDK8 (not 13)
    1 point
  2. Actually it didn't quite work in the nether, but now it does. The reason I am posting this is, that if someone has the same problem in the future, they will find this. I searched for this on google for a good hour, but didn't find anything. New code: @SubscribeEvent public void render(RenderWorldLastEvent event) { IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource(); IVertexBuilder builder = buffer.getBuffer(RenderType.LINES); MatrixStack matrixStack = event.getMatrixStack(); PlayerEntity player = Minecraft.getInstance().player; double x = player.lastTickPosX + (player.getPosX() - player.lastTickPosX) * event.getPartialTicks(); double y = player.lastTickPosY + (player.getPosY() - player.lastTickPosY) * event.getPartialTicks(); double z = player.lastTickPosZ + (player.getPosZ() - player.lastTickPosZ) * event.getPartialTicks(); matrixStack.push(); matrixStack.translate(-x, -y, -z); Matrix4f matrix = matrixStack.getLast().getMatrix(); builder.pos(matrix, 0, 0, 0).color(1f, 0, 0, 1f).endVertex(); builder.pos(matrix, 0, 256, 0).color(1f, 0, 0, 1f).endVertex(); matrixStack.pop(); RenderSystem.disableDepthTest(); buffer.finish(RenderType.LINES); }
    1 point
  3. Yeah so my idea does include to limit the possible configs. Since you can't register blocks from a config file, you have to register a specific amount. This also means you must have an addon per mod that add ores. It will indeed limit a lot the possible configs for a direct user. However, you could try and integrate an api for modpack creators that could then more precisely define and configure the details of your ores. I have been managing a mod with a lot of config options for the last 2 & 1/2 months and I feel that having easy configs is much better than having tons of config for direct users. In that mindset, limiting the possibilities of your config could improve user experience: having a config that is just changing 5 numbers and boom gold is super dense, coal less, iron and diamond medium and then they can play. (Reread what you said and not sure I understand what you mean by the density variant isn't the only thing you wanted? Also for the density levels, my bad thought that you were drawing multiple blocks per ore blocks...) Of course this is your mod not mine so if you really want mass configurability it doesn't seem to be possible purely using forge's config system. They also will not add any support for something like this since the "policy" is to always register everything, meaning it shouldn't depend on configs.
    1 point
  4. Howdy My usual strategy for solving this sort of problem is 1) For a method in a small class, I just open the new class and browse it looking for code which is similar to the 1.14.4 code If the class is large or the method has moved out to another class 1) Use my IDE to search for all usages of the method in 1.14.4, and make note of a distinctive class/method which uses it 2) Go to the same class+method in 1.15.2 and see what the same code is calling now. YOu might also find these links helpful https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a and https://gist.github.com/williewillus/30d7e3f775fe93c503bddf054ef3f93e Cheers TGG
    1 point
  5. Ok, here's repo. I set it public now. https://github.com/immortalmice/FoodPower This mod is under construction, so everything will be what I mention in README.txt. My mod have many parts. About making food, this mod has some cooking patterns, such as cake, pizza, salad...etc. You can select a pattern to make a recipe, pattern will tell you what ingredients is necessary, and what is optional(with certain food types). With recipe, you can follow cooking steps on it to make your food by using oven, frying pan, juicer...etc. Depend on what you used in this food, after eating it will give you some buff and some special experience. Experience will help you on cooking new meals, and most important - some special power for you in gaming minecraft. And there some other features in this mod, so I still working hard for it
    1 point
  6. Hi If you can't modify the server, and there is only one or a few chests that you're trying to track, then you could consider the client tick event; once every (eg) 20 ticks you could check to see if the chest still exists at the expected location. Likewise you could periodically check the chest contents to see if they have changed. That would detect changes not caused by the local player. I can't think of any other client events which are triggered on updates to changes to chest contents. -TGG
    1 point
  7. Thanks for your reply! Finally got it working correctly! new code: public class PathRenderer { private Minecraft mc; public PathRenderer() { mc = Minecraft.getInstance(); } @SubscribeEvent public void render(RenderWorldLastEvent event){ Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); MatrixStack matrixStack = event.getMatrixStack(); Vec3d pos = mc.player.getPositionVec(); matrixStack.push(); matrixStack.translate(-pos.x, -pos.y, -pos.z); RenderSystem.color3f(1, 0, 0); RenderSystem.lineWidth(6); buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); Matrix4f matrix = matrixStack.getLast().getMatrix(); Color c = new Color(1f, 0f, 0f, 1f); drawLine(matrix, buffer, new Vec3d(0, 57, 0), new Vec3d(5, 57, 0)); tessellator.draw(); matrixStack.pop(); } private void drawLine(Matrix4f matrix, BufferBuilder buffer, Vec3d p1, Vec3d p2) { buffer.pos(matrix, (float)p1.x + 0.5f, (float)p1.y + 0.5f, (float)p1.z + 0.5f).endVertex(); buffer.pos(matrix, (float)p2.x + 0.5f, (float)p2.y + 0.5f, (float)p2.z + 0.5f).endVertex(); } }
    1 point
  8. Hi yes a lot has changed. In particular, the code no longer uses the OpenGL transformation matrices, it keeps track of its own in a MatrixStack. So you need to supply the MatrixStack to the rendering method. Check out this link https://gist.github.com/williewillus/30d7e3f775fe93c503bddf054ef3f93e And this example code (from a Tile Entity Renderer, but you should be able to adapt it.) https://github.com/TheGreyGhost/MinecraftByExample/tree/master - see mbe21 class RenderLines or class DebugBlockVoxelShapeHighlighter package minecraftbyexample.mbe21_tileentityrenderer; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import minecraftbyexample.usefultools.RenderTypeHelper; import net.minecraft.client.renderer.*; import net.minecraft.util.math.Vec3d; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.awt.*; /** * User: The Grey Ghost * Date: 12/01/2015 * This class shows examples of rendering using lines. * The lines have position and colour information only (RenderType.getLines()). No lightmap information, which means that * they will always be the same brightness regardless of day/night or nearby torches. */ public class RenderLines { public static void renderWireframe(TileEntityMBE21 tileEntityMBE21, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer renderBuffers, int combinedLight, int combinedOverlay) { // draw the artifact using lines // (Draws an inverted tetrahedron wireframe above the rendered base block (hopper block model)) // When the TER::render method is called, the origin [0,0,0] is at the current [x,y,z] of the block being rendered. // The tetrahedron-drawing method draws the tetrahedron in a cube region from [0,0,0] to [1,1,1] but we want it // to be in the block one above this, i.e. from [0,1,0] to [1,2,1], // so we need to translate up by one block, i.e. by [0,1,0] final Vec3d TRANSLATION_OFFSET = new Vec3d(0, 1, 0); matrixStack.push(); // push the current transformation matrix + normals matrix matrixStack.translate(TRANSLATION_OFFSET.x,TRANSLATION_OFFSET.y,TRANSLATION_OFFSET.z); // translate Color artifactColour = tileEntityMBE21.getArtifactColour(); drawTetrahedronWireframe(matrixStack, renderBuffers, artifactColour); matrixStack.pop(); // restore the original transformation matrix + normals matrix } /** * Draw an upside-down wireframe tetrahedron with its tip at [0.5,0,0.5] * and 1x1 square "base" at y = 1 (x= 0 to 1, z = 0 to 1) * @param matrixStack transformation matrix and normal matrix * @param renderBuffers the renderbuffers we'll be drawing to */ private static void drawTetrahedronWireframe(MatrixStack matrixStack, IRenderTypeBuffer renderBuffers, Color color) { final Vec3d [] BASE_VERTICES = { new Vec3d(0, 1, 0), new Vec3d(1, 1, 0), new Vec3d(1, 1, 1), new Vec3d(0, 1, 1), }; final Vec3d APEX_VERTEX = new Vec3d(0.5, 0, 0.5); IVertexBuilder vertexBuilderLines = renderBuffers.getBuffer(RenderTypeHelper.MBE_LINE_DEPTH_WRITING_ON); // Note that, although RenderType.getLines() might appear to be suitable, it leads to weird rendering if used in // tile entity rendering, because it doesn't write to the depth buffer. In other words, any object in the scene // which is drawn after the lines, will render over the top of the line (erase it) even if the object is behind // the lines. This means that RenderType.getLines() is only suitable for lines which are the last thing drawn in // the scene (such as DrawBlockHighlightEvent) // The solution I used here is a custom RenderType for lines which does write to the depth buffer. Matrix4f matrixPos = matrixStack.getLast().getMatrix(); //retrieves the current transformation matrix // draw the base for (int i = 1; i < BASE_VERTICES.length; ++i) { drawLine(matrixPos, vertexBuilderLines, color, BASE_VERTICES[i-1], BASE_VERTICES[i]); } drawLine(matrixPos, vertexBuilderLines, color, BASE_VERTICES[BASE_VERTICES.length - 1], BASE_VERTICES[0]); // draw the sides (from the corners of the base to the apex) for (Vec3d baseVertex : BASE_VERTICES) { drawLine(matrixPos, vertexBuilderLines, color, APEX_VERTEX, baseVertex); } } /** * Draw a coloured line from a starting vertex to an end vertex * @param matrixPos the current transformation matrix * @param renderBuffer the vertex builder used to draw the line * @param startVertex * @param endVertex */ private static void drawLine(Matrix4f matrixPos, IVertexBuilder renderBuffer, Color color, Vec3d startVertex, Vec3d endVertex) { renderBuffer.pos(matrixPos, (float) startVertex.getX(), (float) startVertex.getY(), (float) startVertex.getZ()) .color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()) // there is also a version for floats (0 -> 1) .endVertex(); renderBuffer.pos(matrixPos, (float) endVertex.getX(), (float) endVertex.getY(), (float) endVertex.getZ()) .color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()) // there is also a version for floats (0 -> 1) .endVertex(); } } or this one, from the HighlightBlock event package minecraftbyexample.usefultools.debugging; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.vertex.IVertexBuilder; import minecraftbyexample.usefultools.RenderTypeMBE; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.World; import net.minecraftforge.client.event.DrawHighlightEvent; import net.minecraftforge.client.event.RenderTooltipEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import java.awt.*; import java.lang.reflect.Field; import static minecraftbyexample.usefultools.debugging.DebugSettings.getDebugParameter; /** * Created by TGG on 27/06/2019. */ public class DebugBlockVoxelShapeHighlighter { @SubscribeEvent public static void onDrawBlockHighlightEvent(DrawHighlightEvent.HighlightBlock event) { RayTraceResult rayTraceResult = event.getTarget(); if (rayTraceResult.getType() != RayTraceResult.Type.BLOCK) return; World world; try { world = getPrivateWorldFromWorldRenderer(event.getContext()); } catch (IllegalAccessException e) { return; } BlockPos blockpos = ((BlockRayTraceResult) rayTraceResult).getPos(); BlockState blockstate = world.getBlockState(blockpos); if (blockstate.isAir(world, blockpos) || !world.getWorldBorder().contains(blockpos)) return; final Color SHAPE_COLOR = Color.RED; final Color RENDERSHAPE_COLOR = Color.BLUE; final Color COLLISIONSHAPE_COLOR = Color.GREEN; final Color RAYTRACESHAPE_COLOR = Color.MAGENTA; boolean showshape = DebugSettings.getDebugParameter("showshape").isPresent(); boolean showrendershapeshape = DebugSettings.getDebugParameter("showrendershape").isPresent(); boolean showcollisionshape = DebugSettings.getDebugParameter("showcollisionshape").isPresent(); boolean showraytraceshape = DebugSettings.getDebugParameter("showraytraceshape").isPresent(); if (!(showshape || showrendershapeshape || showcollisionshape || showraytraceshape)) return; ActiveRenderInfo activeRenderInfo = event.getInfo(); ISelectionContext iSelectionContext = ISelectionContext.forEntity(activeRenderInfo.getRenderViewEntity()); IRenderTypeBuffer renderTypeBuffers = event.getBuffers(); MatrixStack matrixStack = event.getMatrix(); if (showshape) { VoxelShape shape = blockstate.getShape(world, blockpos, iSelectionContext); drawSelectionBox(event.getContext(), renderTypeBuffers, matrixStack, blockpos, activeRenderInfo, shape, SHAPE_COLOR); } if (showrendershapeshape) { VoxelShape shape = blockstate.getRenderShape(world, blockpos); drawSelectionBox(event.getContext(), renderTypeBuffers, matrixStack, blockpos, activeRenderInfo, shape, RENDERSHAPE_COLOR); } if (showcollisionshape) { VoxelShape shape = blockstate.getCollisionShape(world, blockpos, iSelectionContext); drawSelectionBox(event.getContext(), renderTypeBuffers, matrixStack, blockpos, activeRenderInfo, shape, COLLISIONSHAPE_COLOR); } if (showraytraceshape) { VoxelShape shape = blockstate.getRaytraceShape(world, blockpos); drawSelectionBox(event.getContext(), renderTypeBuffers, matrixStack, blockpos, activeRenderInfo, shape, RAYTRACESHAPE_COLOR); } event.setCanceled(true); } private static World getPrivateWorldFromWorldRenderer(WorldRenderer worldRenderer) throws IllegalAccessException { if (worldField == null) { worldField = ObfuscationReflectionHelper.findField(WorldRenderer.class, "world"); } return (World)worldField.get(worldRenderer); } private static Field worldField; /** * copied from WorldRenderer; starting from the code marked with iprofiler.endStartSection("outline"); * * @param activeRenderInfo */ private static void drawSelectionBox(WorldRenderer worldRenderer, IRenderTypeBuffer renderTypeBuffers, MatrixStack matrixStack, BlockPos blockPos, ActiveRenderInfo activeRenderInfo, VoxelShape shape, Color color) { RenderType renderType = RenderTypeMBE.LINES(); IVertexBuilder vertexBuilder = renderTypeBuffers.getBuffer(renderType); double eyeX = activeRenderInfo.getProjectedView().getX(); double eyeY = activeRenderInfo.getProjectedView().getY(); double eyeZ = activeRenderInfo.getProjectedView().getZ(); final float ALPHA = 0.5f; drawShapeOutline(matrixStack, vertexBuilder, shape, blockPos.getX() - eyeX, blockPos.getY() - eyeY, blockPos.getZ() - eyeZ, color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, ALPHA); } private static void drawShapeOutline(MatrixStack matrixStack, IVertexBuilder vertexBuilder, VoxelShape voxelShape, double originX, double originY, double originZ, float red, float green, float blue, float alpha) { Matrix4f matrix4f = matrixStack.getLast().getMatrix(); voxelShape.forEachEdge((x0, y0, z0, x1, y1, z1) -> { vertexBuilder.pos(matrix4f, (float)(x0 + originX), (float)(y0 + originY), (float)(z0 + originZ)).color(red, green, blue, alpha).endVertex(); vertexBuilder.pos(matrix4f, (float)(x1 + originX), (float)(y1 + originY), (float)(z1 + originZ)).color(red, green, blue, alpha).endVertex(); }); } } Cheers TGG
    1 point
  9. I just want to add new blockstate and model WITHOUT creating new file in assets. Only in code, maybe from String
    0 points
×
×
  • Create New...

Important Information

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