Jump to content

ultra_reemun

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by ultra_reemun

  1. Thanks for the suggestion! I'm new to modding, do you know how I would check for only one side?
  2. I am using a Tick event as a cooldown timer and am getting outputs from both client and server, breaking my timer length. In this code, cooldown is printing twice every tick and incrementing both times, breaking my speed. @SubscribeEvent public static void playerTick(TickEvent.PlayerTickEvent event) { cooldown++; System.out.println(cooldown); } I know I'm missing something obvious here, is there anyway I can only get one of the two? Thank you for your help.
  3. Thanks for pointing that out, I didn't realise the implications. I will look into Forge's tick events as I'm new to modding Minecraft. Thanks for the help!
  4. I am currently using Java's built in Timer for my code, however I am facing problems such as it still running whilst the game is paused. Is there a built in Timer for forge? In my case, I need: A timer that runs code after a fixed time E.g when a key is pressed, wait five seconds then do something A timer that runs code every tick for a fixed time E.g when a key is pressed, do something constantly for five seconds Any Help would be greatly appreciated! - Roman Edit: This is my first mod so if anything seems too obvious, please share because I'll have learned something!
  5. Turns out I wasn't reading your previous answer properly, it worked! Is there anyway I can check to see if the player is in creative mode in order to not render the experience bar? Thank you for all your help
  6. Thank you for your quick reply @Animefan8888! I am trying to keep experience displayed and render my HUD over the top of it as it is a cooldown meter that is only shown temporarily, is there any way I could adapt your code for this?
  7. I am trying to make the experience bar change color on an event. My code works, but the expLevel (e.g 30) appears behind my HUD, not infront of it. How would I go about making my HUD appear behind it? Any help would be greatly appreciated! My code is as follows: @OnlyIn(Dist.CLIENT) public class DodgeGui { private final ResourceLocation bar = new ResourceLocation(Dodge.MODID, "textures/gui/dodgebar.png"); public final static int width = 182; //182 private final int height = 5; public static int j = 0; @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent event) { if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT) { Minecraft mc = Minecraft.getInstance(); mc.getTextureManager().bindTexture(bar); int scaledHeight = mc.getMainWindow().getScaledHeight() - 32 + 3; int scaledWidth = mc.getMainWindow().getScaledWidth() / 2 - 91; //-91 mc.ingameGUI.blit(scaledWidth, scaledHeight, 0, height, j, height); } } } Thank you greatly for your time. - Roman
  8. Thank you! That's really helped. I've managed to use the code from a snowball to get me started, although I'm still not too experienced in sending packets so I'll look into that now.
  9. 1.15.2 As the title states ^ Any help would be greatly appreciated, this is my first mod! I currently have it set to a keypress, here's my code: public class DodgeEvent { @SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (Keybinds.dodge.isPressed()) { PlayerEntity player = Minecraft.getInstance().player; /* Things I'm messing around with: float rotation = player.cameraYaw; Vec3d look = player.getLookVec(); System.out.println(rotation + "and" + look.x + "" + look.y); player.addVelocity(look.x, 0, look.y); */ } } } I have a feeling it has something to do with player.moveForward and player.moveStrafe although I can't find any recent documentation on this. Thank you in advance for your help! I'm completely lost!
×
×
  • Create New...

Important Information

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