Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 314c070

Browse files
committedDec 19, 2015
Converted everything to use shorts like it should.
1 parent e809a5b commit 314c070

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed
 

Diff for: ‎build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ gregtech.version=5.07.07
1313
ic2.version=2.2.643-experimental
1414
oc.version=MC1.7.10-1.5.18.36
1515
qmunitylib.version=0.1.109
16-
tis3d.version=MC1.7.10-0.2.0.25
16+
tis3d.version=MC1.7.10-0.4.0.28
1717
waila.version=1.5.10_1.7.10

Diff for: ‎src/main/java/pl/asie/computronics/integration/tis3d/module/ModuleColorful.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
public class ModuleColorful extends ComputronicsModule {
1919

20-
private int color = 0x6318;
20+
private short color = 0x6318;
2121

2222
public ModuleColorful(Casing casing, Face face) {
2323
super(casing, face);
@@ -32,7 +32,7 @@ public void step() {
3232
receivingPipe.beginRead();
3333
}
3434
if(receivingPipe.canTransfer()) {
35-
this.color = receivingPipe.read() & 0x7FFF;
35+
this.color = (short) (receivingPipe.read() & 0x7FFF);
3636
this.cancelWrite();
3737
receivingPipe.beginRead();
3838
sendData();
@@ -50,13 +50,13 @@ public void onDisabled() {
5050
@Override
5151
public void readFromNBT(NBTTagCompound nbt) {
5252
super.readFromNBT(nbt);
53-
this.color = nbt.getInteger("c");
53+
this.color = nbt.getShort("c");
5454
}
5555

5656
@Override
5757
public void writeToNBT(NBTTagCompound nbt) {
5858
super.writeToNBT(nbt);
59-
nbt.setInteger("c", this.color);
59+
nbt.setShort("c", this.color);
6060
}
6161

6262
private static final ResourceLocation LAMP_ICON = new ResourceLocation("computronics:textures/blocks/lamp_layer_0.png");

Diff for: ‎src/main/java/pl/asie/computronics/integration/tis3d/module/ModuleTapeReader.java

+29-29
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected void process(TileTapeDrive tile) {
119119
}
120120
}
121121

122-
protected abstract int getValue(TileTapeDrive tile);
122+
protected abstract short getValue(TileTapeDrive tile);
123123

124124
}
125125

@@ -157,73 +157,73 @@ protected void process(TileTapeDrive tile) {
157157
}
158158
}
159159

160-
protected abstract void setValue(TileTapeDrive tile, int val);
160+
protected abstract void setValue(TileTapeDrive tile, short val);
161161
}
162162

163163
private final Command[] COMMANDS = new Command[] {
164164
new ImmediateReturnCommand("isEnd") { // isEnd
165165
@Override
166-
protected int getValue(TileTapeDrive tile) {
167-
return tile.isEnd() ? 1 : 0;
166+
protected short getValue(TileTapeDrive tile) {
167+
return (short) (tile.isEnd() ? 1 : 0);
168168
}
169169
},
170170
new ImmediateReturnCommand("isReady") { // isReady
171171
@Override
172-
protected int getValue(TileTapeDrive tile) {
173-
return tile.isReady() ? 1 : 0;
172+
protected short getValue(TileTapeDrive tile) {
173+
return (short) (tile.isReady() ? 1 : 0);
174174
}
175175
},
176176
new ImmediateReturnCommand("getState") { // getState
177177
@Override
178-
protected int getValue(TileTapeDrive tile) {
179-
return tile.getEnumState().ordinal();
178+
protected short getValue(TileTapeDrive tile) {
179+
return (short) tile.getEnumState().ordinal();
180180
}
181181
},
182182
new ImmediateReturnCommand("getSize") { // getSize relative to the last multiple of 1024
183183
@Override
184-
protected int getValue(TileTapeDrive tile) {
185-
return tile.getSize() % 1024;
184+
protected short getValue(TileTapeDrive tile) {
185+
return (short) (tile.getSize() % 1024);
186186
}
187187
},
188188
new ImmediateReturnCommand("getSize1024") { // getSize /1024 (in Kibibytes)
189189
@Override
190-
protected int getValue(TileTapeDrive tile) {
191-
return tile.getSize() / 1024;
190+
protected short getValue(TileTapeDrive tile) {
191+
return (short) (tile.getSize() / 1024);
192192
}
193193
},
194194
new SetterCommand("setSpeed") { // setSpeed, in percent, between 25 and 200
195195
@Override
196-
protected void setValue(TileTapeDrive tile, int val) {
196+
protected void setValue(TileTapeDrive tile, short val) {
197197
tile.setSpeed((float) val / 100F);
198198
}
199199
},
200200
new SetterCommand("setVolume") { // setVolume in percent, between 0 and 100
201201
@Override
202-
protected void setValue(TileTapeDrive tile, int val) {
202+
protected void setValue(TileTapeDrive tile, short val) {
203203
tile.setVolume((float) val / 100F);
204204
}
205205
},
206206
new SetterCommand("seek") { // seek
207207
@Override
208-
protected void setValue(TileTapeDrive tile, int val) {
208+
protected void setValue(TileTapeDrive tile, short val) {
209209
tile.seek(val);
210210
}
211211
},
212212
new SetterCommand("seek1024") { // seek * 1024
213213
@Override
214-
protected void setValue(TileTapeDrive tile, int val) {
214+
protected void setValue(TileTapeDrive tile, short val) {
215215
tile.seek(val * 1024);
216216
}
217217
},
218218
new ImmediateReturnCommand("read") { // read a single byte
219219
@Override
220-
protected int getValue(TileTapeDrive tile) {
221-
return tile.read();
220+
protected short getValue(TileTapeDrive tile) {
221+
return (short) tile.read();
222222
}
223223
},
224224
new Command("readMultiple") { // read a set number of bytes
225225

226-
private int byteQueue = 0;
226+
private short byteQueue = 0;
227227

228228
@Override
229229
protected void process(TileTapeDrive tile) {
@@ -250,7 +250,7 @@ protected void process(TileTapeDrive tile) {
250250
for(Port p : Port.VALUES) {
251251
Pipe sendingPipe = getCasing().getSendingPipe(getFace(), p);
252252
if(!sendingPipe.isWriting()) {
253-
sendingPipe.beginWrite(tile.read());
253+
sendingPipe.beginWrite((short) tile.read());
254254
}
255255
}
256256
return;
@@ -268,7 +268,7 @@ protected void finishWriting(TileTapeDrive tile, Port writtenPort) {
268268
for(Port port : Port.VALUES) {
269269
Pipe sendingPipe = getCasing().getSendingPipe(getFace(), port);
270270
if(!sendingPipe.isWriting()) {
271-
sendingPipe.beginWrite(tile.read());
271+
sendingPipe.beginWrite((short) tile.read());
272272
}
273273
}
274274
} else {
@@ -287,26 +287,26 @@ protected void finishWriting(TileTapeDrive tile, Port writtenPort) {
287287
@Override
288288
protected void save(NBTTagCompound nbt) {
289289
super.save(nbt);
290-
nbt.setInteger("bq", byteQueue);
290+
nbt.setShort("bq", byteQueue);
291291
}
292292

293293
@Override
294294
protected void load(NBTTagCompound nbt) {
295295
super.load(nbt);
296296
if(nbt.hasKey("bq")) {
297-
byteQueue = nbt.getInteger("bq");
297+
byteQueue = nbt.getShort("bq");
298298
}
299299
}
300300
},
301301
new SetterCommand("write") { // write a single byte
302302
@Override
303-
protected void setValue(TileTapeDrive tile, int val) {
303+
protected void setValue(TileTapeDrive tile, short val) {
304304
tile.write((byte) val);
305305
}
306306
},
307307
new NeverWritingCommand("writeMultiple") { // write a number of bytes. First argument is the number of bytes to write
308308

309-
private int byteQueue = 0;
309+
private short byteQueue = 0;
310310

311311
@Override
312312
protected void process(TileTapeDrive tile) {
@@ -356,20 +356,20 @@ protected void process(TileTapeDrive tile) {
356356
@Override
357357
protected void save(NBTTagCompound nbt) {
358358
super.save(nbt);
359-
nbt.setInteger("bq", byteQueue);
359+
nbt.setShort("bq", byteQueue);
360360
}
361361

362362
@Override
363363
protected void load(NBTTagCompound nbt) {
364364
super.load(nbt);
365365
if(nbt.hasKey("bq")) {
366-
byteQueue = nbt.getInteger("bq");
366+
byteQueue = nbt.getShort("bq");
367367
}
368368
}
369369
},
370370
new SetterCommand("switchState") { // switchState
371371
@Override
372-
protected void setValue(TileTapeDrive tile, int val) {
372+
protected void setValue(TileTapeDrive tile, short val) {
373373
if(val < 0 || val >= State.VALUES.length) {
374374
return;
375375
}
@@ -378,7 +378,7 @@ protected void setValue(TileTapeDrive tile, int val) {
378378
}
379379
};
380380

381-
private Command getCommand(int ordinal) {
381+
private Command getCommand(short ordinal) {
382382
return ordinal >= 0 && ordinal < COMMANDS.length ? COMMANDS[ordinal] : null;
383383
}
384384

0 commit comments

Comments
 (0)
Please sign in to comment.