Skip to content

Commit

Permalink
added tab config
Browse files Browse the repository at this point in the history
  • Loading branch information
Globox1997 committed Nov 7, 2022
1 parent 6da98e1 commit 5d73732
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/main/java/draylar/tiered/config/TieredConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class TieredConfig implements ConfigData {
public float reforge_modifier = 0.9F;
@Comment("Modify the biggest weights by this modifier per smithing level")
public float levelz_reforge_modifier = 0.01F;
public boolean showReforgingTab = true;

public int xIconPosition = 0;
public int yIconPosition = 0;
Expand Down
22 changes: 12 additions & 10 deletions src/main/java/draylar/tiered/mixin/client/AnvilScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,21 @@ public AnvilScreenMixin(AnvilScreenHandler handler, PlayerInventory playerInvent
@Override
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
super.drawBackground(matrices, delta, mouseX, mouseY);
if (ConfigInit.CONFIG.showReforgingTab) {
RenderSystem.setShaderTexture(0, ReforgeScreen.TEXTURE);
// anvil icon
this.drawTexture(matrices, this.x + ConfigInit.CONFIG.xIconPosition, this.y - 23 + ConfigInit.CONFIG.yIconPosition, 0, 166, 24, 27);
// reforge icon
this.drawTexture(matrices, this.x + 25 + ConfigInit.CONFIG.xIconPosition, this.y - 21 + ConfigInit.CONFIG.yIconPosition, 48, 166, 24, 21);

RenderSystem.setShaderTexture(0, ReforgeScreen.TEXTURE);
// anvil icon
this.drawTexture(matrices, this.x + ConfigInit.CONFIG.xIconPosition, this.y - 23 + ConfigInit.CONFIG.yIconPosition, 0, 166, 24, 27);
// reforge icon
this.drawTexture(matrices, this.x + 25 + ConfigInit.CONFIG.xIconPosition, this.y - 21 + ConfigInit.CONFIG.yIconPosition, 48, 166, 24, 21);

if (this.isPointWithinBounds(26 + ConfigInit.CONFIG.xIconPosition, -20 + ConfigInit.CONFIG.yIconPosition, 22, 19, (double) mouseX, (double) mouseY))
this.renderTooltip(matrices, Text.translatable("screen.tiered.reforging_screen"), mouseX, mouseY);
if (this.isPointWithinBounds(26 + ConfigInit.CONFIG.xIconPosition, -20 + ConfigInit.CONFIG.yIconPosition, 22, 19, (double) mouseX, (double) mouseY))
this.renderTooltip(matrices, Text.translatable("screen.tiered.reforging_screen"), mouseX, mouseY);
}
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (this.client != null && this.focusedSlot == null && !isBCLibLoaded
if (this.client != null && ConfigInit.CONFIG.showReforgingTab && this.focusedSlot == null && !isBCLibLoaded
&& this.isPointWithinBounds(26 + ConfigInit.CONFIG.xIconPosition, -20 + ConfigInit.CONFIG.yIconPosition, 22, 19, (double) mouseX, (double) mouseY))
TieredClientPacket.writeC2SScreenPacket((int) this.client.mouse.getX(), (int) this.client.mouse.getY(), true);

Expand All @@ -62,7 +63,8 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) {

@Override
public boolean mouseReleased(double mouseX, double mouseY, int button) {
if (button == 0 && isBCLibLoaded && this.isPointWithinBounds(26 + ConfigInit.CONFIG.xIconPosition, -20 + ConfigInit.CONFIG.yIconPosition, 22, 19, (double) mouseX, (double) mouseY))
if (button == 0 && ConfigInit.CONFIG.showReforgingTab && isBCLibLoaded
&& this.isPointWithinBounds(26 + ConfigInit.CONFIG.xIconPosition, -20 + ConfigInit.CONFIG.yIconPosition, 22, 19, (double) mouseX, (double) mouseY))
TieredClientPacket.writeC2SScreenPacket((int) this.client.mouse.getX(), (int) this.client.mouse.getY(), true);

return super.mouseReleased(mouseX, mouseY, button);
Expand Down

0 comments on commit 5d73732

Please sign in to comment.