Jump to content

J3ramy

Members
  • Posts

    87
  • Joined

  • Last visited

Recent Profile Visitors

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

J3ramy's Achievements

Stone Miner

Stone Miner (3/8)

1

Reputation

  1. Hey modders, currently I am sending data from the client to the server to handle the data serveside and save it in a Block Entity by using SimpleChannel. Now, I want to pass a callback function/interface, which will be called when the server side processing has been finished (call it in the server side handle method). Is it possible to pass functions via the network like that or do I have to send a new package instance to the client again? Thank you!
  2. Still, thank you @Luis_ST ! The idea of rotating the poseStack actually works for me by applying some mathematical caluclations. That's my code for now (if someone will have the same question): public final class Line { private final Point startPoint, endPoint; private final int color, lineWidth; private float lineLength, rotationAngleInDeg; public Line(Point start, Point end, int lineWidth, int color) { this.startPoint = start; this.endPoint = end; this.lineWidth = Math.abs(lineWidth); this.color = color; this.calculateLine(); } public Line(int x1, int y1, int x2, int y2, int lineWidth, int color) { this(new Point(x1, y1), new Point(x2, y2), lineWidth, color); } public void render(PoseStack poseStack) { poseStack.pushPose(); poseStack.translate(this.startPoint.x, this.startPoint.y, 0); poseStack.mulPose(Vector3f.ZP.rotationDegrees(this.rotationAngleInDeg)); if(this.lineWidth % 2 == 0 || this.lineWidth == 1){ AbstractContainerScreen.fill(poseStack, 0, 0, (int) (this.lineLength), this.lineWidth, this.color); } else{ AbstractContainerScreen.fill(poseStack, 0, -this.lineWidth / 2, (int) (this.lineLength), this.lineWidth / 2, this.color); } poseStack.popPose(); } private void calculateLine(){ final int deltaX = this.endPoint.x - this.startPoint.x; final int deltaY = this.startPoint.y - this.endPoint.y; this.lineLength = (float) Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); this.rotationAngleInDeg = (float) Math.toDegrees(Math.atan2(deltaY, deltaX)) * -1; } } Just instantiante a Line object in your Screen class and call the Line render method inside your Screen render method and just pass the poseStack
  3. Yes, horizontal and vertical line use the fill method which creates a rectangle. But I want to draw a line diagonally as well (not only vertical/horizontal). So, I guess the solution is not to draw a rectangle (except you can rotate it?). I guess a better solution would be to work with the RenderSystem and pose stack (as shown in my code above), but it is not working (nothing appears on screen) Afaik the RenderSystem uses OpenGL? Do you have any idea what's wrong in my code?
  4. Yes, I already know But I want to draw a diagnoal line as well
  5. Hey, I want to render a line on screen depending on a start- and end point. I call it in the render() method of my screen class which extends from AbstractContainerScreen<MyMenu> So far I got this method (inspired from GuiComponent.fill()):
  6. Thank you! How do I tell the actual block that this block item subclass should be applied. I haven't found any method to overwrite inside the block class
  7. Hey guys, I want to save the position of any right clicked block inside the main held block item and copy it to the block entity when the block item gets placed Is that possible? Thanks
  8. Because in my case the whitelist state for players depends on a special database
  9. I am programming a mod which checks if the player is whitelisted via database query. And in the ServerStartingEvent I want to check if the connection can be established - if not, then switch back to the title screen EDIT: I found the ClientPlayerNetworkEvent.LoggedInEvent which is client only. There, I can also disconnect the player from the server immediately via ClientPlayerNetworkEvent.LoggedInEvent#getConnection()#disconnect(Component)
  10. Good evening guys, I want to go back to the title screen (just for test purpose) when the ServerStartingEvent gets triggered, but then it crashes and this error gets printed: My Event Class: @Mod.EventBusSubscriber(modid = EdomRpMod.MOD_ID) public class ModEvents { @SubscribeEvent public static void onServerStarting(ServerStartingEvent event){ Minecraft.getInstance().setScreen(new TitleScreen()); } } EDIT: Add error stack trace Does anyone know how to switch screens between the main menu and other screens (no ingame overlay)?
  11. Omg it can be so easy ^^ Thank you @warjort !
  12. Hey guys, I wanna know if it's possible to start and join a Minecraft server on my computer in IntelliJ. I tried the "runServer" and the "runGameTestServer" gradle tasks but they automatically stop. I mean I can just host an extern server and always build my mod and upload it there but it seems that there is an easier way. Can someone help me?
  13. @MistaOmegathanks for your suggestion! I looked at what you said. For now I use the current block direction and the hit result direction. So, my method for recognizing the front face is this: private boolean isFrontFace(Direction blockDirection, Direction hitDirection){ return blockDirection == hitDirection; } And in my use()-method I call it: if(this.isFrontFace(pState.getValue(HORIZONTAL_FACING), pHit.getDirection())) ... Maybe there are different ways to check it, but this works for me Thank you!
  14. Hey guys, I hope you can help me. Currently, I am creating a block and open a gui inside the use()-method. Now, I want to add a side check - So, that always the front side opens the gui. I looked at the parameters but I wasn't able to find the side attribute anymore (which was available in older versions). Does it still exists or is it replaced by a new one? My block has a horizontal facing property, so this has to be included as well Thanks for your help, J3ramy
  15. Actually, the Event you mentioned is fired when F11 is pressed Thank you!
×
×
  • Create New...

Important Information

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