Changement de position de barres et "désactivation"



  • Salut !

    J'aimerai viré toutes les barres de Minecraft, Fain, Vie et Xp du coup j'ai appliqué ce code :

    @SubscribeEvent
    public void maskXpBar(RenderGameOverlayEvent.Pre event)
    {
    if(event.type == ElementType.EXPERIENCE)
    {
    event.setCanceled(true);
    }
    if(event.type == ElementType.FOOD)
    {
    event.setCanceled(true);
    }
    if(event.type == ElementType.HEALTH)
    {
    event.setCanceled(true);
    }
    }
    

    Et donc j'aimerai "les déplacer" avec ce code :

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public static void renderThirst(int rwidth, int rheight)
    {
    bind(new ResourceLocation("thirstmod:textures/gui/thirstBar-new.png"));
    ClientStats stats = ClientStats.getInstance();
    GuiIngame ingameGUI = mc.ingameGUI;
    updateCounter = ingameGUI.getUpdateCounter();
    int height = rheight - 49;
    int xStart = 1;
    int yStart = 1;
    int yEnd = 9;
    int xEnd = 7;
    
    if(stats.saturation <= 0.0F && updateCounter % ((stats.level + 1) * 3 + 1) == 0)
    {
    height += rand.nextInt(3) - 1;
    }
    
    ingameGUI.drawTexturedModalRect(rwidth - 10, rheight / 2, xStart, yStart, xEnd, yEnd);
    ingameGUI.drawTexturedModalRect(rwidth - 10, rheight / 2, xStart + 8, yStart, xEnd, yEnd);
    GL11.glColor4f(1, 1, 1, 1);
    FMLClientHandler.instance().getClient().fontRenderer.drawString(stats.level + "", rwidth - 30, rheight / 2, 0xFFFFFF);
    FMLClientHandler.instance().getClient().fontRenderer.drawString(Minecraft.getMinecraft().thePlayer.getFoodStats().getFoodLevel() * 5 + "", rwidth - 30, rheight / 2 + 10, 0xFFFFFF);
    FMLClientHandler.instance().getClient().fontRenderer.drawString(Math.round(Minecraft.getMinecraft().thePlayer.getHealth() * 5) + "", rwidth - 30, rheight / 2 + 20, 0xFFFFFF);
    GL11.glColor4f(1, 1, 1, 1);
    bind(Gui.icons);
    ingameGUI.drawTexturedModalRect(rwidth - 10, rheight / 2 + 10, 16, 36, 9, 9);
    ingameGUI.drawTexturedModalRect(rwidth - 10, rheight / 2 + 20, 53, 1, 7, 7);
    }
    

    Mais le problème c'est que des que je désactive le moindre event barre de Minecraft mon code n'est plus affiché :S

    Un petit coup de pouce ? 🙂


  • Administrateurs

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public static void renderThirst(int rwidth, int rheight)
    Non valide.

    ça c'est valide :
    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void nomDeLaMethod(NomDeLevent event)