@@ -71,9 +71,7 @@ static String getVecRep(ForgeDirection dir) {
71
71
72
72
private byte currentSide = 0 , currentSideItemCount = 0 ;
73
73
74
- private byte facingPrevious = -1 , perpFacingNow = -1 , perpFacingPrev = -1 ;
75
-
76
- private boolean placedFromCustomStack = false ;
74
+ private byte perpFacingNow = -1 ;
77
75
78
76
public GT_MetaTileEntity_ItemDistributor (int aID , String aName , String aNameRegional , int aTier ) {
79
77
super (
@@ -211,16 +209,6 @@ private void setSideEnabledFromItemPerSide() {
211
209
}
212
210
}
213
211
214
- @ Override
215
- public void setItemNBT (NBTTagCompound aNBT ) {
216
- super .setItemNBT (aNBT );
217
- aNBT .setByte ("mCurrentFacing" , getBaseMetaTileEntity ().getFrontFacing ());
218
- aNBT .setByte ("mCurrentPerp" , perpFacingNow );
219
- aNBT .setBoolean ("mUseNewDistributionBehavior" , useNewDistributionBehavior );
220
- aNBT .setByteArray ("mItemsPerSide" , itemsPerSide );
221
- GT_NBT_Util .setBooleanArray (aNBT , "mSidesEnabled" , sidesEnabled );
222
- }
223
-
224
212
@ Override
225
213
public void onScrewdriverRightClick (byte aSide , EntityPlayer aPlayer , float aX , float aY , float aZ ) {
226
214
val newPerSideValue = (byte ) ((itemsPerSide [aSide ] + (aPlayer .isSneaking () ? -1 : 1 ) + 128 ) % 128 );
@@ -241,14 +229,6 @@ private void sendSideUpdateToClient(final byte aSide) {
241
229
}
242
230
}
243
231
244
- @ Override
245
- public void onFirstTick (final IGregTechTileEntity aBaseMetaTileEntity ) {
246
- super .onFirstTick (aBaseMetaTileEntity );
247
- if (/*aBaseMetaTileEntity.isServerSide() && */ placedFromCustomStack ) {
248
- attemptRotation ();
249
- }
250
- }
251
-
252
232
@ Override
253
233
public void onPostTick (final IGregTechTileEntity aBaseMetaTileEntity , final long aTimer ) {
254
234
super .onPostTick (aBaseMetaTileEntity , aTimer );
@@ -295,58 +275,6 @@ private void iterateSide() {
295
275
currentSide = (byte ) ((currentSide + 1 ) % 6 );
296
276
}
297
277
298
- private void attemptRotation () {
299
- val f = ForgeDirection .getOrientation (facingPrevious );
300
- var p = getPerpFacing (perpFacingPrev );
301
- val phi = ForgeDirection .getOrientation (getBaseMetaTileEntity ().getFrontFacing ());
302
- var pi = getPerpFacing (perpFacingNow );
303
- if (f .equals (phi ) && p .equals (pi )) {
304
- setSideEnabledFromItemPerSide ();
305
- sendAllSidesToClient ();
306
- return ;
307
- }
308
- val t = crossProduct (f , p );
309
- val tau = crossProduct (phi , pi );
310
- byte [] newItemsPerSide = new byte [6 ];
311
- if (f .equals (phi )) {
312
- // The facing axis is unchanged, simply rotate
313
- processAxialRotation (f , p , pi , newItemsPerSide );
314
- } else if (p .equals (pi )) {
315
- // The perpendicular axis is unchanged, simply rotate
316
- processAxialRotation (p , f , phi , newItemsPerSide );
317
- } else {
318
- val transformFToPhi = getInverseRotationMatrix (f , phi );
319
- val p_prime = p .getRotation (transformFToPhi );
320
- if (p_prime .equals (pi .getOpposite ())) {
321
- // Rotate itemPerSide by transformFToPhi and then 180 about phi
322
- for (byte i = 0 ; i < 6 ; i ++) {
323
- var dir = ForgeDirection .getOrientation (i ).getRotation (transformFToPhi );
324
- if (!phi .equals (ForgeDirection .UP )) {
325
- // Special case because of player perspective
326
- dir = rotationSquared (phi , dir );
327
- }
328
- var j = dir .ordinal ();
329
- newItemsPerSide [j ] = itemsPerSide [i ];
330
- }
331
- } else {
332
- if (phi .equals (ForgeDirection .DOWN )) {
333
- // Special case because of player perspective
334
- pi = pi .getOpposite ();
335
- }
336
- // Apply brute force rotation
337
- newItemsPerSide [rotationSquared (phi , phi ).ordinal ()] = itemsPerSide [f .ordinal ()];
338
- newItemsPerSide [rotationSquared (phi , pi ).ordinal ()] = itemsPerSide [p .ordinal ()];
339
- newItemsPerSide [rotationSquared (phi , tau ).ordinal ()] = itemsPerSide [t .ordinal ()];
340
- newItemsPerSide [rotationSquared (phi , phi .getOpposite ()).ordinal ()] = itemsPerSide [f .getOpposite ().ordinal ()];
341
- newItemsPerSide [rotationSquared (phi , pi .getOpposite ()).ordinal ()] = itemsPerSide [p .getOpposite ().ordinal ()];
342
- newItemsPerSide [rotationSquared (phi , tau .getOpposite ()).ordinal ()] = itemsPerSide [t .getOpposite ().ordinal ()];
343
- }
344
- }
345
- itemsPerSide = newItemsPerSide ;
346
- setSideEnabledFromItemPerSide ();
347
- sendAllSidesToClient ();
348
- }
349
-
350
278
private ForgeDirection getPerpFacing (final byte perpFacing ) {
351
279
switch (perpFacing ) {
352
280
case 0 : {
@@ -403,17 +331,6 @@ private static ForgeDirection rotationSquared(final ForgeDirection axis, final F
403
331
return initial .getRotation (axis ).getRotation (axis );
404
332
}
405
333
406
- @ Override
407
- public void initDefaultModes (final NBTTagCompound aNBT ) {
408
- super .initDefaultModes (aNBT );
409
- if (aNBT != null /*&& getBaseMetaTileEntity().isServerSide()*/ ) {
410
- grabNBT (aNBT );
411
- facingPrevious = aNBT .getByte ("mCurrentFacing" );
412
- perpFacingPrev = aNBT .getByte ("mCurrentPerp" );
413
- placedFromCustomStack = true ;
414
- }
415
- }
416
-
417
334
@ Override
418
335
public Object getServerGUI (int aID , InventoryPlayer aPlayerInventory , IGregTechTileEntity aBaseMetaTileEntity ) {
419
336
return new GT_Container_ItemDistributor (aPlayerInventory , aBaseMetaTileEntity );
0 commit comments