Jump to content

J3ramy

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by J3ramy

  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!
  16. Hello modders, is there any event that gets fired when F11 (fullscreen/windowed) is pressed? I tried the ScreenEvent.KeyboardKeyPressedEvent, but it gets not fired when I it. Thanks in advance!
  17. Hey @warjort, I'm sorry, you're right... I removed some "unneccessary" code but I deleted this as well. Here's my link to my github repo: https://github.com/j3ramy/edomeconomy-1.18.2 You can find the relevant files here PatchCableItem (custom item): src/main/java/de/j3ramy/edomeconomy/item/custom/PatchCableItem.java RouterBlock (custom block): src/main/java/de/j3ramy/edomeconomy/block/custom/RouterBlock.java Block register: src/main/java/de/j3ramy/edomeconomy/block/ModBlocks.java Main class: src/main/java/de/j3ramy/edomeconomy/EdomEconomyMod.java Hope, this helps more
  18. Hey modders, I hope you can help me. I want to right click my custom item on my custom block so that the useOn-method gets called - but it's actually not getting called. If I try right clicking a vanilla block with my item it works... Did I forgot to override a method in my custom block class or something? Thanks in advance My custom item class My custom block My block register My mod class
  19. Hey guys, I have a problem with my Minecraft run in intelliJ for three days now. Every time when I start my runClient this error appears in the run console after a couple of seconds: Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.minecraftservices.com/privileges Minecraft is still starting but it's impossible to debug because this error supresses all following output... Does somebody have the same problem or any solution to ignore this error? I tried another internet connection but no change... Thanks
  20. Hey guys, I am kinda new to the process of how gradle is working. For now, I have written a library as an jar which I want to include in my new project. I uploaded it to CurseForge. Right now, I am adding it like this: build.gradle But if I want to access the classes from this library IntelliJ cannot find any of them. It seems like the library gets not loaded... Thanks for your help!
  21. Perfect. Thank you @diesieben07 and @warjort!
  22. Ah okay this was actually just for debug purpose. But good to know. So, in there data not set yet, because it gets set there. Am I right? But I don't get it why it's still null in the constructor EDIT: It works now for some reason. Another question: Is there a limit in how many content an nbt tag can save? E. g. can I add thousands of strings? Or is the limit actually the space on the hard disk?
  23. Ok, I changed my class to: As you can see this error gets created when I try to print it after I saved it. And I don't really know what this error means, because the tag has a name ("db")
×
×
  • Create New...

Important Information

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