Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Silverminer

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Silverminer's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Look the Forge's source code. In BedBlock, minecrafts uses PlayerEntity#displayClientMessage to display sleep result (which can be success or failure, so "You can only sleep at night"). Just give an ITextComponent (StringTextComponent or TranslationTextComponent in most cases) and set the second boolean to true to send an state text instead of sending it to the chat. So: PlayerEntity player = //Get player here player.displayClientMessage(new StringTextComponent(""), true); I havn't check that, but it should be somthing like that
  2. I've search a bit around and found this: https://gitlab.com/modding-legacy/lava-monster/-/blob/1.16.x/src/main/java/com/legacy/lava_monster/entity/LavaMonsterEntity.java It looks like they do what you want to do. Hope this helps. Do you have an implementation of #aiStep? Check if you call the super method. May i can help more when i see more code
  3. I don't know how i can thank you enough. It does work now! Thanks also for the tip with line width. The only problem is, that i can't see my box through water, but i think i should start a new topic for that.
  4. You should register your goals in #registerGoals instead of your constructor. I'm not sure, but i think you should have an attack goal too (In zombie it is ZombieAttackGoal). If it still doesn't work, please post more code (or a github link). Hope i can help
  5. I'm not sure what you try with FAKE_WITHER, but here is the an link to an old topic about spawn eggs. There is also an up to date implementation of mine: https://github.com/Silverminer007/MoreOre-1.16/blob/master/src/main/java/com/silverminer/moreore/common/objects/items/ModSpawnEggItem.java If this isn't what you were looking for post a github or so for code to get an idea of what you've tried
  6. Looks like it is an issue with FOV, because when disabling FOV effects the box is rendered fine. Changing fov in options screen, does move the world but not my box, when i use worldrender last event. It looks like #renderWorld does implement fov anywhere, but i can't figure out where. Do i need to implement fov myself and if yes how to do it? Or do i need something else, what BlockHighlight Event already implements? Anybody an idea, or an idea where to look? An working example would help too. Thanks in advance
  7. Thanks for the replys. I was using the same translation as minecraft, but i've tried yours too and it still does not work. The lines are still moving while flying and so on, but now sneaking does affect it too. The lines were also in the middle of the block instead of beeing at the side. Vector3d vec = mc.gameRenderer.getMainCamera().getPosition(); double renderPosX = vec.x(); double renderPosY = vec.y(); double renderPosZ = vec.z(); ms.pushPose(); ms.translate(-renderPosX, -renderPosY, -renderPosZ); Right now i was using this translation and i've checked, the Minecraft function (WorldRenderer#renderLineBox) uses MatrixStack#last#pose in vertexbuilder. I'll keep on searching for the right translation and any idea would be nice. Any idea about the colour or the lineWidth? Thanks for all the help again
  8. I just need to translate the matrixstack back to the world coordinates. How should i do it instead? Were is the difference between the MatrixStacks of the two events? To me it looks like Minecraft does some translations in #renderLevel, but i can see which ones. Am i wrong? Is the translation using render entities position and partial ticks better? Or is the translation completly useless?
  9. Hello, this is my first post, so please be considerate of errors The whole code is on my github too: https://github.com/Silverminer007/Shrines/blob/experimental/src/main/java/com/silverminer/shrines/events/ClientEvents.java So, i want to draw boxes to the world which don't depent on any block/tileentity in the world. I've written a method that should draw the lines. I'm calling it from RenderWorldLastEvent event. Here is my code: public static void renderBounds(MatrixStack ms) { // Enable depth test first RenderSystem.depthMask(false); // Get Minecraft and store it locally for multiple use Minecraft mc = Minecraft.getInstance(); // Get dimension to draw only bounds of the correct dimension RegistryKey<World> dim; if (mc.level != null) { dim = mc.level.dimension(); } else { dim = null; } // This doesn't work in both ways. What's the correct / working way to do that? RenderSystem.lineWidth(30.0f); // Translate coordinates from players system to world system Vector3d vec = mc.gameRenderer.getMainCamera().getPosition(); double renderPosX = vec.x(); double renderPosY = vec.y(); double renderPosZ = vec.z(); ms.pushPose(); ms.translate(-renderPosX, -renderPosY, -renderPosZ); // Get vertex builder IRenderTypeBuffer irendertypebuffer1 = mc.renderBuffers().bufferSource(); IVertexBuilder vb = irendertypebuffer1.getBuffer(RenderType.lines()); // Color of the bound (White) Color c = new Color(Utils.properties.bound_color); // Split up in red, green and blue and transform it to 0.0 - 1.0 float red = c.getRed() / 255.0f; float green = c.getGreen() / 255.0f; float blue = c.getBlue() / 255.0f; // Iterate over all bounds to draw for (CustomStructureData data : Utils.DATAS_FROM_SERVER) { for (ResourceData rd : data.PIECES_ON_FLY) { if (rd.getDimension() == dim) { MutableBoundingBox mbb = rd.getBounds(); // Drawing a line box as in StructureTileEntityRenderer#render WorldRenderer.renderLineBox(ms, vb, mbb.x0, mbb.y0, mbb.z0, mbb.x1, mbb.y1, mbb.z1, red, green, blue, 1.0f, red, green, blue); } } } ms.popPose(); } The lines were drawn, but are in the wrong color (Dark Green/Black instead of White) until the inventory is opened. After opening they turn white. The lines are also moving while flying, sprinting and bobbing. Looks like i've missed something, but what? I've tested to call my method from DrawHighlightEvent.HighlightBlock and suprisingly everything worked fine! I've searched in vanilla code and saw, DrawHighlightEvent.HighlightBlock is called in WorldRenderer#renderLevel and RenderWorldLastEvent from GameRenderer#render. GameRenderer calls first WorldRenderer#renderLevel and then DrawHighlightEvent.HighlightBlock is fired, so something seems to change inside #renderLevel. I think it's MatrixStack, because it's the only parameter i use from RenderWorldLastEvent and DrawHighlightEvent.HighlightBlock. It could also be any variable from Minecraft Instance, but i'm not sure how to check that. In the image, you see two boxes, one from DrawHighlightEvent.HighlightBlock(the inner white) and one from RenderWorldLastEvent(The outer) Does anyone have an idea how to fix or what to check? Thanks for all the help in advance
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.