Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;

public class GuiMEItemOutputBus extends GuiMEItemBus {
Expand All @@ -39,7 +41,7 @@ public void initGui() {
}

@Override
protected void actionPerformed(final GuiButton btn) throws IOException {
protected void actionPerformed(@NotNull final GuiButton btn) throws IOException {
super.actionPerformed(btn);

if (btn == this.stackSizeBtn) {
Expand Down Expand Up @@ -69,7 +71,7 @@ public CustomStackSizeButton(int x, int y) {

@Override
public String getMessage() {
return "Configure Stack Size";
return I18n.format("gui.meitembus.stack_size.config");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.io.IOException;
Expand Down Expand Up @@ -64,7 +66,7 @@ public void initGui() {
this.guiLeft + 154,
this.guiTop,
busIcon,
"ME Machinery Item Output Bus",
busIcon.getDisplayName(),
this.itemRender
));
}
Expand All @@ -87,7 +89,7 @@ public void initGui() {
}

@Override
protected void actionPerformed(final GuiButton btn) throws IOException {
protected void actionPerformed(@NotNull final GuiButton btn) throws IOException {
super.actionPerformed(btn);

if (btn == this.originalGuiBtn) {
Expand All @@ -101,7 +103,7 @@ protected void actionPerformed(final GuiButton btn) throws IOException {
value = 1;
}
this.sendStackSizeToServer((int) value);
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
}
}

Expand Down Expand Up @@ -159,7 +161,7 @@ private long parseValue(String text) {
throw new NumberFormatException("Invalid expression");
}

return (long) Math.round(result);
return Math.round(result);
} catch (Exception ex) {
throw new NumberFormatException("Invalid number or expression");
}
Expand Down Expand Up @@ -272,7 +274,7 @@ private void onMouseWheelEvent(int wheel) {

@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRenderer.drawString("Stack Size", 8, 6, 0x404040);
this.fontRenderer.drawString(I18n.format("gui.meitembus.stack_size.name"), 8, 6, 0x404040);
}

@Override
Expand Down Expand Up @@ -307,7 +309,7 @@ public void onGuiClosed() {
try {
ContainerMEItemOutputBusStackSize container = (ContainerMEItemOutputBusStackSize) this.inventorySlots;
sendStackSizeToServer(container.getStackSize());
} catch (Exception ex) {
} catch (Exception ignored) {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import appeng.container.guisync.GuiSync;
import github.kasuminova.mmce.common.tile.MEItemOutputBus;
import net.minecraft.entity.player.InventoryPlayer;
import org.jetbrains.annotations.NotNull;

public class ContainerMEItemOutputBusStackSize extends AEBaseContainer {

private final MEItemOutputBus outputBus;

@GuiSync(0)
public int stackSize = Integer.MAX_VALUE;
public int stackSize;

public ContainerMEItemOutputBusStackSize(final InventoryPlayer inventoryPlayer, final MEItemOutputBus outputBus) {
super(inventoryPlayer, outputBus);
Expand All @@ -36,7 +37,7 @@ public void detectAndSendChanges() {
}

@Override
public void onContainerClosed(net.minecraft.entity.player.EntityPlayer playerIn) {
public void onContainerClosed(@NotNull net.minecraft.entity.player.EntityPlayer playerIn) {
super.onContainerClosed(playerIn);

if (!playerIn.world.isRemote) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ public static int insertAll(@Nonnull ItemStack stack, IItemHandlerModifiable han
int inserted = 0;
for (int i = 0; i < handler.getSlots(); i++) {
int maxStackSize = handler.getSlotLimit(i);
if (maxStackSize <= 64) {
maxStackSize = Math.min(maxStackSize, stack.getMaxStackSize());
}
ItemStack in = handler.getStackInSlot(i);
int count = in.getCount();
if (count >= maxStackSize) {
Expand Down Expand Up @@ -543,7 +546,6 @@ public static ItemStack getOredictItem(final RecipeCraftingContext context, fina
}

@Nonnull
@SuppressWarnings("unchecked")
public static List<ProcessingComponent<?>> copyItemHandlerComponents(final List<ProcessingComponent<?>> components) {
List<ProcessingComponent<?>> list = new ArrayList<>();
for (ProcessingComponent<?> component : components) {
Expand All @@ -568,7 +570,6 @@ public static List<ProcessingComponent<?>> copyItemHandlerComponents(final List<
}

@Nonnull
@SuppressWarnings("unchecked")
public static List<ProcessingComponent<?>> fastCopyItemHandlerComponents(final List<ProcessingComponent<?>> components) {
List<ProcessingComponent<?>> list = new ArrayList<>();
for (ProcessingComponent<?> component : components) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/modularmachinery/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ gui.meiteminputbus.inv_action.divide=The wheel is scrolling down to halve the nu
gui.meiteminputbus.items_marked=Items marked: %s
gui.meitembus.item_cached=Items Cached: %s
gui.meitembus.nbt_stored=Items have been stored internally.
gui.meitembus.stack_size.name=Max Stack Size
gui.meitembus.stack_size.config=Configure Max Stack Size

gui.mefluidoutputbus.title=ME Machinery Fluid Output Bus
gui.mefluidinputbus.title=ME Machinery Fluid Input Bus
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/modularmachinery/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ gui.meiteminputbus.inv_action.divide=按下 %s 组合键时,滚轮向下滚动
gui.meiteminputbus.items_marked=已标记物品:%s
gui.meitembus.item_cached=已缓存物品: %s
gui.meitembus.nbt_stored=内部已存储物品。
gui.meitembus.stack_size.name=最大堆叠数量
gui.meitembus.stack_size.config=配置最大堆叠数量

gui.mefluidoutputbus.title=ME 机械流体输出总线
gui.mefluidinputbus.title=ME 机械流体输入总线
Expand Down
Loading