- 40
- 3
- 1
Как можно менять текстуру той кнопки у которой id равен такому то значению?
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);
}
}
Твой renderButton вызывается в методе render? Если нет, то переопредели метод render у себя в классе, и вызывай renderButton в нёму меня не получается изменить активной кнопки текстурку, она просто не меняется
говнокод: