Изменение текстуры кнопки по id

Версия Minecraft
1.16.5
API
Forge
Как можно менять текстуру той кнопки у которой id равен такому то значению?
 
116
13
13
У класса Widget есть метод renderButton, в котором происходит бинд текстуры и отрисовка кнопки. К примеру, создай класс на основе Button и переопредели этот метод, в котором будешь делать проверку на id и биндить нужную тебе текстуру для кнопки.
 
Последнее редактирование:
у меня не получается изменить активной кнопки текстурку, она просто не меняется
говнокод:
button:
   public void onPress() {
           Minecraft minecraft = Minecraft.getInstance();
           MatrixStack ms = new MatrixStack();
                         if(this.active == true) {   
                       if(id == 0) {
                               this.active = false;
                       }
                       if(id == 1) {
                                 this.active = false;
                          }         
           } else
                      if (this.active == false) {

                           if(id == 0) {
                                       this.active = true;
                           }
                           if(id == 1) {
                                this.active = true;
                           }
                       }
       }



 public void renderButton(MatrixStack p_230431_1_, int mouseX, int mouseY, float p_230431_4_) {
          int width = Minecraft.getInstance().getWindow().getWidth();
          int height = Minecraft.getInstance().getWindow().getHeight();
          Minecraft minecraft = Minecraft.getInstance();
          if(id == 0 && this.active == false) {
          minecraft.getTextureManager().bind(this.icon);
          RenderSystem.enableDepthTest();
          blit(p_230431_1_, this.x, this.y, (float)this.xTexStart, 0, this.width, this.height, this.textureWidth, this.textureHeight);
          }
          if(id == 1 && this.active == false) {
          minecraft.getTextureManager().bind(this.icon);
          RenderSystem.enableDepthTest();
          blit(p_230431_1_, this.x, this.y, (float)this.xTexStart, 0, this.width, this.height, this.textureWidth, this.textureHeight);
          }
          if(id == 0 && this.active == true) {
          minecraft.getTextureManager().bind(this.iconS);
          RenderSystem.enableDepthTest();
          blit(p_230431_1_, this.x, this.y, (float)this.xTexStart, 0, this.width, this.height, this.textureWidth, this.textureHeight);
          }
          if(id == 1 && this.active == true) {
          minecraft.getTextureManager().bind(this.iconS);
          RenderSystem.enableDepthTest();
          blit(p_230431_1_, this.x, this.y, (float)this.xTexStart, 0, this.width, this.height, this.textureWidth, this.textureHeight);
          }

       }
 
116
13
13
у меня не получается изменить активной кнопки текстурку, она просто не меняется
говнокод:
Твой renderButton вызывается в методе render? Если нет, то переопредели метод render у себя в классе, и вызывай renderButton в нём
 
Сверху