Jump to content

xiaomi_lai

Members
  • Posts

    9
  • Joined

  • Last visited

xiaomi_lai's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I mean what should i do to use the OverlayRegistry to draw the texture in my screen(in the game).
  2. Thanks,but could you tell me what should accurately do to modify the codes to achieve my goal?
  3. [1.17]Hey bro,i want to load a texture that can appear on the screen(like ui) when i hold some itmes,so i make a: package com.xiaomi.derby.screen; import com.mojang.blaze3d.vertex.PoseStack; import com.xiaomi.derby.item.ModItems; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import static net.minecraftforge.fmlclient.gui.GuiUtils.drawTexturedModalRect; public class UIRenderer { private static final ResourceLocation TEXTURE = new ResourceLocation("derby","textures/gui/speed_bar"); @SubscribeEvent public void onRenderGui(RenderGameOverlayEvent.Post event) { LocalPlayer player = Minecraft.getInstance().player; if(RenderGameOverlayEvent.ElementType.ALL.equals(event.getType())){ assert player != null; if(player.getItemInHand(InteractionHand.MAIN_HAND).is(ModItems.HORSE_WHIP.get())) { Minecraft.getInstance().textureManager.bindForSetup(TEXTURE); drawTexturedModalRect(new PoseStack(), 50, 50, 80, 41, 80, 41, 0); } } } } But when i entered the game , i found there was not the texture which i set,it was a black rectangle.Can you tell me how can i solve this problem?THANKS A LOT!
  4. Hello everyone! I'm quite new to forge, I needed to create a GUI Overlays and I found an article https://emxtutorials.wordpress.com/simple-in-game-gui-overlay/ on how to create a gui overlay, but as I understood the classes were renamed in 1.17. Can you share a sample code that would perform this function? Thank you very much!!!
  5. ohh I know what should i do ,thanks alots!!!!!
  6. Oh thank you bro.But I need the REAL-TIME speed ,not the entity's attribute.
  7. Hey My Dear Friends, Could you teach me how to GET THE REAL SPEED of entity or player(Such as the horse's speed when it running)? I'm modding my first mod,so I don't know how to do that,I have searched for the Google and Youtube but there was no answer for the Minecraft1.17,so I couldn't really understand it. If you can help me,I'm really thank a lot!!!
×
×
  • Create New...

Important Information

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