|
1 | 1 | --- a/jp/ngt/rtm/gui/GuiRailMarker.java |
2 | 2 | +++ b/jp/ngt/rtm/gui/GuiRailMarker.java |
3 | | -@@ -48,18 +48,18 @@ |
| 3 | +@@ -25,10 +25,11 @@ |
| 4 | + private GuiTextFieldCustom fieldAncH; |
| 5 | + private GuiTextFieldCustom fieldAncV; |
| 6 | + private GuiTextFieldCustom fieldCantCenter; |
| 7 | + private GuiTextFieldCustom fieldCantEdge; |
| 8 | + private GuiTextFieldCustom fieldCantRandom; |
| 9 | ++ private GuiTextFieldCustom fieldHeight; |
| 10 | + private GuiButton buttonScript; |
| 11 | + private GuiTextFieldCustom fieldArgs; |
| 12 | + |
| 13 | + public GuiRailMarker(TileEntityMarker par1) { |
| 14 | + this.marker = par1; |
| 15 | +@@ -48,18 +49,19 @@ |
4 | 16 | this.buttonList.add(new GuiButton(0, this.width / 2 - 105, this.height - 28, 100, 20, I18n.format("gui.done", new Object[0]))); |
5 | 17 | this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 100, 20, I18n.format("gui.cancel", new Object[0]))); |
6 | 18 | this.buttonScript = new GuiButton(100, this.width - 140, 140, 110, 20, s); |
|
21 | 33 | + this.fieldCantCenter = this.setFloatField(this.width - 70, 20, 60, 20, String.valueOf(this.currentRP.cantCenter)); |
22 | 34 | + this.fieldCantEdge = this.setFloatField(this.width - 70, 50, 60, 20, String.valueOf(this.currentRP.cantEdge)); |
23 | 35 | + this.fieldCantRandom = this.setFloatField(this.width - 70, 80, 60, 20, String.valueOf(this.currentRP.cantRandom)); |
| 36 | ++ this.fieldHeight = this.setIntegerField(this.width - 70, 110, 60, 20, String.valueOf(this.currentRP.height)); |
24 | 37 | + this.fieldArgs = this.setFloatField(this.width - 140, 170, 130, 20, s1); |
25 | 38 | if (this.marker.getBlockType() == RTMBlock.markerSwitch) { |
26 | 39 | this.fieldAncPitch.setEnabled(false); |
27 | 40 | this.fieldAncV.setEnabled(false); |
28 | 41 | this.fieldCantCenter.setEnabled(false); |
29 | 42 | this.fieldCantEdge.setEnabled(false); |
30 | | -@@ -105,24 +105,10 @@ |
| 43 | +@@ -79,10 +81,11 @@ |
| 44 | + this.drawCenteredString(this.fontRenderer, "Anchor Length H", this.width - 110, 70, 16777215); |
| 45 | + this.drawCenteredString(this.fontRenderer, "Anchor Length V", this.width - 110, 100, 16777215); |
| 46 | + this.drawCenteredString(this.fontRenderer, "Cant Center", this.width - 40, 10, 16777215); |
| 47 | + this.drawCenteredString(this.fontRenderer, "Cant Edge", this.width - 40, 40, 16777215); |
| 48 | + this.drawCenteredString(this.fontRenderer, "Cant Random", this.width - 40, 70, 16777215); |
| 49 | ++ this.drawCenteredString(this.fontRenderer, "Height", this.width - 40, 100, 0xFFFFFF); |
| 50 | + this.drawCenteredString(this.fontRenderer, "Line Script", this.width - 75, 130, 16777215); |
| 51 | + this.drawCenteredString(this.fontRenderer, "Line Script Args", this.width - 75, 160, 16777215); |
| 52 | + } |
| 53 | + |
| 54 | + private void renderLineAndAnchor() { |
| 55 | +@@ -105,32 +108,19 @@ |
31 | 56 | } |
32 | 57 |
|
33 | 58 | super.actionPerformed(button); |
|
52 | 77 | this.currentRP.anchorPitch = this.getFieldValue(this.fieldAncPitch, this.currentRP.anchorPitch); |
53 | 78 | this.currentRP.anchorLengthHorizontal = this.getFieldValue(this.fieldAncH, this.currentRP.anchorLengthHorizontal); |
54 | 79 | this.currentRP.anchorLengthVertical = this.getFieldValue(this.fieldAncV, this.currentRP.anchorLengthVertical); |
| 80 | + this.currentRP.cantCenter = this.getFieldValue(this.fieldCantCenter, this.currentRP.cantCenter); |
| 81 | + this.currentRP.cantEdge = this.getFieldValue(this.fieldCantEdge, this.currentRP.cantEdge); |
| 82 | + this.currentRP.cantRandom = this.getFieldValue(this.fieldCantRandom, this.currentRP.cantRandom); |
| 83 | ++ currentRP.setHeight(getHeight()); |
| 84 | + this.currentRP.scriptName = this.buttonScript.displayString; |
| 85 | + this.currentRP.scriptArgs = this.fieldArgs.getText(); |
| 86 | + } |
| 87 | + |
| 88 | + private float getFieldValue(GuiTextFieldCustom field, float defaultVal) { |
| 89 | +@@ -139,10 +129,19 @@ |
| 90 | + } catch (NumberFormatException numberformatexception) { |
| 91 | + return defaultVal; |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | ++ private byte getHeight() { |
| 96 | ++ try { |
| 97 | ++ byte value = Byte.parseByte(fieldHeight.getText()); |
| 98 | ++ return kotlin.ranges.RangesKt.coerceIn(value, (byte) 0, (byte) 15); |
| 99 | ++ } catch (NumberFormatException exception) { |
| 100 | ++ return currentRP.height; |
| 101 | ++ } |
| 102 | ++ } |
| 103 | ++ |
| 104 | + private void sendPacket() { |
| 105 | + this.updateValues(); |
| 106 | + RTMCore.NETWORK_WRAPPER.sendToServer(new PacketMarkerRPClient(this.marker)); |
| 107 | + } |
| 108 | + } |
0 commit comments