#X and Y value changing in constructor but not showing in render

1 messages · Page 1 of 1 (latest)

opal ledge
#

Class being rendered:



    public RenderSettings() {
        super("Settings");
        this.x = sr.getScaledWidth() / 2 - 150;
        this.y = sr.getScaledHeight() / 2 - 100;
        this.width = 250;
        this.height = 230;

        for(Setting s : HUDMod.preferenceManager.getPreferences()) {
            if(s.getValue() instanceof Boolean) {
                buttons.add(new BooleanPreference(x + 10, y + 45 + offset, width - 75, 15, s));
                offset += 16;
            }
        }

    }

    private int x, y, width, height;
    private int dragX = 0, dragY = 0;
    private boolean dragging = false;
    double scrollY = 0;
    int offset = 0;
    private ArrayList<PreferenceButton> buttons = new ArrayList<>();

    @Override
    public void draw(int mouseX, int mouseY, float partialTicks) {

        if(dragging){
            this.x = mouseX - dragX;
            this.y = mouseY - dragY;
        }


        RoundedShader.drawRoundOutline(x, y, width, height, 4,0.2f, new Color(0xff181A17), new Color(255, 255, 255));
        Fontutil.drawTextShadow("Settings", x + width / 2 - Fontutil.getWidth("Settings"), y + 3, -1);

        // Preferences
        if(isMouseOver(x + 10, y + 45, width - 75, 70, mouseX, mouseY)) {
            scrollY += Mouse.getDWheel() * 0.03D;
        }

        //Renderutil.ScissorStack stack = new Renderutil.ScissorStack();
        Fontutil.drawTextShadow("Client Preferences", x + 10, y + 45 - (int) (Fontutil.getHeight() + 3), -1);
        RoundedShader.drawRound(x + 10, y + 45, width - 75, 70, 4, new Color(38, 38, 38));
       // stack.pushScissor(x + 10, y + 45, width - 75, 70);
        for (PreferenceButton b : this.buttons) {
            b.setX(this.x + 10);
            b.setY(this.y + 45 + this.offset + (int) scrollY);
            b.draw(mouseX, mouseY, partialTicks);
        }

      //  stack.popScissor();
}```
soft saffronBOT
# opal ledge Class being rendered: ```public class RenderSettings extends Panel { publi...

Detected code, here are some useful tools:

Formatted code
public class RenderSettings extends Panel {
  public RenderSettings() {
    super ("Settings");
    this .x = sr.getScaledWidth() / 2 - 150;
    this .y = sr.getScaledHeight() / 2 - 100;
    this .width = 250;
    this .height = 230;
    for (Setting s : HUDMod.preferenceManager.getPreferences()) {
      if (s.getValue() instanceof Boolean) {
        buttons.add(new BooleanPreference(x + 10, y + 45 + offset, width - 75, 15, s));
        offset += 16;
      }
    }
  }
  private int x, y, width, height;
  private int dragX = 0, dragY = 0;
  private boolean dragging = false;
  double scrollY = 0;
  int offset = 0;
  private ArrayList<PreferenceButton> buttons = new ArrayList<>();
  @Override
  public void draw(int mouseX, int mouseY, float partialTicks) {
    if (dragging) {
      this .x = mouseX - dragX;
      this .y = mouseY - dragY;
    }
    RoundedShader.drawRoundOutline(x, y, width, height, 4, 0.2f, new Color(0xff181A17), new Color(255, 255, 255));
    Fontutil.drawTextShadow("Settings", x + width / 2 - Fontutil.getWidth("Settings"), y + 3,  - 1);
    // Preferences
    if (isMouseOver(x + 10, y + 45, width - 75, 70, mouseX, mouseY)) {
      scrollY += Mouse.getDWheel() * 0.03D;
    }
    //Renderutil.ScissorStack stack = new Renderutil.ScissorStack();
    Fontutil.drawTextShadow("Client Preferences", x + 10, y + 45 - (int ) (Fontutil.getHeight() + 3),  - 1);
    RoundedShader.drawRound(x + 10, y + 45, width - 75, 70, 4, new Color(38, 38, 38));
    // stack.pushScissor(x + 10, y + 45, width - 75, 70);
    for (PreferenceButton b : this .buttons) {
      b.setX(this .x + 10);
      b.setY(this .y + 45 + this .offset + (int ) scrollY);
      b.draw(mouseX, mouseY, partialTicks);
    }
    //  stack.popScissor();
  }
#

<@&987246399047479336> please have a look, thanks.