Code cleanup

This commit is contained in:
LemADEC 2016-04-22 21:33:29 +02:00
parent c1d5857ba2
commit 41a8dfafea
2 changed files with 21 additions and 21 deletions

View file

@ -99,14 +99,14 @@ public class CompatEnderIO implements IBlockTransformer {
}
return newData;
}
private NBTTagCompound rotate_conduit(final byte rotationSteps, NBTTagCompound conduit) {
NBTTagCompound newConduit = new NBTTagCompound();
Set<String> keys = conduit.func_150296_c();
private NBTTagCompound rotate_conduit(final byte rotationSteps, NBTTagCompound nbtConduit) {
NBTTagCompound nbtNewConduit = new NBTTagCompound();
Set<String> keys = nbtConduit.func_150296_c();
for (String key : keys) {
NBTBase base = conduit.getTag(key);
NBTBase base = nbtConduit.getTag(key);
switch(base.getId()) {
case NBTTagIntArrayId: // "connections", "externalConnections"
int[] data = conduit.getIntArray(key);
int[] data = nbtConduit.getIntArray(key);
int[] newData = data.clone();
for (int index = 0; index < data.length; index++) {
switch (rotationSteps) {
@ -123,37 +123,37 @@ public class CompatEnderIO implements IBlockTransformer {
break;
}
}
newConduit.setIntArray(key, newData);
nbtNewConduit.setIntArray(key, newData);
break;
case NBTTagByteArrayId: // "conModes", "signalColors", "forcedConnections", "signalStrengths"
newConduit.setByteArray(key, rotate_byteArray(rotationSteps, conduit.getByteArray(key)));
nbtNewConduit.setByteArray(key, rotate_byteArray(rotationSteps, nbtConduit.getByteArray(key)));
break;
default:
String[] parts = key.split("\\.");
if (parts.length != 2 || !rotSideNames.containsKey(parts[1])) {
newConduit.setTag(key, base);
nbtNewConduit.setTag(key, base);
} else {
switch (rotationSteps) {
case 1:
newConduit.setTag(parts[0] + "." + rotSideNames.get(parts[1]), base);
nbtNewConduit.setTag(parts[0] + "." + rotSideNames.get(parts[1]), base);
break;
case 2:
newConduit.setTag(parts[0] + "." + rotSideNames.get(rotSideNames.get(parts[1])), base);
nbtNewConduit.setTag(parts[0] + "." + rotSideNames.get(rotSideNames.get(parts[1])), base);
break;
case 3:
newConduit.setTag(parts[0] + "." + rotSideNames.get(rotSideNames.get(rotSideNames.get(parts[1]))), base);
nbtNewConduit.setTag(parts[0] + "." + rotSideNames.get(rotSideNames.get(rotSideNames.get(parts[1]))), base);
break;
default:
newConduit.setTag(key, base);
nbtNewConduit.setTag(key, base);
break;
}
}
break;
}
}
return newConduit;
return nbtNewConduit;
}
public void rotateReservoir(NBTTagCompound nbtTileEntity, final ITransformation transformation, final byte rotationSteps) {
@ -291,16 +291,16 @@ public class CompatEnderIO implements IBlockTransformer {
// Conduits
if (nbtTileEntity.hasKey("conduits")) {
NBTTagList conduits = nbtTileEntity.getTagList("conduits", NBTTagCompoundId);
NBTTagList newConduits = new NBTTagList();
for (int index = 0; index < conduits.tagCount(); index++) {
NBTTagCompound conduitTypeAndContent = conduits.getCompoundTagAt(index);
NBTTagList nbtConduits = nbtTileEntity.getTagList("conduits", NBTTagCompoundId);
NBTTagList nbtNewConduits = new NBTTagList();
for (int index = 0; index < nbtConduits.tagCount(); index++) {
NBTTagCompound conduitTypeAndContent = nbtConduits.getCompoundTagAt(index);
NBTTagCompound newConduitTypeAndContent = new NBTTagCompound();
newConduitTypeAndContent.setString("conduitType", conduitTypeAndContent.getString("conduitType"));
newConduitTypeAndContent.setTag("conduit", rotate_conduit(rotationSteps, conduitTypeAndContent.getCompoundTag("conduit")));
newConduits.appendTag(newConduitTypeAndContent);
nbtNewConduits.appendTag(newConduitTypeAndContent);
}
nbtTileEntity.setTag("conduits", newConduits);
nbtTileEntity.setTag("conduits", nbtNewConduits);
}
return metadata;
}

View file

@ -209,7 +209,7 @@ public class JumpShip {
actualVolume++;
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
WarpDrive.logger.info("Block(" + x + ", " + y + ", " + z + ") is " + block.getUnlocalizedName() + "@" + worldObj.getBlockMetadata(x, y, z));
WarpDrive.logger.info("Block(" + x + " " + y + " " + z + ") is " + block.getUnlocalizedName() + "@" + worldObj.getBlockMetadata(x, y, z));
}
if (!Dictionary.BLOCKS_NOMASS.contains(block)) {
@ -218,7 +218,7 @@ public class JumpShip {
// Stop on non-movable blocks
if (Dictionary.BLOCKS_ANCHOR.contains(block)) {
reason.append(block.getUnlocalizedName() + " detected onboard at " + x + ", " + y + ", " + z + ". Aborting.");
reason.append(block.getUnlocalizedName() + " detected onboard at " + x + " " + y + " " + z + ". Aborting.");
return false;
}