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 @@ -215,7 +215,7 @@ public void toggleSwitchButtons() {
public void readData(NBTTagCompound tag) {
this.reStock = tag.getBoolean(restockItems);
this.magnetMode = WirelessMagnet.Mode.values()[tag.getInteger(modeKey)];
this.terminalMode = UltraTerminalModes.values()[tag.getInteger(MODE)];
this.terminalMode = UltraTerminalModes.VALUES[tag.getInteger(MODE)];
}

@Override
Expand All @@ -229,7 +229,7 @@ public void writeData(NBTTagCompound tag) {
public void readByte(ByteBuf buf) {
this.reStock = buf.readBoolean();
this.magnetMode = WirelessMagnet.Mode.values()[buf.readInt()];
this.terminalMode = UltraTerminalModes.values()[buf.readInt()];
this.terminalMode = UltraTerminalModes.VALUES[buf.readInt()];
ItemWirelessUltraTerminal.setMode(this.terminal, this.terminalMode);

toggleMagnetButtonsVisibility();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static UltraTerminalModes getMode(ItemStack is) {
Item item = is.getItem();
if (item instanceof ItemWirelessUltraTerminal) {
if (!is.hasTagCompound()) is.setTagCompound(new NBTTagCompound());
return UltraTerminalModes.values()[is.getTagCompound().getInteger(MODE)];
return UltraTerminalModes.VALUES[is.getTagCompound().getInteger(MODE)];
} else if (item instanceof ItemWirelessPatternTerminal) {
return UltraTerminalModes.PATTERN;
} else if (item instanceof ItemWirelessInterfaceTerminal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int slot,
public IGuiItemObject getGuiObject(ItemStack is, World world, EntityPlayer p, int x, int y, int z) {
final IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler(is);
if (wh == null) return null;
return switch (y != Integer.MIN_VALUE ? UltraTerminalModes.values()[y] : getMode(is)) {
return switch (y != Integer.MIN_VALUE ? UltraTerminalModes.VALUES[y] : getMode(is)) {
case CRAFTING -> new WirelessCraftingTerminalGuiObject(wh, is, p, world, x, y, z);
case PATTERN, PATTERN_EX -> new WirelessPatternTerminalGuiObject(wh, is, p, world, x, y, z);
case INTERFACE -> new WirelessInterfaceTerminalGuiObject(wh, is, x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public enum Mode {

Off,
Inv,
ME
ME;

public static final Mode[] VALUES = values();
}

public enum ListMode {
Expand Down Expand Up @@ -138,7 +140,7 @@ public static Mode getMode(ItemStack is) {
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
NBTTagCompound data = Platform.openNbtData(is);
if (data.hasKey(modeKey)) {
return Mode.values()[data.getInteger(modeKey)];
return Mode.VALUES[data.getInteger(modeKey)];
}
setMode(is, Mode.Off);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public CPacketSwitchGuis() {
@Override
public void fromBytes(ByteBuf byteBuf) {
final int ord = byteBuf.readInt();
mode = ord != -1 ? UltraTerminalModes.values()[ord] : null;
mode = ord != -1 ? UltraTerminalModes.VALUES[ord] : null;
switchTerminal = byteBuf.readBoolean();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.glodblock.github.util;

public enum UltraTerminalModes {

CRAFTING,
PATTERN,
PATTERN_EX,
INTERFACE,
LEVEL
LEVEL;

public static final UltraTerminalModes[] VALUES = values();
}