From 4c4b8ddff634b32a4d8836f8811c3a9c9c87972b Mon Sep 17 00:00:00 2001 From: Awesome2K Date: Wed, 25 Nov 2015 12:12:21 +0200 Subject: [PATCH 1/5] Changed mode for gradlew --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 1bb32ca361797349fae0484fc445fdac1278a1c4 Mon Sep 17 00:00:00 2001 From: Awesome2K Date: Wed, 25 Nov 2015 12:27:43 +0200 Subject: [PATCH 2/5] Added support for 32-bit numbers --- .../client/gui/Gui7Segment.java | 4 + .../integratedcircuits/gate/Gate7Segment.java | 96 ++++++++++++++++--- .../assets/integratedcircuits/lang/en_US.lang | 4 + .../assets/integratedcircuits/lang/ru_RU.lang | 8 +- 4 files changed, 98 insertions(+), 14 deletions(-) diff --git a/src/main/java/moe/nightfall/vic/integratedcircuits/client/gui/Gui7Segment.java b/src/main/java/moe/nightfall/vic/integratedcircuits/client/gui/Gui7Segment.java index 6d6f5d1..6879c92 100644 --- a/src/main/java/moe/nightfall/vic/integratedcircuits/client/gui/Gui7Segment.java +++ b/src/main/java/moe/nightfall/vic/integratedcircuits/client/gui/Gui7Segment.java @@ -59,6 +59,8 @@ public void initGui() { I18n.format("gui.integratedcircuits.7segment.mode.analog"), I18n.format("gui.integratedcircuits.7segment.mode.short.signed"), I18n.format("gui.integratedcircuits.7segment.mode.short.unsigned"), + I18n.format("gui.integratedcircuits.7segment.mode.int.signed"), + I18n.format("gui.integratedcircuits.7segment.mode.int.unsigned"), I18n.format("gui.integratedcircuits.7segment.mode.float"), I18n.format("gui.integratedcircuits.7segment.mode.binary"), I18n.format("gui.integratedcircuits.7segment.mode.manual")), this).setTooltips(Arrays.asList( @@ -66,6 +68,8 @@ public void initGui() { I18n.format("gui.integratedcircuits.7segment.mode.analog.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.short.signed.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.short.unsigned.tooltip"), + I18n.format("gui.integratedcircuits.7segment.mode.int.signed.tooltip"), + I18n.format("gui.integratedcircuits.7segment.mode.int.unsigned.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.float.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.binary.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.manual.tooltip"))))); diff --git a/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java b/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java index 0493467..bd79c77 100644 --- a/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java +++ b/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java @@ -70,9 +70,11 @@ public class Gate7Segment extends Gate { public static final int MODE_ANALOG = 1; public static final int MODE_SHORT_SIGNED = 2; public static final int MODE_SHORT_UNSIGNED = 3; - public static final int MODE_FLOAT = 4; - public static final int MODE_BINARY_STRING = 5; - public static final int MODE_MANUAL = 6; + public static final int MODE_INT_SIGNED = 4; + public static final int MODE_INT_UNSIGNED = 5; + public static final int MODE_FLOAT = 6; + public static final int MODE_BINARY_STRING = 7; + public static final int MODE_MANUAL = 8; @Override public void preparePlacement(EntityPlayer player, ItemStack stack) { @@ -195,9 +197,7 @@ public Gate7Segment getSegment(BlockCoord crd) { return null; } - private void updateSlaves() { - if (provider.getWorld().isRemote) - return; + private void updateSlavesDefault() { int input = 0; @@ -213,7 +213,7 @@ private void updateSlaves() { if (slaves.size() < 4 || mode == MODE_ANALOG) { writeDigits(null); - writeDigit(NUMBERS[input]); + writeDigit(NUMBERS[(int) input]); } else { byte[] digits = input == 0 ? FALSE : TRUE; writeDigits(digits); @@ -221,12 +221,15 @@ private void updateSlaves() { } else { boolean sign = false; int length = 16; - + byte[][] provIn = provider.getInput(); + System.out.println(provIn.length + " " + provIn[0].length); for (byte[] in : provider.getInput()) { + int i2 = 0; for (int i = 0; i < 16; i++) i2 |= (in[i] != 0 ? 1 : 0) << i; input |= i2; + } boolean outOfBounds = false; @@ -240,10 +243,10 @@ private void updateSlaves() { if (mode == MODE_MANUAL) { writeDigits(null); - writeDigit(input & 255); + writeDigit((int) (input & 255)); return; } else if (mode == MODE_FLOAT) { - float conv = MiscUtils.toBinary16Float(input); + float conv = MiscUtils.toBinary16Float((int) input); if (Float.isNaN(conv) || Float.isInfinite(conv)) { byte[] digits = null; if (Float.isNaN(conv) && slaves.size() > 1) @@ -276,10 +279,9 @@ else if (slaves.size() > 2) decimalDot = dispString.length() - decimalDot; } } else if (mode == MODE_BINARY_STRING) - dispString = Integer.toBinaryString(input); + dispString = Integer.toBinaryString((int) input); else dispString = String.valueOf(input); - int size = dispString.length() - 1; if (size > slaves.size() - (isSigned() ? 1 : 0)) outOfBounds = true; @@ -302,6 +304,76 @@ else if (slaves.size() > 2) } } + private void updateSlavesSplit() { + boolean sign = false; + byte[][] provIn = provider.getInput(); + + String bin = ""; + String pt0 = ""; + String pt1 = ""; + + for (int i = 0; i < 16; i++) { + int b = (provIn[2][i] != 0 ? 1 : 0); + pt0 += b; + } + pt0 = StringUtils.reverse(pt0); + for (int i = 0; i < 16; i++) { + int b = (provIn[3][i] != 0 ? 1 : 0); + pt1 += b; + } + pt1 = StringUtils.reverse(pt1); + bin = pt0 + pt1; + + long input = Long.parseLong(bin, 2); + + boolean outOfBounds = false; + int decimalDot = -1; + String dispString = ""; + + if (isSigned()) { + sign = (input & (1 << 31)) != 0; + input &= 0x7FFFFFFF; + } + + if (input < 0) + dispString = "0"; + else { + dispString = Long.toString(input); + } + + int size = dispString.length() - 1; + if (size > slaves.size() - (isSigned() ? 1 : 0)) + outOfBounds = true; + + dispString = StringUtils.reverse(dispString); + for (int i = 0; i <= slaves.size(); i++) { + int decimal = i < dispString.length() ? Integer.valueOf(String.valueOf(dispString.charAt(i))) : 0; + Gate7Segment slave = this; + if (i > 0) { + BlockCoord bc = slaves.get(i - 1); + slave = getSegment(bc); + } + if (slave != null) { + if (i == slaves.size() && isSigned()) + slave.writeDigit(sign ? SIGN : 0); + else + slave.writeDigit(outOfBounds ? SIGN : NUMBERS[decimal] | (decimalDot == i ? DOT : 0)); + } + } + + } + + private void updateSlaves() { + if (provider.getWorld().isRemote) + return; + + if (mode != MODE_INT_SIGNED && mode != MODE_INT_UNSIGNED) { + updateSlavesDefault(); + } else { + updateSlavesSplit(); + } + } + private void writeDigits(byte[] digits) { for (int i = 0; i <= slaves.size(); i++) { Gate7Segment slave = this; diff --git a/src/main/resources/assets/integratedcircuits/lang/en_US.lang b/src/main/resources/assets/integratedcircuits/lang/en_US.lang index 09d7da2..8b81b93 100644 --- a/src/main/resources/assets/integratedcircuits/lang/en_US.lang +++ b/src/main/resources/assets/integratedcircuits/lang/en_US.lang @@ -125,6 +125,8 @@ gui.integratedcircuits.7segment.mode.simple=Simple gui.integratedcircuits.7segment.mode.analog=Analog gui.integratedcircuits.7segment.mode.short.signed=Signed Short gui.integratedcircuits.7segment.mode.short.unsigned=Unsigned Short +gui.integratedcircuits.7segment.mode.int.signed=Signed Int +gui.integratedcircuits.7segment.mode.int.unsigned=Unsigned Int gui.integratedcircuits.7segment.mode.float=Signed Float gui.integratedcircuits.7segment.mode.binary=Binary String gui.integratedcircuits.7segment.mode.manual=Manual @@ -133,6 +135,8 @@ gui.integratedcircuits.7segment.mode.simple.tooltip=A digital redstone signal:%n gui.integratedcircuits.7segment.mode.analog.tooltip=An analog redstone signal:%n§8§oFrom 0 to F. gui.integratedcircuits.7segment.mode.short.signed.tooltip=Parses a bundled signal as%nsigned 16 bit short:%n§8§oFrom -32768 to 32768. gui.integratedcircuits.7segment.mode.short.unsigned.tooltip=Parses a bundled signal as%nunsigned 16 bit short:%n§8§oFrom 0 to 65535. +gui.integratedcircuits.7segment.mode.int.signed.tooltip=Parses a bundled signal as%nsigned 32 bit int:%n§8§oFrom -2147483647 to 2147483647. +gui.integratedcircuits.7segment.mode.int.unsigned.tooltip=Parses a bundled signal as%nunsigned 32 bit int:%n§8§oFrom 0 to 4294967295. gui.integratedcircuits.7segment.mode.float.tooltip=Parses a bundled signal as%n16 bit floating-point (binary16):%n§8§oFrom -122880 to 122880. gui.integratedcircuits.7segment.mode.binary.tooltip=Outputs a bundled signal%nby its binary digits. gui.integratedcircuits.7segment.mode.manual.tooltip=Allows to modify the individual%nsegments with a bundled signal. diff --git a/src/main/resources/assets/integratedcircuits/lang/ru_RU.lang b/src/main/resources/assets/integratedcircuits/lang/ru_RU.lang index 125878a..291509b 100644 --- a/src/main/resources/assets/integratedcircuits/lang/ru_RU.lang +++ b/src/main/resources/assets/integratedcircuits/lang/ru_RU.lang @@ -102,8 +102,10 @@ gui.integratedcircuits.7segment.mode=Режим: gui.integratedcircuits.7segment.mode.simple=Простой gui.integratedcircuits.7segment.mode.analog=Аналоговый -gui.integratedcircuits.7segment.mode.short.signed=Знаковое целое -gui.integratedcircuits.7segment.mode.short.unsigned=Беззнаковое целое +gui.integratedcircuits.7segment.mode.short.signed=Знаковое короткое целое +gui.integratedcircuits.7segment.mode.short.unsigned=Беззнаковое короткое целое +gui.integratedcircuits.7segment.mode.int.signed=Знаковое целое +gui.integratedcircuits.7segment.mode.int.unsigned=Беззнаковое целое gui.integratedcircuits.7segment.mode.float=С плавающей точкой gui.integratedcircuits.7segment.mode.binary=Двоичный gui.integratedcircuits.7segment.mode.manual=Ручной @@ -112,6 +114,8 @@ gui.integratedcircuits.7segment.mode.simple.tooltip=Цифровой сигна gui.integratedcircuits.7segment.mode.analog.tooltip=Аналоговый сигнал красного камня:%n§8§oОт 0 до F. gui.integratedcircuits.7segment.mode.short.signed.tooltip=Выводит сигнал с кабеля как%nзнаковое 16-битное целое:%n§8§oОт -32768 до 32767. gui.integratedcircuits.7segment.mode.short.unsigned.tooltip=Выводит сигнал с кабеля как%nбеззнаковое 16-битное целое:%n§8§oОт 0 до 65535. +gui.integratedcircuits.7segment.mode.short.signed.tooltip=Выводит сигнал с кабеля как%nзнаковое 32-битное целое:%n§8§oОт -2147483647 до 2147483647. +gui.integratedcircuits.7segment.mode.short.unsigned.tooltip=Выводит сигнал с кабеля как%nбеззнаковое 32-битное целое:%n§8§oОт 0 до 4294967295. gui.integratedcircuits.7segment.mode.float.tooltip=Выводит сигнал с кабеля как%n16-битное число с плавающей запятой:%n§8§oОт 0,000061 до 65504,%n§8§oпри точности 3,3 десятичных цифры. gui.integratedcircuits.7segment.mode.binary.tooltip=Выводит сигнал с кабеля побитово. gui.integratedcircuits.7segment.mode.manual.tooltip=Каждый сегмент управляется%nсвоим сигналом с кабеля. From a7ab2a42f3a1e193787fa32d01897ef95c12f001 Mon Sep 17 00:00:00 2001 From: Awesome2K Date: Wed, 25 Nov 2015 15:28:43 +0200 Subject: [PATCH 3/5] Fixed Gate7Segment rendering, removed debug output --- .../integratedcircuits/gate/Gate7Segment.java | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java b/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java index bd79c77..0211ab2 100644 --- a/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java +++ b/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java @@ -20,6 +20,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.EnumConnectionState; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.util.Constants.NBT; @@ -34,13 +35,14 @@ import com.google.common.collect.Lists; public class Gate7Segment extends Gate { - + private final Cuboid6 dimensions = new Cuboid6(2, 0, 1, 14, 3, 15); - + public int digit = NUMBERS[0]; public int color; public boolean isSlave; public boolean hasSlaves; + public boolean hasThreeBuses = true; public int mode = MODE_SIMPLE; public BlockCoord parent; @@ -48,12 +50,12 @@ public class Gate7Segment extends Gate { // TODO Relative positions, will break upon moving like this public ArrayList slaves = Lists.newArrayList(); - // 0 - // -- + // 0 + // -- // 5|6 |1 - // -- + // -- // 4|3 |2 - // -- # 7 + // -- # 7 public static final byte[] NUMBERS = { 63, 6, 91, 79, 102, 109, 125, 7, 127, 111, 119, 124, 57, 94, 121, 113 }; // 0-F // In reverse order @@ -213,7 +215,7 @@ private void updateSlavesDefault() { if (slaves.size() < 4 || mode == MODE_ANALOG) { writeDigits(null); - writeDigit(NUMBERS[(int) input]); + writeDigit(NUMBERS[input]); } else { byte[] digits = input == 0 ? FALSE : TRUE; writeDigits(digits); @@ -221,8 +223,7 @@ private void updateSlavesDefault() { } else { boolean sign = false; int length = 16; - byte[][] provIn = provider.getInput(); - System.out.println(provIn.length + " " + provIn[0].length); + for (byte[] in : provider.getInput()) { int i2 = 0; @@ -243,10 +244,10 @@ private void updateSlavesDefault() { if (mode == MODE_MANUAL) { writeDigits(null); - writeDigit((int) (input & 255)); + writeDigit((input & 255)); return; } else if (mode == MODE_FLOAT) { - float conv = MiscUtils.toBinary16Float((int) input); + float conv = MiscUtils.toBinary16Float(input); if (Float.isNaN(conv) || Float.isInfinite(conv)) { byte[] digits = null; if (Float.isNaN(conv) && slaves.size() > 1) @@ -279,7 +280,7 @@ else if (slaves.size() > 2) decimalDot = dispString.length() - decimalDot; } } else if (mode == MODE_BINARY_STRING) - dispString = Integer.toBinaryString((int) input); + dispString = Integer.toBinaryString(input); else dispString = String.valueOf(input); int size = dispString.length() - 1; @@ -307,24 +308,19 @@ else if (slaves.size() > 2) private void updateSlavesSplit() { boolean sign = false; byte[][] provIn = provider.getInput(); + + StringBuilder sb = new StringBuilder(); - String bin = ""; - String pt0 = ""; - String pt1 = ""; - - for (int i = 0; i < 16; i++) { - int b = (provIn[2][i] != 0 ? 1 : 0); - pt0 += b; + for (int i = 15; i >= 0; i--) { + char b = (provIn[2][i] != 0 ? '1' : '0'); + sb.append(b); } - pt0 = StringUtils.reverse(pt0); - for (int i = 0; i < 16; i++) { - int b = (provIn[3][i] != 0 ? 1 : 0); - pt1 += b; + for (int i = 15; i >= 0; i--) { + char b = (provIn[3][i] != 0 ? '1' : '0'); + sb.append(b); } - pt1 = StringUtils.reverse(pt1); - bin = pt0 + pt1; - long input = Long.parseLong(bin, 2); + long input = Long.parseLong(sb.toString(), 2); boolean outOfBounds = false; int decimalDot = -1; @@ -368,8 +364,10 @@ private void updateSlaves() { return; if (mode != MODE_INT_SIGNED && mode != MODE_INT_UNSIGNED) { + hasThreeBuses = true; updateSlavesDefault(); } else { + hasThreeBuses = false; updateSlavesSplit(); } } @@ -395,7 +393,7 @@ private void writeDigit(int digit) { } private boolean isSigned() { - return mode == MODE_SHORT_SIGNED || mode == MODE_FLOAT; + return mode == MODE_SHORT_SIGNED || mode == MODE_FLOAT || mode == MODE_INT_SIGNED; } private void sendChangesToClient() { @@ -482,9 +480,17 @@ public ItemStack getItemStack() { return new ItemStack(Content.item7Segment, 1, color); } + public EnumConnectionType getSplitConnectionTypeAtSide(int side) { + return side == 2 || side == 3 ? EnumConnectionType.BUNDLED : EnumConnectionType.NONE; + } + @Override public EnumConnectionType getConnectionTypeAtSide(int side) { - return isSlave || (hasSlaves && side == 1) ? EnumConnectionType.NONE : mode == MODE_SIMPLE ? EnumConnectionType.SIMPLE : mode == MODE_ANALOG ? EnumConnectionType.ANALOG : EnumConnectionType.BUNDLED; + if (mode == MODE_INT_SIGNED || mode == MODE_INT_UNSIGNED) + return getSplitConnectionTypeAtSide(side); + return isSlave || (hasSlaves && side == 1) ? EnumConnectionType.NONE + : mode == MODE_SIMPLE ? EnumConnectionType.SIMPLE + : mode == MODE_ANALOG ? EnumConnectionType.ANALOG : EnumConnectionType.BUNDLED; } @Override From 5760115cc180faf5ac58f2abdcf9aa9bbcacc825 Mon Sep 17 00:00:00 2001 From: Awesome2K Date: Wed, 6 Jan 2016 14:47:27 +0200 Subject: [PATCH 4/5] Added tooltip for 32-bit integers --- src/main/resources/assets/integratedcircuits/lang/en_US.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/integratedcircuits/lang/en_US.lang b/src/main/resources/assets/integratedcircuits/lang/en_US.lang index 8b81b93..c820c6d 100644 --- a/src/main/resources/assets/integratedcircuits/lang/en_US.lang +++ b/src/main/resources/assets/integratedcircuits/lang/en_US.lang @@ -135,8 +135,8 @@ gui.integratedcircuits.7segment.mode.simple.tooltip=A digital redstone signal:%n gui.integratedcircuits.7segment.mode.analog.tooltip=An analog redstone signal:%n§8§oFrom 0 to F. gui.integratedcircuits.7segment.mode.short.signed.tooltip=Parses a bundled signal as%nsigned 16 bit short:%n§8§oFrom -32768 to 32768. gui.integratedcircuits.7segment.mode.short.unsigned.tooltip=Parses a bundled signal as%nunsigned 16 bit short:%n§8§oFrom 0 to 65535. -gui.integratedcircuits.7segment.mode.int.signed.tooltip=Parses a bundled signal as%nsigned 32 bit int:%n§8§oFrom -2147483647 to 2147483647. -gui.integratedcircuits.7segment.mode.int.unsigned.tooltip=Parses a bundled signal as%nunsigned 32 bit int:%n§8§oFrom 0 to 4294967295. +gui.integratedcircuits.7segment.mode.int.signed.tooltip=Parses a bundled signal as%nsigned 32 bit int:%n§8§oFrom -2147483647 to 2147483647%n§8§oTop - upper 16 bits, Right - lower 16 bits. +gui.integratedcircuits.7segment.mode.int.unsigned.tooltip=Parses a bundled signal as%nunsigned 32 bit int:%n§8§oFrom 0 to 4294967295%n§8§oTop - upper 16 bits, Right - lower 16 bits. gui.integratedcircuits.7segment.mode.float.tooltip=Parses a bundled signal as%n16 bit floating-point (binary16):%n§8§oFrom -122880 to 122880. gui.integratedcircuits.7segment.mode.binary.tooltip=Outputs a bundled signal%nby its binary digits. gui.integratedcircuits.7segment.mode.manual.tooltip=Allows to modify the individual%nsegments with a bundled signal. From ec1a12cace3c68c87d28abde338fb2658a4a266b Mon Sep 17 00:00:00 2001 From: Awesome2K Date: Wed, 20 Jan 2016 19:04:56 +0200 Subject: [PATCH 5/5] Fixed issues mentioned by Vic --- gradle.properties | 2 +- .../client/gui/Gui7Segment.java | 44 +++++++++---------- .../integratedcircuits/gate/Gate7Segment.java | 13 +++--- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/gradle.properties b/gradle.properties index b20bb07..bc0d718 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,6 +11,6 @@ qmlVersion = 0.1.99 ocVersion = 1.5.13+ wailaVersion = 1.5.9 bluepowerVersion = 0.2.948 -projectredVersion = 4.7.0pre9.92 +projectredVersion = 4.7.0pre10.93 buildcraftVersion = 7.1.+ redlogicVersion = 59.1.7 diff --git a/src/main/java/moe/nightfall/vic/integratedcircuits/client/gui/Gui7Segment.java b/src/main/java/moe/nightfall/vic/integratedcircuits/client/gui/Gui7Segment.java index 6879c92..05fa270 100644 --- a/src/main/java/moe/nightfall/vic/integratedcircuits/client/gui/Gui7Segment.java +++ b/src/main/java/moe/nightfall/vic/integratedcircuits/client/gui/Gui7Segment.java @@ -1,22 +1,18 @@ package moe.nightfall.vic.integratedcircuits.client.gui; -import java.util.Arrays; - -import moe.nightfall.vic.integratedcircuits.client.Gate7SegmentRenderer; -import moe.nightfall.vic.integratedcircuits.client.Resources; -import moe.nightfall.vic.integratedcircuits.client.gui.GuiInterfaces.IHoverable; -import moe.nightfall.vic.integratedcircuits.client.gui.GuiInterfaces.IHoverableHandler; -import moe.nightfall.vic.integratedcircuits.client.gui.component.GuiCheckBoxExt; -import moe.nightfall.vic.integratedcircuits.client.gui.component.GuiDropdown; -import moe.nightfall.vic.integratedcircuits.gate.Gate7Segment; -import moe.nightfall.vic.integratedcircuits.net.Packet7SegmentChangeMode; -import moe.nightfall.vic.integratedcircuits.proxy.CommonProxy; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.resources.I18n; - -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; +import java.util.*; + +import org.lwjgl.input.*; +import org.lwjgl.opengl.*; + +import moe.nightfall.vic.integratedcircuits.client.*; +import moe.nightfall.vic.integratedcircuits.client.gui.GuiInterfaces.*; +import moe.nightfall.vic.integratedcircuits.client.gui.component.*; +import moe.nightfall.vic.integratedcircuits.gate.*; +import moe.nightfall.vic.integratedcircuits.net.*; +import moe.nightfall.vic.integratedcircuits.proxy.*; +import net.minecraft.client.gui.*; +import net.minecraft.client.resources.*; public class Gui7Segment extends GuiScreen implements IHoverableHandler { private Gate7Segment part; @@ -59,20 +55,20 @@ public void initGui() { I18n.format("gui.integratedcircuits.7segment.mode.analog"), I18n.format("gui.integratedcircuits.7segment.mode.short.signed"), I18n.format("gui.integratedcircuits.7segment.mode.short.unsigned"), - I18n.format("gui.integratedcircuits.7segment.mode.int.signed"), - I18n.format("gui.integratedcircuits.7segment.mode.int.unsigned"), I18n.format("gui.integratedcircuits.7segment.mode.float"), I18n.format("gui.integratedcircuits.7segment.mode.binary"), - I18n.format("gui.integratedcircuits.7segment.mode.manual")), this).setTooltips(Arrays.asList( + I18n.format("gui.integratedcircuits.7segment.mode.manual"), + I18n.format("gui.integratedcircuits.7segment.mode.int.signed"), + I18n.format("gui.integratedcircuits.7segment.mode.int.unsigned")), this).setTooltips(Arrays.asList( I18n.format("gui.integratedcircuits.7segment.mode.simple.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.analog.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.short.signed.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.short.unsigned.tooltip"), - I18n.format("gui.integratedcircuits.7segment.mode.int.signed.tooltip"), - I18n.format("gui.integratedcircuits.7segment.mode.int.unsigned.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.float.tooltip"), I18n.format("gui.integratedcircuits.7segment.mode.binary.tooltip"), - I18n.format("gui.integratedcircuits.7segment.mode.manual.tooltip"))))); + I18n.format("gui.integratedcircuits.7segment.mode.manual.tooltip"), + I18n.format("gui.integratedcircuits.7segment.mode.int.signed.tooltip"), + I18n.format("gui.integratedcircuits.7segment.mode.int.unsigned.tooltip"))))); refreshUI(); } @@ -154,4 +150,4 @@ protected void keyTyped(char ch, int keycode) { public void setCurrentItem(IHoverable hoverable) { this.hoverable = hoverable; } -} +} \ No newline at end of file diff --git a/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java b/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java index 0211ab2..1efb515 100644 --- a/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java +++ b/src/main/java/moe/nightfall/vic/integratedcircuits/gate/Gate7Segment.java @@ -72,11 +72,11 @@ public class Gate7Segment extends Gate { public static final int MODE_ANALOG = 1; public static final int MODE_SHORT_SIGNED = 2; public static final int MODE_SHORT_UNSIGNED = 3; - public static final int MODE_INT_SIGNED = 4; - public static final int MODE_INT_UNSIGNED = 5; - public static final int MODE_FLOAT = 6; - public static final int MODE_BINARY_STRING = 7; - public static final int MODE_MANUAL = 8; + public static final int MODE_FLOAT = 4; + public static final int MODE_BINARY_STRING = 5; + public static final int MODE_MANUAL = 6; + public static final int MODE_INT_SIGNED = 7; + public static final int MODE_INT_UNSIGNED = 8; @Override public void preparePlacement(EntityPlayer player, ItemStack stack) { @@ -98,6 +98,7 @@ public void onAdded() { return; isSlave = false; + int abs = Rotation.rotateSide(provider.getSide(), provider.getRotationAbs(3)); BlockCoord pos = provider.getPos(); BlockCoord pos2 = pos.copy(); @@ -481,7 +482,7 @@ public ItemStack getItemStack() { } public EnumConnectionType getSplitConnectionTypeAtSide(int side) { - return side == 2 || side == 3 ? EnumConnectionType.BUNDLED : EnumConnectionType.NONE; + return (side == 2 || side == 3) ? EnumConnectionType.BUNDLED : EnumConnectionType.NONE; } @Override