修复重铸台问题

This commit is contained in:
17146 2024-09-09 22:24:44 +08:00
parent 8d4b272cef
commit 4e1eb576da
2 changed files with 10 additions and 2 deletions

View file

@ -445,9 +445,15 @@ public class ReforgingTableMenu extends AbstractContainerMenu {
}
public boolean mayPlace(ItemStack pStack) {
var slot = switch (type) {
case AMMO -> AMMO_PERK_SLOT;
case FUNCTIONAL -> FUNC_PERK_SLOT;
case DAMAGE -> DAMAGE_PERK_SLOT;
};
return pStack.getItem() instanceof PerkItem perkItem && perkItem.getPerk().type == type
&& !container.getItem(INPUT_SLOT).isEmpty() && container.getItem(INPUT_SLOT).getItem() instanceof GunItem gunItem
&& gunItem.canApplyPerk(perkItem.getPerk());
&& gunItem.canApplyPerk(perkItem.getPerk()) && container.getItem(slot).isEmpty();
}
public int getMaxStackSize() {

View file

@ -40,7 +40,7 @@ public class ReforgingTableScreen extends AbstractContainerScreen<ReforgingTable
public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) {
this.renderBackground(pGuiGraphics);
super.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick);
this.renderTooltip(pGuiGraphics, pMouseX, pMouseY);
var ammoPerkLevel = ReforgingTableScreen.this.menu.ammoPerkLevel.get();
var funcPerkLevel = ReforgingTableScreen.this.menu.funcPerkLevel.get();
var damagePerkLevel = ReforgingTableScreen.this.menu.damagePerkLevel.get();
@ -62,6 +62,8 @@ public class ReforgingTableScreen extends AbstractContainerScreen<ReforgingTable
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);
this.renderTooltip(pGuiGraphics, pMouseX, pMouseY);
}
@Override