diff --git a/src/main/java/com/atsuishio/superbwarfare/client/screens/ReforgingTableScreen.java b/src/main/java/com/atsuishio/superbwarfare/client/screens/ReforgingTableScreen.java index f1eb22d7d..2bdbd8907 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/screens/ReforgingTableScreen.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/screens/ReforgingTableScreen.java @@ -19,6 +19,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class ReforgingTableScreen extends AbstractContainerScreen { + private static final ResourceLocation TEXTURE = ModUtils.loc("textures/gui/reforging_table.png"); public ReforgingTableScreen(ReforgingTableMenu pMenu, Inventory pPlayerInventory, Component pTitle) { @@ -46,26 +47,30 @@ public class ReforgingTableScreen extends AbstractContainerScreen 0) { - pGuiGraphics.blit(TEXTURE, this.leftPos + 140, this.topPos + 31, 5 * ammoPerkLevel - 5, 178, 5, 5, 200, 200); + renderNumber(pGuiGraphics, this.leftPos + 136, this.topPos + 31, 1, 178, ammoPerkLevel); } if (funcPerkLevel > 0) { - pGuiGraphics.blit(TEXTURE, this.leftPos + 148, this.topPos + 31, 5 * funcPerkLevel - 5, 184, 5, 5, 200, 200); + renderNumber(pGuiGraphics, this.leftPos + 146, this.topPos + 31, 1, 184, funcPerkLevel); } if (damagePerkLevel > 0) { - pGuiGraphics.blit(TEXTURE, this.leftPos + 156, this.topPos + 31, 5 * damagePerkLevel - 5, 190, 5, 5, 200, 200); + renderNumber(pGuiGraphics, this.leftPos + 156, this.topPos + 31, 1, 190, damagePerkLevel); } var upgradePoint = ReforgingTableScreen.this.menu.upgradePoint.get(); - int pointG = upgradePoint / 10; - int pointS = upgradePoint % 10; - pGuiGraphics.blit(TEXTURE, this.leftPos + 43, this.topPos + 20, 51 + 5 * pointG, 178, 5, 5, 200, 200); - pGuiGraphics.blit(TEXTURE, this.leftPos + 47, this.topPos + 20, 51 + 5 * pointS, 178, 5, 5, 200, 200); + renderNumber(pGuiGraphics, this.leftPos + 43, this.topPos + 20, 51, 178, upgradePoint); this.renderTooltip(pGuiGraphics, pMouseX, pMouseY); } + private void renderNumber(GuiGraphics guiGraphics, int x, int y, int u, int v, int number) { + int g = number / 10; + int s = number % 10; + guiGraphics.blit(TEXTURE, x, y, u + 5 * g, v, 5, 5, 200, 200); + guiGraphics.blit(TEXTURE, x + 4, y, u + 5 * s, v, 5, 5, 200, 200); + } + @Override protected void init() { super.init(); @@ -103,7 +108,7 @@ public class ReforgingTableScreen extends AbstractContainerScreen { - if (ReforgingTableScreen.this.menu.ammoPerkLevel.get() >= 50) { + if (ReforgingTableScreen.this.menu.ammoPerkLevel.get() >= ReforgingTableMenu.MAX_PERK_LEVEL) { return; } } case FUNCTIONAL -> { - if (ReforgingTableScreen.this.menu.funcPerkLevel.get() >= 50) { + if (ReforgingTableScreen.this.menu.funcPerkLevel.get() >= ReforgingTableMenu.MAX_PERK_LEVEL) { return; } } case DAMAGE -> { - if (ReforgingTableScreen.this.menu.damagePerkLevel.get() >= 50) { + if (ReforgingTableScreen.this.menu.damagePerkLevel.get() >= ReforgingTableMenu.MAX_PERK_LEVEL) { return; } } @@ -178,7 +183,7 @@ public class ReforgingTableScreen extends AbstractContainerScreen= 100 && !isCreative) { + if (!upgrade && this.upgradePoint.get() >= MAX_UPGRADE_POINT && !isCreative) { return; } switch (type) { case AMMO -> - this.ammoPerkLevel.set(upgrade ? Math.min(50, this.ammoPerkLevel.get() + 1) : Math.max(1, this.ammoPerkLevel.get() - 1)); + this.ammoPerkLevel.set(upgrade ? Math.min(MAX_PERK_LEVEL, this.ammoPerkLevel.get() + 1) : Math.max(1, this.ammoPerkLevel.get() - 1)); case FUNCTIONAL -> - this.funcPerkLevel.set(upgrade ? Math.min(50, this.funcPerkLevel.get() + 1) : Math.max(1, this.funcPerkLevel.get() - 1)); + this.funcPerkLevel.set(upgrade ? Math.min(MAX_PERK_LEVEL, this.funcPerkLevel.get() + 1) : Math.max(1, this.funcPerkLevel.get() - 1)); case DAMAGE -> - this.damagePerkLevel.set(upgrade ? Math.min(50, this.damagePerkLevel.get() + 1) : Math.max(1, this.damagePerkLevel.get() - 1)); + this.damagePerkLevel.set(upgrade ? Math.min(MAX_PERK_LEVEL, this.damagePerkLevel.get() + 1) : Math.max(1, this.damagePerkLevel.get() - 1)); } if (!isCreative) { - this.upgradePoint.set(Mth.clamp(this.upgradePoint.get() + (upgrade ? -1 : 1), 0, 100)); + this.upgradePoint.set(Mth.clamp(this.upgradePoint.get() + (upgrade ? -1 : 1), 0, MAX_UPGRADE_POINT)); } } @@ -289,7 +292,7 @@ public class ReforgingTableMenu extends AbstractContainerMenu { ItemStack output = gun.copy(); PerkHelper.removePerkByType(output, perkItem.getPerk().type); - output.getOrCreateTag().putDouble("UpgradePoint", Math.min(100, level - 1 + output.getOrCreateTag().getDouble("UpgradePoint"))); + output.getOrCreateTag().putDouble("UpgradePoint", Math.min(MAX_UPGRADE_POINT, level - 1 + output.getOrCreateTag().getDouble("UpgradePoint"))); this.upgradePoint.set((int) output.getOrCreateTag().getDouble("UpgradePoint")); this.container.setItem(INPUT_SLOT, output); @@ -325,7 +328,7 @@ public class ReforgingTableMenu extends AbstractContainerMenu { } int point = (int) pStack.getOrCreateTag().getDouble("UpgradePoint"); - this.upgradePoint.set(Mth.clamp(point, 0, 100)); + this.upgradePoint.set(Mth.clamp(point, 0, MAX_UPGRADE_POINT)); var ammoPerk = PerkHelper.getPerkByType(pStack, Perk.Type.AMMO); if (ammoPerk != null) {