small fixes to tool tips. allow +1 button to go over maxstacksize

This commit is contained in:
PrototypeTrousers
2022-10-17 22:33:42 -03:00
parent 1f1d6d041a
commit c9f1387098
3 changed files with 21 additions and 15 deletions
+3 -10
View File
@@ -191,14 +191,6 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
GlStateManager.disableDepth();
}
@Nonnull
@Override
public List<String> getItemToolTip(@Nonnull ItemStack itemStack) {
List<String> l = super.getItemToolTip(itemStack);
l.add(1, TextFormatting.GRAY + String.valueOf(itemStack.getCount()));
return l;
}
public List<Rectangle> getJEIExclusionArea() {
return Collections.emptyList();
}
@@ -904,8 +896,9 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
this.itemRender.zLevel = 0.0F;
}
}
if (s instanceof AppEngSlot) {
if (s instanceof SlotPlayerInv || s instanceof SlotPlayerHotBar) {
super.drawSlot(s);
} else if (s instanceof AppEngSlot) {
((AppEngSlot) s).setDisplay(true);
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
@@ -21,6 +21,9 @@ package appeng.client.gui;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotPlayerHotBar;
import appeng.container.slot.SlotPlayerInv;
import appeng.core.AEConfig;
import appeng.core.localization.ButtonToolTips;
import net.minecraft.inventory.Container;
@@ -43,11 +46,12 @@ public abstract class AEBaseMEGui extends AEBaseGui {
protected void renderToolTip(final ItemStack stack, final int x, final int y) {
final Slot s = this.getSlot(x, y);
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
final List<String> currentToolTip = this.getItemToolTip(stack);
if (s instanceof SlotME && !stack.isEmpty()) {
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
IAEItemStack myStack = null;
final List<String> currentToolTip = this.getItemToolTip(stack);
try {
final SlotME theSlotField = (SlotME) s;
@@ -56,7 +60,7 @@ public abstract class AEBaseMEGui extends AEBaseGui {
}
if (myStack != null) {
if (myStack.getStackSize() > bigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
if (myStack.getStackSize() > 1) {
final String local = ButtonToolTips.ItemsStored.getLocal();
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize());
final String format = String.format(local, formattedAmount);
@@ -86,6 +90,15 @@ public abstract class AEBaseMEGui extends AEBaseGui {
return;
}
} else if (s instanceof AppEngSlot) {
if (!(s instanceof SlotPlayerInv) && !(s instanceof SlotPlayerHotBar)) {
if (!s.getStack().isEmpty()) {
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(s.getStack().getCount());
currentToolTip.add(TextFormatting.GRAY + formattedAmount);
this.drawHoveringText(currentToolTip, x, y, this.fontRenderer);
return;
}
}
}
super.renderToolTip(stack, x, y);
@@ -328,13 +328,13 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
for (int x = 0; x < this.craftingSlots.length; x++) {
input[x] = this.craftingSlots[x].getStack();
if (!input[x].isEmpty() && input[x].getCount() + increase > input[x].getMaxStackSize()) {
if (!input[x].isEmpty() && input[x].getCount() + increase < 0) {
canIncreaseInputs = false;
}
}
for (final OptionalSlotFake outputSlot : this.outputSlots) {
final ItemStack out = outputSlot.getStack();
if (!out.isEmpty() && out.getCount() + increase > out.getMaxStackSize()) {
if (!out.isEmpty() && out.getCount() + increase < 0) {
canIncreaseOutputs = false;
}
}