Code cleanup
This commit is contained in:
parent
b0e3183d11
commit
535da4c617
78 changed files with 384 additions and 383 deletions
|
@ -99,7 +99,7 @@ public class Commons {
|
|||
final String[] lines = updateEscapeCodes(message).split("\n");
|
||||
String format = "";
|
||||
getFormatFromString(lines[0]);
|
||||
for (String line : lines) {
|
||||
for (final String line : lines) {
|
||||
final String formattedLine = format + line;
|
||||
commandSender.addChatMessage(new ChatComponentText(formattedLine));
|
||||
format = getFormatFromString(formattedLine);
|
||||
|
@ -112,7 +112,7 @@ public class Commons {
|
|||
// will ensure it fits on minimum screen width
|
||||
public static void addTooltip(final List<String> list, final String tooltip) {
|
||||
final String[] split = updateEscapeCodes(tooltip).split("\n");
|
||||
for (String line : split) {
|
||||
for (final String line : split) {
|
||||
String lineRemaining = line;
|
||||
String formatNextLine = "";
|
||||
while (!lineRemaining.isEmpty()) {
|
||||
|
@ -167,7 +167,7 @@ public class Commons {
|
|||
} catch (Exception exception2) {
|
||||
exception2.printStackTrace();
|
||||
String map = "";
|
||||
for(Field fieldDeclared : clazz.getDeclaredFields()) {
|
||||
for (Field fieldDeclared : clazz.getDeclaredFields()) {
|
||||
if (!map.isEmpty()) {
|
||||
map += ", ";
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public class Commons {
|
|||
public static Collection<IInventory> getConnectedInventories(TileEntity tileEntityConnection) {
|
||||
final Collection<IInventory> result = new ArrayList<>(6);
|
||||
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
final TileEntity tileEntity = tileEntityConnection.getWorldObj().getTileEntity(
|
||||
tileEntityConnection.xCoord + side.offsetX, tileEntityConnection.yCoord + side.offsetY, tileEntityConnection.zCoord + side.offsetZ);
|
||||
if (tileEntity != null && (tileEntity instanceof IInventory)) {
|
||||
|
@ -270,7 +270,7 @@ public class Commons {
|
|||
iterated.add(current);
|
||||
}
|
||||
|
||||
for(ForgeDirection direction : directions) {
|
||||
for (ForgeDirection direction : directions) {
|
||||
VectorI next = current.clone(direction);
|
||||
if (!iterated.contains(next) && !toIgnore.contains(next) && !toIterate.contains(next) && !toIterateNext.contains(next)) {
|
||||
if (whitelist.contains(next.getBlock_noChunkLoading(world))) {
|
||||
|
@ -367,7 +367,7 @@ public class Commons {
|
|||
return yValues[0];
|
||||
}
|
||||
|
||||
for(int index = 0; index < xValues.length - 1; index++) {
|
||||
for (int index = 0; index < xValues.length - 1; index++) {
|
||||
if (xInput < xValues[index + 1]) {
|
||||
return interpolate(xValues[index], yValues[index], xValues[index + 1], yValues[index + 1], xInput);
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ public class Commons {
|
|||
final StringBuilder stringBuilder = new StringBuilder();
|
||||
final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
|
||||
final ThreadInfo[] threadInfos = threadMXBean.getThreadInfo(threadMXBean.getAllThreadIds(), 100);
|
||||
for (ThreadInfo threadInfo : threadInfos) {
|
||||
for (final ThreadInfo threadInfo : threadInfos) {
|
||||
stringBuilder.append('"');
|
||||
stringBuilder.append(threadInfo.getThreadName());
|
||||
stringBuilder.append("\"\n\tjava.lang.Thread.State: ");
|
||||
|
@ -505,7 +505,7 @@ public class Commons {
|
|||
public static EntityPlayerMP[] getOnlinePlayerByNameOrSelector(ICommandSender sender, final String playerNameOrSelector) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<EntityPlayer> onlinePlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||
for (EntityPlayer onlinePlayer : onlinePlayers) {
|
||||
for (final EntityPlayer onlinePlayer : onlinePlayers) {
|
||||
if (onlinePlayer.getCommandSenderName().equalsIgnoreCase(playerNameOrSelector) && onlinePlayer instanceof EntityPlayerMP) {
|
||||
return new EntityPlayerMP[]{ (EntityPlayerMP)onlinePlayer };
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class LocalProfiler {
|
|||
if ( !threadName.equals("Server thread")
|
||||
&& !threadName.equals("Client thread") ) {
|
||||
int depth = 0;
|
||||
for (StackTraceElement stackTraceElement : stacktrace) {
|
||||
for (final StackTraceElement stackTraceElement : stacktrace) {
|
||||
if (depth++ > 2 && depth < 30) {
|
||||
stringBuilderKey.append("\n ").append(stackTraceElement.getClassName());
|
||||
stringBuilderKey.append(".").append(stackTraceElement.getMethodName());
|
||||
|
@ -48,7 +48,7 @@ public class LocalProfiler {
|
|||
|
||||
public static void printCallStats() {
|
||||
WarpDrive.logger.info("Dumping chunk stats:");
|
||||
for (Entry<String, Integer> entryStat : stats.entrySet()) {
|
||||
for (final Entry<String, Integer> entryStat : stats.entrySet()) {
|
||||
WarpDrive.logger.info(String.format("%10d x %s",
|
||||
entryStat.getValue(),
|
||||
entryStat.getKey()));
|
||||
|
|
|
@ -365,7 +365,7 @@ public class WarpDrive implements LoadingCallback {
|
|||
GameRegistry.registerTileEntity(TileEntityAirGenerator.class, MODID + ":blockAirGenerator");
|
||||
|
||||
blockAirGeneratorTiered = new Block[3];
|
||||
for(byte tier = 1; tier <= 3; tier++) {
|
||||
for (byte tier = 1; tier <= 3; tier++) {
|
||||
final int index = tier - 1;
|
||||
blockAirGeneratorTiered[index] = new BlockAirGeneratorTiered(tier);
|
||||
GameRegistry.registerBlock(blockAirGeneratorTiered[index], ItemBlockAbstractBase.class, "blockAirGenerator" + tier);
|
||||
|
@ -515,7 +515,7 @@ public class WarpDrive implements LoadingCallback {
|
|||
blockForceFields = new Block[3];
|
||||
blockForceFieldProjectors = new Block[3];
|
||||
blockForceFieldRelays = new Block[3];
|
||||
for(byte tier = 1; tier <= 3; tier++) {
|
||||
for (byte tier = 1; tier <= 3; tier++) {
|
||||
int index = tier - 1;
|
||||
// FORCE FIELD
|
||||
blockForceFields[index] = new BlockForceField(tier);
|
||||
|
@ -600,11 +600,11 @@ public class WarpDrive implements LoadingCallback {
|
|||
blockHulls_stairs = new Block[3][16];
|
||||
blockHulls_slab = new Block[3][16];
|
||||
|
||||
for(byte tier = 1; tier <= 3; tier++) {
|
||||
for (byte tier = 1; tier <= 3; tier++) {
|
||||
int index = tier - 1;
|
||||
for (EnumHullPlainType enumHullPlainType : EnumHullPlainType.values()) {
|
||||
blockHulls_plain[index][enumHullPlainType.ordinal()] = new BlockHullPlain(tier, enumHullPlainType);
|
||||
GameRegistry.registerBlock(blockHulls_plain[index][enumHullPlainType.ordinal()], ItemBlockHull.class, "blockHull" + tier + "_" + enumHullPlainType.getName());
|
||||
for (final EnumHullPlainType hullPlainType : EnumHullPlainType.values()) {
|
||||
blockHulls_plain[index][hullPlainType.ordinal()] = new BlockHullPlain(tier, hullPlainType);
|
||||
GameRegistry.registerBlock(blockHulls_plain[index][hullPlainType.ordinal()], ItemBlockHull.class, "blockHull" + tier + "_" + hullPlainType.getName());
|
||||
}
|
||||
blockHulls_glass[index] = new BlockHullGlass(tier);
|
||||
GameRegistry.registerBlock(blockHulls_glass[index], ItemBlockHull.class, "blockHull" + tier + "_glass");
|
||||
|
@ -701,7 +701,7 @@ public class WarpDrive implements LoadingCallback {
|
|||
public void onFMLPostInitialization(FMLPostInitializationEvent event) {
|
||||
/* @TODO not sure why it would be needed, disabling for now
|
||||
// load all owned dimensions at boot
|
||||
for (CelestialObject celestialObject : CelestialObjectManager.celestialObjects) {
|
||||
for (final CelestialObject celestialObject : CelestialObjectManager.celestialObjects) {
|
||||
if (celestialObject.provider.equals(CelestialObject.PROVIDER_OTHER)) {
|
||||
DimensionManager.getWorld(celestialObject.dimensionId);
|
||||
}
|
||||
|
|
|
@ -85,14 +85,14 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
|
|||
protected boolean addToInventories(final List<ItemStack> itemStacks, final Collection<IInventory> inventories) {
|
||||
boolean overflow = false;
|
||||
if (itemStacks != null) {
|
||||
for (ItemStack itemStack : itemStacks) {
|
||||
for (final ItemStack itemStack : itemStacks) {
|
||||
if (itemStack.getItem() == null) {
|
||||
WarpDrive.logger.error(this + "Invalid itemStack with null item...");
|
||||
continue;
|
||||
}
|
||||
int qtyLeft = itemStack.stackSize;
|
||||
ItemStack itemStackLeft = itemStack.copy();
|
||||
for (IInventory inventory : inventories) {
|
||||
final ItemStack itemStackLeft = itemStack.copy();
|
||||
for (final IInventory inventory : inventories) {
|
||||
qtyLeft = addToInventory(itemStack, inventory);
|
||||
if (qtyLeft > 0) {
|
||||
itemStackLeft.stackSize = qtyLeft;
|
||||
|
@ -108,8 +108,8 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
|
|||
int transfer;
|
||||
while (qtyLeft > 0) {
|
||||
transfer = Math.min(qtyLeft, itemStackLeft.getMaxStackSize());
|
||||
ItemStack itemStackDrop = Commons.copyWithSize(itemStackLeft, transfer);
|
||||
EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5D, yCoord + 1.0D, zCoord + 0.5D, itemStackDrop);
|
||||
final ItemStack itemStackDrop = Commons.copyWithSize(itemStackLeft, transfer);
|
||||
final EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5D, yCoord + 1.0D, zCoord + 0.5D, itemStackDrop);
|
||||
worldObj.spawnEntityInWorld(entityItem);
|
||||
qtyLeft -= transfer;
|
||||
}
|
||||
|
@ -184,14 +184,14 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
|
|||
|
||||
// saved properties
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
if (tag.hasKey("upgrades")) {
|
||||
NBTTagCompound nbtTagCompoundUpgrades = tag.getCompoundTag("upgrades");
|
||||
Set<String> keys = nbtTagCompoundUpgrades.func_150296_c();
|
||||
for (String key : keys) {
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
if (tagCompound.hasKey("upgrades")) {
|
||||
final NBTTagCompound nbtTagCompoundUpgrades = tagCompound.getCompoundTag("upgrades");
|
||||
final Set<String> keys = nbtTagCompoundUpgrades.func_150296_c();
|
||||
for (final String key : keys) {
|
||||
Object object = getUpgradeFromString(key);
|
||||
int value = nbtTagCompoundUpgrades.getByte(key);
|
||||
final int value = nbtTagCompoundUpgrades.getByte(key);
|
||||
if (object == null) {
|
||||
WarpDrive.logger.error("Found an unknown upgrade named '" + key + "' in " + this);
|
||||
object = key;
|
||||
|
@ -202,24 +202,24 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
public void writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
if (!installedUpgrades.isEmpty()) {
|
||||
NBTTagCompound nbtTagCompoundUpgrades = new NBTTagCompound();
|
||||
for (Entry<Object, Integer> entry : installedUpgrades.entrySet()) {
|
||||
String key = getUpgradeAsString(entry.getKey());
|
||||
final NBTTagCompound nbtTagCompoundUpgrades = new NBTTagCompound();
|
||||
for (final Entry<Object, Integer> entry : installedUpgrades.entrySet()) {
|
||||
final String key = getUpgradeAsString(entry.getKey());
|
||||
nbtTagCompoundUpgrades.setByte(key, (byte)(int)entry.getValue());
|
||||
}
|
||||
tagCompound.setTag("upgrades", nbtTagCompoundUpgrades);
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeItemDropNBT(NBTTagCompound nbtTagCompound) {
|
||||
writeToNBT(nbtTagCompound);
|
||||
nbtTagCompound.removeTag("x");
|
||||
nbtTagCompound.removeTag("y");
|
||||
nbtTagCompound.removeTag("z");
|
||||
return nbtTagCompound;
|
||||
public NBTTagCompound writeItemDropNBT(final NBTTagCompound tagCompound) {
|
||||
writeToNBT(tagCompound);
|
||||
tagCompound.removeTag("x");
|
||||
tagCompound.removeTag("y");
|
||||
tagCompound.removeTag("z");
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
// status
|
||||
|
@ -297,8 +297,8 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
|
|||
if (clazz == null) {
|
||||
return installedUpgrades;
|
||||
}
|
||||
Map<Object, Integer> mapResult = new HashMap<>(installedUpgrades.size());
|
||||
for (Entry<Object, Integer> entry : installedUpgrades.entrySet()) {
|
||||
final Map<Object, Integer> mapResult = new HashMap<>(installedUpgrades.size());
|
||||
for (final Entry<Object, Integer> entry : installedUpgrades.entrySet()) {
|
||||
if (clazz.isInstance(entry.getKey())) {
|
||||
mapResult.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
@ -318,11 +318,11 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
|
|||
|
||||
protected String getUpgradesAsString() {
|
||||
String message = "";
|
||||
for (Entry<Object, Integer> entry : installedUpgrades.entrySet()) {
|
||||
for (final Entry<Object, Integer> entry : installedUpgrades.entrySet()) {
|
||||
if (!message.isEmpty()) {
|
||||
message += ", ";
|
||||
}
|
||||
Object key = entry.getKey();
|
||||
final Object key = entry.getKey();
|
||||
String keyName = key.toString();
|
||||
if (key instanceof Item) {
|
||||
keyName = ((Item) key).getUnlocalizedName();
|
||||
|
|
|
@ -76,7 +76,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
|
|||
} else {
|
||||
int currentLength = methodsArray.length;
|
||||
methodsArray = Arrays.copyOf(methodsArray, methodsArray.length + methodsToAdd.length);
|
||||
for (String method : methodsToAdd) {
|
||||
for (final String method : methodsToAdd) {
|
||||
methodsArray[currentLength] = method;
|
||||
currentLength++;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
|
|||
strings = strings[strings.length - 1].split("\\.");
|
||||
}
|
||||
ArrayList<Integer> integers = new ArrayList<>(strings.length);
|
||||
for (String string : strings) {
|
||||
for (final String string : strings) {
|
||||
integers.add(Integer.parseInt(string));
|
||||
}
|
||||
return integers.toArray();
|
||||
|
@ -294,7 +294,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
|
|||
computer.mount("/" + folderPeripheral, ComputerCraftAPI.createResourceMount(WarpDrive.class, modid, "lua.ComputerCraft/" + peripheralName));
|
||||
computer.mount("/warpupdater" , ComputerCraftAPI.createResourceMount(WarpDrive.class, modid, "lua.ComputerCraft/common/updater"));
|
||||
if (WarpDriveConfig.G_LUA_SCRIPTS == WarpDriveConfig.LUA_SCRIPTS_ALL) {
|
||||
for (String script : CC_scripts) {
|
||||
for (final String script : CC_scripts) {
|
||||
computer.mount("/" + script, ComputerCraftAPI.createResourceMount(WarpDrive.class, modid, "lua.ComputerCraft/" + peripheralName + "/" + script));
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
|
|||
WarpDrive.logger.info(this + " Sending event '" + eventName + "'");
|
||||
}
|
||||
if (WarpDriveConfig.isComputerCraftLoaded) {
|
||||
for(Map.Entry<Integer, IComputerAccess> integerIComputerAccessEntry : connectedComputers.entrySet()) {
|
||||
for (final Map.Entry<Integer, IComputerAccess> integerIComputerAccessEntry : connectedComputers.entrySet()) {
|
||||
IComputerAccess comp = integerIComputerAccessEntry.getValue();
|
||||
comp.queueEvent(eventName, arguments);
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ public abstract class TileEntityAbstractLaser extends TileEntityAbstractInterfac
|
|||
}
|
||||
|
||||
// Secondary scan for laser medium below the required average
|
||||
for (TileEntityLaserMedium laserMedium : laserMediums) {
|
||||
for (final TileEntityLaserMedium laserMedium : laserMediums) {
|
||||
int energyStored = laserMedium.energy_getEnergyStored();
|
||||
if (energyStored < energyAverage) {
|
||||
energyLeftOver += energyAverage - energyStored;
|
||||
|
@ -172,7 +172,7 @@ public abstract class TileEntityAbstractLaser extends TileEntityAbstractInterfac
|
|||
|
||||
// Third and final pass for energy consumption
|
||||
int energyTotalConsumed = 0;
|
||||
for (TileEntityLaserMedium laserMedium : laserMediums) {
|
||||
for (final TileEntityLaserMedium laserMedium : laserMediums) {
|
||||
int energyStored = laserMedium.energy_getEnergyStored();
|
||||
int energyToConsume = Math.min(energyStored, energyAverage + energyLeftOver);
|
||||
energyLeftOver -= Math.max(0, energyToConsume - energyAverage);
|
||||
|
|
|
@ -231,15 +231,15 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
|
|||
|
||||
// Apply effect to entities
|
||||
if (entityHits != null) {
|
||||
for (Entry<Double, MovingObjectPosition> entityHitEntry : entityHits.entrySet()) {
|
||||
double entityHitDistance = entityHitEntry.getKey();
|
||||
for (final Entry<Double, MovingObjectPosition> entityHitEntry : entityHits.entrySet()) {
|
||||
final double entityHitDistance = entityHitEntry.getKey();
|
||||
// ignore entities behind walls
|
||||
if (entityHitDistance >= blockHitDistance) {
|
||||
break;
|
||||
}
|
||||
|
||||
// only hits entities with health or whitelisted
|
||||
MovingObjectPosition mopEntity = entityHitEntry.getValue();
|
||||
final MovingObjectPosition mopEntity = entityHitEntry.getValue();
|
||||
if (mopEntity == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
|
|||
WarpDrive.logger.info("Entity is a valid target (living) " + entity);
|
||||
}
|
||||
} else {
|
||||
String entityId = EntityList.getEntityString(mopEntity.entityHit);
|
||||
final String entityId = EntityList.getEntityString(mopEntity.entityHit);
|
||||
if (!Dictionary.ENTITIES_NONLIVINGTARGET.contains(entityId)) {
|
||||
if (WarpDriveConfig.LOGGING_WEAPON) {
|
||||
WarpDrive.logger.info("Entity is an invalid target (non-living " + entityId + ") " + mopEntity.entityHit);
|
||||
|
@ -306,7 +306,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
|
|||
break;
|
||||
}
|
||||
|
||||
Block block = worldObj.getBlock(blockHit.blockX, blockHit.blockY, blockHit.blockZ);
|
||||
final Block block = worldObj.getBlock(blockHit.blockX, blockHit.blockY, blockHit.blockZ);
|
||||
// int blockMeta = worldObj.getBlockMetadata(hit.blockX, hit.blockY, hit.blockZ);
|
||||
// get hardness and blast resistance
|
||||
float hardness = -2.0F;
|
||||
|
@ -477,8 +477,8 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
|
|||
}
|
||||
|
||||
// Pick the closest one on trajectory
|
||||
HashMap<Double, MovingObjectPosition> entityHits = new HashMap<>(entities.size());
|
||||
for (Entity entity : entities) {
|
||||
final HashMap<Double, MovingObjectPosition> entityHits = new HashMap<>(entities.size());
|
||||
for (final Entity entity : entities) {
|
||||
if (entity != null && entity.canBeCollidedWith() && entity.boundingBox != null) {
|
||||
double border = entity.getCollisionBorderSize();
|
||||
AxisAlignedBB aabbEntity = entity.boundingBox.expand(border, border, border);
|
||||
|
|
|
@ -123,15 +123,15 @@ public class TileEntityAirGeneratorTiered extends TileEntityAbstractEnergy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
isEnabled = !tagCompound.hasKey("isEnabled") || tagCompound.getBoolean("isEnabled");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
tag.setBoolean("isEnabled", isEnabled);
|
||||
public void writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tagCompound.setBoolean("isEnabled", isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -351,8 +351,8 @@ public class TileEntityShipScanner extends TileEntityAbstractInterfaced implemen
|
|||
}
|
||||
|
||||
schematic.setString("Materials", "Alpha");
|
||||
NBTTagList tagListBlocks = new NBTTagList();
|
||||
for (String stringRegistryName : stringBlockRegistryNames) {
|
||||
final NBTTagList tagListBlocks = new NBTTagList();
|
||||
for (final String stringRegistryName : stringBlockRegistryNames) {
|
||||
tagListBlocks.appendTag(new NBTTagString(stringRegistryName));
|
||||
}
|
||||
schematic.setTag("Blocks", tagListBlocks);
|
||||
|
@ -702,7 +702,7 @@ public class TileEntityShipScanner extends TileEntityAbstractInterfaced implemen
|
|||
return;
|
||||
}
|
||||
if (entityPlayers.size() > 1) {
|
||||
for (EntityPlayer entityPlayer : entityPlayers) {
|
||||
for (final EntityPlayer entityPlayer : entityPlayers) {
|
||||
Commons.addChatMessage(entityPlayer, "§c" + "Too many players detected: please stand in the beam one at a time.");
|
||||
shipToken_nextUpdate_ticks = SHIP_TOKEN_UPDATE_DELAY_FAILED_PRECONDITION_TICKS;
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
|||
Block plant = null;
|
||||
int plantMetadata = -1;
|
||||
IInventory inventory = null;
|
||||
for (IInventory inventoryLoop : inventories) {
|
||||
for (final IInventory inventoryLoop : inventories) {
|
||||
if (!found) {
|
||||
slotIndex = 0;
|
||||
}
|
||||
|
@ -491,9 +491,9 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
|||
|
||||
LinkedList<VectorI> soilPositions = new LinkedList<>();
|
||||
|
||||
for(int y = yMin; y <= yMax; y++) {
|
||||
for(int x = xMin; x <= xMax; x++) {
|
||||
for(int z = zMin; z <= zMax; z++) {
|
||||
for (int y = yMin; y <= yMax; y++) {
|
||||
for (int x = xMin; x <= xMax; x++) {
|
||||
for (int z = zMin; z <= zMax; z++) {
|
||||
if (worldObj.isAirBlock(x, y + 1, z)) {
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
if (isSoil(block)) {
|
||||
|
@ -524,9 +524,9 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
|||
|
||||
Collection<VectorI> logPositions = new HashSet<>();
|
||||
|
||||
for(int y = yMin; y <= yMax; y++) {
|
||||
for(int x = xMin; x <= xMax; x++) {
|
||||
for(int z = zMin; z <= zMax; z++) {
|
||||
for (int y = yMin; y <= yMax; y++) {
|
||||
for (int x = xMin; x <= xMax; x++) {
|
||||
for (int z = zMin; z <= zMax; z++) {
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
if (isLog(block)) {
|
||||
VectorI pos = new VectorI(x, y, z);
|
||||
|
|
|
@ -305,7 +305,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
|
|||
if (tier == 1) {// tier1 = gaz and air blocks don't count
|
||||
for (y = minY; y <= maxY; y++) {
|
||||
for (x = minX; x <= maxX; x++) {
|
||||
for(z = minZ; z <= maxZ; z++) {
|
||||
for (z = minZ; z <= maxZ; z++) {
|
||||
if (!worldObj.isAirBlock(x, y, z)) {
|
||||
volume_new++;
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
|
|||
} else {// tier2 = everything counts
|
||||
for (y = minY; y <= maxY; y++) {
|
||||
for (x = minX; x <= maxX; x++) {
|
||||
for(z = minZ; z <= maxZ; z++) {
|
||||
for (z = minZ; z <= maxZ; z++) {
|
||||
if (worldObj.getBlock(x, y, z) != Blocks.air) {
|
||||
volume_new++;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TileEntityIC2reactorLaserMonitor extends TileEntityAbstractLaser {
|
|||
// returns IReactor tile entities
|
||||
@Optional.Method(modid = "IC2")
|
||||
private IReactor findReactor() {
|
||||
for(final EnumFacing facing : EnumFacing.values()) {
|
||||
for (final EnumFacing facing : EnumFacing.values()) {
|
||||
final TileEntity tileEntity = worldObj.getTileEntity(
|
||||
xCoord + 2 * facing.getFrontOffsetX(),
|
||||
yCoord + 2 * facing.getFrontOffsetY(),
|
||||
|
@ -96,8 +96,8 @@ public class TileEntityIC2reactorLaserMonitor extends TileEntityAbstractLaser {
|
|||
|
||||
@Optional.Method(modid = "IC2")
|
||||
private boolean coolReactor(final IReactor reactor) {
|
||||
for(int x = 0; x < 9; x++) {
|
||||
for(int y = 0; y < 6; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
for (int y = 0; y < 6; y++) {
|
||||
final ItemStack itemStack = reactor.getItemAt(x, y);
|
||||
if ( itemStack != null
|
||||
&& itemStack.getItem() instanceof ItemIC2reactorLaserFocus ) {
|
||||
|
|
|
@ -152,7 +152,7 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR
|
|||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
ForceFieldSetup forceFieldSetup = getForceFieldSetup(world, x, y, z);
|
||||
final ForceFieldSetup forceFieldSetup = getForceFieldSetup(world, x, y, z);
|
||||
if (forceFieldSetup != null) {
|
||||
forceFieldSetup.onEntityEffect(world, x, y, z, entityPlayer);
|
||||
}
|
||||
|
@ -160,11 +160,11 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR
|
|||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
ForceFieldSetup forceFieldSetup = getForceFieldSetup(world, x, y, z);
|
||||
final ForceFieldSetup forceFieldSetup = getForceFieldSetup(world, x, y, z);
|
||||
if (forceFieldSetup != null) {
|
||||
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.9D, z + 1));
|
||||
final List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.9D, z + 1));
|
||||
|
||||
for (EntityPlayer entityPlayer : entities) {
|
||||
for (final EntityPlayer entityPlayer : entities) {
|
||||
if (entityPlayer != null && entityPlayer.isSneaking()) {
|
||||
if ( entityPlayer.capabilities.isCreativeMode
|
||||
|| forceFieldSetup.isAccessGranted(entityPlayer, EnumPermissionNode.SNEAK_THROUGH)) {
|
||||
|
@ -185,15 +185,15 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR
|
|||
return;
|
||||
}
|
||||
|
||||
ForceFieldSetup forceFieldSetup = getForceFieldSetup(world, x, y, z);
|
||||
final ForceFieldSetup forceFieldSetup = getForceFieldSetup(world, x, y, z);
|
||||
if (forceFieldSetup != null) {
|
||||
forceFieldSetup.onEntityEffect(world, x, y, z, entity);
|
||||
double distance2 = new Vector3(x, y, z).translate(0.5F).distanceTo_square(entity);
|
||||
if (entity instanceof EntityLiving && distance2 < 0.26D) {
|
||||
boolean hasPermission = false;
|
||||
|
||||
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.9D, z + 1));
|
||||
for (EntityPlayer entityPlayer : entities) {
|
||||
final List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.9D, z + 1));
|
||||
for (final EntityPlayer entityPlayer : entities) {
|
||||
if (entityPlayer != null && entityPlayer.isSneaking()) {
|
||||
if ( entityPlayer.capabilities.isCreativeMode
|
||||
|| forceFieldSetup.isAccessGranted(entityPlayer, EnumPermissionNode.SNEAK_THROUGH) ) {
|
||||
|
|
|
@ -32,10 +32,10 @@ public class BlockForceFieldRelay extends BlockAbstractForceField {
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
public void registerBlockIcons(final IIconRegister iconRegister) {
|
||||
icons = new IIcon[EnumForceFieldUpgrade.length + 1];
|
||||
|
||||
for (EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
|
||||
for (final EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
|
||||
if (enumForceFieldUpgrade.maxCountOnRelay > 0) {
|
||||
icons[enumForceFieldUpgrade.ordinal()] = iconRegister.registerIcon("warpdrive:forcefield/relay" + "_" + enumForceFieldUpgrade.unlocalizedName);
|
||||
} else {
|
||||
|
|
|
@ -116,7 +116,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
|||
});
|
||||
CC_scripts = Arrays.asList("enable", "disable");
|
||||
|
||||
for (EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
|
||||
for (final EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
|
||||
if (enumForceFieldUpgrade.maxCountOnProjector > 0) {
|
||||
setUpgradeMaxCount(enumForceFieldUpgrade, enumForceFieldUpgrade.maxCountOnProjector);
|
||||
}
|
||||
|
@ -243,10 +243,10 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
|||
String msg = StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", getBlockType().getLocalizedName())
|
||||
+ StatCollector.translateToLocalFormatted("warpdrive.forcefield.guide.lowPower");
|
||||
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(xCoord - 10, yCoord - 10, zCoord - 10, xCoord + 10, yCoord + 10, zCoord + 10);
|
||||
List<Entity> list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
|
||||
final AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(xCoord - 10, yCoord - 10, zCoord - 10, xCoord + 10, yCoord + 10, zCoord + 10);
|
||||
final List<Entity> list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
|
||||
|
||||
for (Entity entity : list) {
|
||||
for (final Entity entity : list) {
|
||||
if (entity == null || (!(entity instanceof EntityPlayer)) || entity instanceof FakePlayer) {
|
||||
continue;
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
|||
|
||||
// skip if fusion upgrade is present and it's inside another projector area
|
||||
if (forceFieldSetup.hasFusion) {
|
||||
for (TileEntityForceFieldProjector projector : forceFieldSetup.projectors) {
|
||||
for (final TileEntityForceFieldProjector projector : forceFieldSetup.projectors) {
|
||||
if (projector.isPartOfInterior(vector)) {
|
||||
doProjectThisBlock = false;
|
||||
break;
|
||||
|
@ -554,7 +554,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
|||
Block blockToPlace = null;
|
||||
int metadataToPlace = -1;
|
||||
IInventory inventory = null;
|
||||
for (IInventory inventoryLoop : forceFieldSetup.inventories) {
|
||||
for (final IInventory inventoryLoop : forceFieldSetup.inventories) {
|
||||
if (!found) {
|
||||
slotIndex = 0;
|
||||
}
|
||||
|
@ -663,9 +663,9 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
|||
return true;
|
||||
}
|
||||
} else {
|
||||
for (ItemStack itemStackDrop : itemStacks) {
|
||||
ItemStack drop = itemStackDrop.copy();
|
||||
EntityItem entityItem = new EntityItem(worldObj, vector.x + 0.5D, vector.y + 1.0D, vector.z + 0.5D, drop);
|
||||
for (final ItemStack itemStackDrop : itemStacks) {
|
||||
final ItemStack drop = itemStackDrop.copy();
|
||||
final EntityItem entityItem = new EntityItem(worldObj, vector.x + 0.5D, vector.y + 1.0D, vector.z + 0.5D, drop);
|
||||
worldObj.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
}
|
||||
|
@ -1169,8 +1169,8 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
|||
if (vertexes.isEmpty()) {
|
||||
WarpDrive.logger.error(this + " No vertexes for " + forceFieldSetup + " at " + projector);
|
||||
}
|
||||
for (Map.Entry<VectorI, Boolean> entry : vertexes.entrySet()) {
|
||||
VectorI vPosition = entry.getKey();
|
||||
for (final Map.Entry<VectorI, Boolean> entry : vertexes.entrySet()) {
|
||||
final VectorI vPosition = entry.getKey();
|
||||
if (forceFieldSetup.isDoubleSided || vPosition.y >= 0) {
|
||||
if ((forceFieldSetup.rotationYaw != 0.0F) || (forceFieldSetup.rotationPitch != 0.0F) || (forceFieldSetup.rotationRoll != 0.0F)) {
|
||||
vPosition.rotateByAngle(forceFieldSetup.rotationYaw, forceFieldSetup.rotationPitch, forceFieldSetup.rotationRoll);
|
||||
|
|
|
@ -50,6 +50,7 @@ public class TileEntityForceFieldRelay extends TileEntityAbstractForceField impl
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return super.getStatus()
|
||||
+ "\n" + getUpgradeStatus();
|
||||
|
|
|
@ -145,7 +145,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
|
|||
}
|
||||
} else {
|
||||
final NBTTagList tagListPlayers = tagCompound.getTagList("players", Constants.NBT.TAG_STRING);
|
||||
for(int index = 0; index < tagListPlayers.tagCount(); index++) {
|
||||
for (int index = 0; index < tagListPlayers.tagCount(); index++) {
|
||||
final String namePlayer = tagListPlayers.getStringTagAt(index);
|
||||
players.add(namePlayer);
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
|
|||
}
|
||||
|
||||
private void setCommand(final String command) {
|
||||
for(EnumShipControllerCommand enumShipControllerCommand : EnumShipControllerCommand.values()) {
|
||||
for (final EnumShipControllerCommand enumShipControllerCommand : EnumShipControllerCommand.values()) {
|
||||
if (enumShipControllerCommand.name().equalsIgnoreCase(command)) {
|
||||
this.command = enumShipControllerCommand;
|
||||
markDirty();
|
||||
|
@ -446,7 +446,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
|
|||
|
||||
@Override
|
||||
public Object[] shipName(Object[] arguments) {
|
||||
final TileEntityShipCore tileEntityShipCore = tileEntityShipCoreWeakReference == null ? findCoreBlock() : tileEntityShipCoreWeakReference.get();
|
||||
final TileEntityShipCore tileEntityShipCore = tileEntityShipCoreWeakReference == null ? null : tileEntityShipCoreWeakReference.get();
|
||||
if (tileEntityShipCore == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -296,13 +296,13 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy {
|
|||
if (WarpDriveConfig.LOGGING_TRANSPORTER) {
|
||||
WarpDrive.logger.info(this + " lock strength " + getLockStrength());
|
||||
}
|
||||
ArrayList<Entity> entitiesToTransport = findEntities(sourceVec, ls);
|
||||
Integer energyRequired = getEnergyRequired();
|
||||
final ArrayList<Entity> entitiesToTransport = findEntities(sourceVec, ls);
|
||||
final Integer energyRequired = getEnergyRequired();
|
||||
if (energyRequired == null) {
|
||||
return -1;
|
||||
}
|
||||
Vector3 modDest = destVec.clone().translate(centreOnMe);
|
||||
for (Entity ent : entitiesToTransport) {
|
||||
final Vector3 modDest = destVec.clone().translate(centreOnMe);
|
||||
for (final Entity ent : entitiesToTransport) {
|
||||
if (energy_consume(energyRequired, false)) {
|
||||
if (WarpDriveConfig.LOGGING_TRANSPORTER) {
|
||||
WarpDrive.logger.info(this + " Transporting entity " + ent.getEntityId());
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BlockDecorative extends Block {
|
|||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (EnumDecorativeType enumDecorativeType : EnumDecorativeType.values()) {
|
||||
for (final EnumDecorativeType enumDecorativeType : EnumDecorativeType.values()) {
|
||||
list.add(new ItemStack(item, 1, enumDecorativeType.ordinal()));
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class BlockDecorative extends Block {
|
|||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[EnumDecorativeType.length];
|
||||
for (EnumDecorativeType enumDecorativeType : EnumDecorativeType.values()) {
|
||||
for (final EnumDecorativeType enumDecorativeType : EnumDecorativeType.values()) {
|
||||
icons[enumDecorativeType.ordinal()] = iconRegister.registerIcon("warpdrive:decoration/decorative-" + enumDecorativeType.unlocalizedName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ public class ItemBlockDecorative extends ItemBlock {
|
|||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (EnumDecorativeType enumDecorativeType : EnumDecorativeType.values()) {
|
||||
list.add(new ItemStack(item, 1, enumDecorativeType.ordinal()));
|
||||
for (final EnumDecorativeType decorativeType : EnumDecorativeType.values()) {
|
||||
list.add(new ItemStack(item, 1, decorativeType.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ public class CommandInvisible extends CommandBase {
|
|||
WarpDrive.logger.info("/invisible: setting invisible to " + params[0]);
|
||||
|
||||
// get an online player by name
|
||||
List<EntityPlayer> onlinePlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||
for (EntityPlayer onlinePlayer : onlinePlayers) {
|
||||
final List<EntityPlayer> onlinePlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||
for (final EntityPlayer onlinePlayer : onlinePlayers) {
|
||||
if (onlinePlayer.getCommandSenderName().equalsIgnoreCase(params[0])) {
|
||||
player = onlinePlayer;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ public class CommandSpace extends CommandBase {
|
|||
|
||||
@Override
|
||||
public void processCommand(ICommandSender commandSender, String[] params) {
|
||||
if (commandSender == null) { return; }
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
if (commandSender == null) { return; }
|
||||
final MinecraftServer server = MinecraftServer.getServer();
|
||||
|
||||
// set defaults
|
||||
int dimensionIdTarget = Integer.MAX_VALUE;
|
||||
|
@ -50,7 +50,7 @@ public class CommandSpace extends CommandBase {
|
|||
Commons.addChatMessage(commandSender, getCommandUsage(commandSender));
|
||||
return;
|
||||
}
|
||||
EntityPlayerMP[] entityPlayerMPs_found = Commons.getOnlinePlayerByNameOrSelector(commandSender, params[0]);
|
||||
final EntityPlayerMP[] entityPlayerMPs_found = Commons.getOnlinePlayerByNameOrSelector(commandSender, params[0]);
|
||||
if (entityPlayerMPs_found != null) {
|
||||
entityPlayerMPs = entityPlayerMPs_found;
|
||||
} else if (commandSender instanceof EntityPlayer) {
|
||||
|
@ -61,7 +61,7 @@ public class CommandSpace extends CommandBase {
|
|||
}
|
||||
|
||||
} else if (params.length == 2) {
|
||||
EntityPlayerMP[] entityPlayerMPs_found = Commons.getOnlinePlayerByNameOrSelector(commandSender, params[0]);
|
||||
final EntityPlayerMP[] entityPlayerMPs_found = Commons.getOnlinePlayerByNameOrSelector(commandSender, params[0]);
|
||||
if (entityPlayerMPs_found != null) {
|
||||
entityPlayerMPs = entityPlayerMPs_found;
|
||||
} else {
|
||||
|
@ -81,7 +81,7 @@ public class CommandSpace extends CommandBase {
|
|||
return;
|
||||
}
|
||||
|
||||
for (EntityPlayerMP entityPlayerMP : entityPlayerMPs) {
|
||||
for (final EntityPlayerMP entityPlayerMP : entityPlayerMPs) {
|
||||
// toggle between overworld and space if no dimension was provided
|
||||
int xTarget = MathHelper.floor_double(entityPlayerMP.posX);
|
||||
int yTarget = Math.min(255, Math.max(0, MathHelper.floor_double(entityPlayerMP.posY)));
|
||||
|
|
|
@ -100,7 +100,7 @@ public class CompatAppliedEnergistics2 implements IBlockTransformer {
|
|||
|
||||
@Override
|
||||
public int rotate(final Block block, final int metadata, NBTTagCompound nbtTileEntity, final ITransformation transformation) {
|
||||
byte rotationSteps = transformation.getRotationSteps();
|
||||
final byte rotationSteps = transformation.getRotationSteps();
|
||||
if (rotationSteps == 0) {
|
||||
return metadata;
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ public class CompatAppliedEnergistics2 implements IBlockTransformer {
|
|||
}
|
||||
|
||||
if (nbtTileEntity.hasKey("orientation_up") && nbtTileEntity.hasKey("orientation_forward")) {
|
||||
String orientation_forward = nbtTileEntity.getString("orientation_forward");
|
||||
String orientation_up = nbtTileEntity.getString("orientation_up");
|
||||
final String orientation_forward = nbtTileEntity.getString("orientation_forward");
|
||||
final String orientation_up = nbtTileEntity.getString("orientation_up");
|
||||
if (orientation_forward.equals("UP") || orientation_forward.equals("DOWN")) {
|
||||
switch (rotationSteps) {
|
||||
case 1:
|
||||
|
@ -151,14 +151,14 @@ public class CompatAppliedEnergistics2 implements IBlockTransformer {
|
|||
}
|
||||
}
|
||||
} else if (classBlockCableBus.isInstance(block)) {
|
||||
HashMap<String, NBTTagCompound> tagsRotated = new HashMap<>(7);
|
||||
ArrayList<String> keys = new ArrayList<>();
|
||||
final HashMap<String, NBTTagCompound> tagsRotated = new HashMap<>(7);
|
||||
final ArrayList<String> keys = new ArrayList<>();
|
||||
keys.addAll(nbtTileEntity.func_150296_c());
|
||||
for (String key : keys) {
|
||||
for (final String key : keys) {
|
||||
if ( (key.startsWith("def:") && !key.equals("def:6"))
|
||||
|| (key.startsWith("extra:") && !key.equals("extra:6"))) {
|
||||
NBTTagCompound compound = (NBTTagCompound) nbtTileEntity.getCompoundTag(key).copy();
|
||||
String[] parts = key.split(":");
|
||||
final NBTTagCompound compound = (NBTTagCompound) nbtTileEntity.getCompoundTag(key).copy();
|
||||
final String[] parts = key.split(":");
|
||||
if (parts.length != 2 || !rotTagSuffix.containsKey(parts[1])) {
|
||||
// skip
|
||||
} else {
|
||||
|
@ -180,7 +180,7 @@ public class CompatAppliedEnergistics2 implements IBlockTransformer {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (Entry<String, NBTTagCompound> entry : tagsRotated.entrySet()) {
|
||||
for (final Entry<String, NBTTagCompound> entry : tagsRotated.entrySet()) {
|
||||
nbtTileEntity.setTag(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
private static final short[] rotPosHorizontal = { 1, 3, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
|
||||
private byte[] rotate_byteArray(final byte rotationSteps, final byte[] data) {
|
||||
byte[] newData = data.clone();
|
||||
final byte[] newData = data.clone();
|
||||
for (int index = 0; index < data.length; index++) {
|
||||
switch (rotationSteps) {
|
||||
case 1:
|
||||
|
@ -102,10 +102,10 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
return newData;
|
||||
}
|
||||
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 = nbtConduit.getTag(key);
|
||||
final NBTTagCompound nbtNewConduit = new NBTTagCompound();
|
||||
final Set<String> keys = nbtConduit.func_150296_c();
|
||||
for (final String key : keys) {
|
||||
final NBTBase base = nbtConduit.getTag(key);
|
||||
switch(base.getId()) {
|
||||
case Constants.NBT.TAG_INT_ARRAY: // "connections", "externalConnections"
|
||||
int[] data = nbtConduit.getIntArray(key);
|
||||
|
@ -133,7 +133,7 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
break;
|
||||
|
||||
default:
|
||||
String[] parts = key.split("\\.");
|
||||
final String[] parts = key.split("\\.");
|
||||
if (parts.length != 2 || !rotSideNames.containsKey(parts[1])) {
|
||||
nbtNewConduit.setTag(key, base);
|
||||
} else {
|
||||
|
@ -158,9 +158,9 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
return nbtNewConduit;
|
||||
}
|
||||
|
||||
private void rotateReservoir(NBTTagCompound nbtTileEntity, final ITransformation transformation, final byte rotationSteps) {
|
||||
private void rotateReservoir(final NBTTagCompound nbtTileEntity, final ITransformation transformation, final byte rotationSteps) {
|
||||
if (nbtTileEntity.hasKey("front")) {
|
||||
short front = nbtTileEntity.getShort("front");
|
||||
final short front = nbtTileEntity.getShort("front");
|
||||
switch (rotationSteps) {
|
||||
case 1:
|
||||
nbtTileEntity.setShort("front", rotFront[front]);
|
||||
|
@ -176,7 +176,7 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
}
|
||||
}
|
||||
if (nbtTileEntity.hasKey("right")) {
|
||||
short right = nbtTileEntity.getShort("right");
|
||||
final short right = nbtTileEntity.getShort("right");
|
||||
switch (rotationSteps) {
|
||||
case 1:
|
||||
nbtTileEntity.setShort("right", rotRight[right]);
|
||||
|
@ -194,8 +194,8 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
|
||||
// Multiblock
|
||||
if (nbtTileEntity.hasKey("multiblock") && nbtTileEntity.hasKey("pos")) {
|
||||
int[] oldCoords = nbtTileEntity.getIntArray("multiblock");
|
||||
ChunkCoordinates[] targets = new ChunkCoordinates[oldCoords.length / 3];
|
||||
final int[] oldCoords = nbtTileEntity.getIntArray("multiblock");
|
||||
final ChunkCoordinates[] targets = new ChunkCoordinates[oldCoords.length / 3];
|
||||
for (int index = 0; index < oldCoords.length / 3; index++) {
|
||||
targets[index] = transformation.apply(oldCoords[3 * index], oldCoords[3 * index + 1], oldCoords[3 * index + 2]);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
}
|
||||
}
|
||||
|
||||
int[] newCoords = new int[oldCoords.length];
|
||||
final int[] newCoords = new int[oldCoords.length];
|
||||
for (int index = 0; index < oldCoords.length / 3; index++) {
|
||||
newCoords[3 * index ] = targets[index].posX;
|
||||
newCoords[3 * index + 1] = targets[index].posY;
|
||||
|
@ -264,8 +264,8 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
}
|
||||
|
||||
// Faces
|
||||
Map<String, Short> map = new HashMap<>();
|
||||
for (String key : rotFaceNames.keySet()) {
|
||||
final Map<String, Short> map = new HashMap<>();
|
||||
for (final String key : rotFaceNames.keySet()) {
|
||||
if (nbtTileEntity.hasKey(key)) {
|
||||
short face = nbtTileEntity.getShort(key);
|
||||
switch (rotationSteps) {
|
||||
|
@ -286,18 +286,18 @@ public class CompatEnderIO implements IBlockTransformer {
|
|||
}
|
||||
}
|
||||
if (!map.isEmpty()) {
|
||||
for (Entry<String, Short> entry : map.entrySet()) {
|
||||
for (final Entry<String, Short> entry : map.entrySet()) {
|
||||
nbtTileEntity.setShort(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// Conduits
|
||||
if (nbtTileEntity.hasKey("conduits")) {
|
||||
NBTTagList nbtConduits = nbtTileEntity.getTagList("conduits", Constants.NBT.TAG_COMPOUND);
|
||||
NBTTagList nbtNewConduits = new NBTTagList();
|
||||
final NBTTagList nbtConduits = nbtTileEntity.getTagList("conduits", Constants.NBT.TAG_COMPOUND);
|
||||
final NBTTagList nbtNewConduits = new NBTTagList();
|
||||
for (int index = 0; index < nbtConduits.tagCount(); index++) {
|
||||
NBTTagCompound conduitTypeAndContent = nbtConduits.getCompoundTagAt(index);
|
||||
NBTTagCompound newConduitTypeAndContent = new NBTTagCompound();
|
||||
final NBTTagCompound conduitTypeAndContent = nbtConduits.getCompoundTagAt(index);
|
||||
final NBTTagCompound newConduitTypeAndContent = new NBTTagCompound();
|
||||
newConduitTypeAndContent.setString("conduitType", conduitTypeAndContent.getString("conduitType"));
|
||||
newConduitTypeAndContent.setTag("conduit", rotate_conduit(rotationSteps, conduitTypeAndContent.getCompoundTag("conduit")));
|
||||
nbtNewConduits.appendTag(newConduitTypeAndContent);
|
||||
|
|
|
@ -46,11 +46,11 @@ public class CompatImmersiveEngineering implements IBlockTransformer {
|
|||
@Optional.Method(modid = "ImmersiveEngineering")
|
||||
public NBTBase saveExternals(final World world, final int x, final int y, final int z, final Block block, final int blockMeta, final TileEntity tileEntity) {
|
||||
if (tileEntity instanceof IImmersiveConnectable) {
|
||||
ChunkCoordinates node = new ChunkCoordinates(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
Collection<Connection> connections = ImmersiveNetHandler.INSTANCE.getConnections(tileEntity.getWorldObj(), node);
|
||||
final ChunkCoordinates node = new ChunkCoordinates(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
final Collection<Connection> connections = ImmersiveNetHandler.INSTANCE.getConnections(tileEntity.getWorldObj(), node);
|
||||
if (connections != null) {
|
||||
NBTTagList nbtImmersiveEngineering = new NBTTagList();
|
||||
for (Connection connection : connections) {
|
||||
final NBTTagList nbtImmersiveEngineering = new NBTTagList();
|
||||
for (final Connection connection : connections) {
|
||||
nbtImmersiveEngineering.appendTag(connection.writeToNBT());
|
||||
}
|
||||
ImmersiveNetHandler.INSTANCE.clearConnectionsOriginatingFrom(node, tileEntity.getWorldObj());
|
||||
|
@ -95,22 +95,22 @@ public class CompatImmersiveEngineering implements IBlockTransformer {
|
|||
public void restoreExternals(final World world, final int x, final int y, final int z,
|
||||
final Block block, final int blockMeta, final TileEntity tileEntity,
|
||||
final ITransformation transformation, final NBTBase nbtBase) {
|
||||
NBTTagList nbtImmersiveEngineering = (NBTTagList) nbtBase;
|
||||
final NBTTagList nbtImmersiveEngineering = (NBTTagList) nbtBase;
|
||||
if (nbtImmersiveEngineering == null) {
|
||||
return;
|
||||
}
|
||||
World targetWorld = transformation.getTargetWorld();
|
||||
final World targetWorld = transformation.getTargetWorld();
|
||||
|
||||
// powerPathList
|
||||
for (int indexConnectionToAdd = 0; indexConnectionToAdd < nbtImmersiveEngineering.tagCount(); indexConnectionToAdd++) {
|
||||
Connection connectionToAdd = Connection.readFromNBT(nbtImmersiveEngineering.getCompoundTagAt(indexConnectionToAdd));
|
||||
final Connection connectionToAdd = Connection.readFromNBT(nbtImmersiveEngineering.getCompoundTagAt(indexConnectionToAdd));
|
||||
connectionToAdd.start = transformation.apply(connectionToAdd.start);
|
||||
connectionToAdd.end = transformation.apply(connectionToAdd.end);
|
||||
ChunkCoordinates node = new ChunkCoordinates(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
Collection<Connection> connectionActuals = ImmersiveNetHandler.INSTANCE.getConnections(tileEntity.getWorldObj(), node);
|
||||
final ChunkCoordinates node = new ChunkCoordinates(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
final Collection<Connection> connectionActuals = ImmersiveNetHandler.INSTANCE.getConnections(tileEntity.getWorldObj(), node);
|
||||
boolean existing = false;
|
||||
if (connectionActuals != null) {
|
||||
for (Connection connectionActual : connectionActuals) {
|
||||
for (final Connection connectionActual : connectionActuals) {
|
||||
if ( connectionActual.start.posX == connectionToAdd.start.posX
|
||||
&& connectionActual.start.posY == connectionToAdd.start.posY
|
||||
&& connectionActual.start.posZ == connectionToAdd.start.posZ
|
||||
|
|
|
@ -92,8 +92,8 @@ public class CompatMekanism implements IBlockTransformer {
|
|||
}
|
||||
|
||||
// ducts
|
||||
HashMap<String, NBTBase> mapRotated = new HashMap<>(9);
|
||||
for (String key : rotConAttachmentNames.keySet()) {
|
||||
final HashMap<String, NBTBase> mapRotated = new HashMap<>(9);
|
||||
for (final String key : rotConAttachmentNames.keySet()) {
|
||||
if (nbtTileEntity.hasKey(key)) {
|
||||
NBTBase nbtBase = nbtTileEntity.getTag(key);
|
||||
nbtTileEntity.removeTag(key);
|
||||
|
@ -113,7 +113,7 @@ public class CompatMekanism implements IBlockTransformer {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, NBTBase> entry : mapRotated.entrySet()) {
|
||||
for (final Map.Entry<String, NBTBase> entry : mapRotated.entrySet()) {
|
||||
nbtTileEntity.setTag(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
|
|
|
@ -86,9 +86,9 @@ public class CompatStargateTech2 implements IBlockTransformer {
|
|||
}
|
||||
|
||||
private static NBTTagCompound rotateFacingColors(final Byte rotationSteps, final NBTTagCompound tag) {
|
||||
NBTTagCompound newFacing = new NBTTagCompound();
|
||||
Set<String> keys = tag.func_150296_c();
|
||||
for (String key : keys) {
|
||||
final NBTTagCompound newFacing = new NBTTagCompound();
|
||||
final Set<String> keys = tag.func_150296_c();
|
||||
for (final String key : keys) {
|
||||
NBTBase base = tag.getTag(key);
|
||||
if (base instanceof NBTTagByte && rotFacingcolors.containsKey(key)) {
|
||||
switch (rotationSteps) {
|
||||
|
|
|
@ -76,8 +76,8 @@ public class CompatThermalDynamics implements IBlockTransformer {
|
|||
}
|
||||
|
||||
// ducts
|
||||
HashMap<String, NBTBase> mapRotated = new HashMap<>(9);
|
||||
for (String key : rotConAttachmentNames.keySet()) {
|
||||
final HashMap<String, NBTBase> mapRotated = new HashMap<>(9);
|
||||
for (final String key : rotConAttachmentNames.keySet()) {
|
||||
if (nbtTileEntity.hasKey(key)) {
|
||||
NBTBase nbtBase = nbtTileEntity.getTag(key);
|
||||
nbtTileEntity.removeTag(key);
|
||||
|
@ -97,7 +97,7 @@ public class CompatThermalDynamics implements IBlockTransformer {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, NBTBase> entry : mapRotated.entrySet()) {
|
||||
for (final Map.Entry<String, NBTBase> entry : mapRotated.entrySet()) {
|
||||
nbtTileEntity.setTag(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
|
|
|
@ -200,8 +200,8 @@ public class Dictionary {
|
|||
taggedBlocksName = categoryBlockTags.getValues().keySet().toArray(new String[0]);
|
||||
}
|
||||
taggedBlocks = new HashMap<>(taggedBlocksName.length);
|
||||
for (String name : taggedBlocksName) {
|
||||
String tags = config.get("block_tags", name, "").getString();
|
||||
for (final String name : taggedBlocksName) {
|
||||
final String tags = config.get("block_tags", name, "").getString();
|
||||
taggedBlocks.put(name, tags);
|
||||
}
|
||||
}
|
||||
|
@ -251,8 +251,8 @@ public class Dictionary {
|
|||
taggedEntitiesName = categoryEntityTags.getValues().keySet().toArray(new String[0]);
|
||||
}
|
||||
taggedEntities = new HashMap<>(taggedEntitiesName.length);
|
||||
for (String name : taggedEntitiesName) {
|
||||
String tags = config.get("entity_tags", name, "").getString();
|
||||
for (final String name : taggedEntitiesName) {
|
||||
final String tags = config.get("entity_tags", name, "").getString();
|
||||
taggedEntities.put(name, tags);
|
||||
}
|
||||
}
|
||||
|
@ -308,8 +308,8 @@ public class Dictionary {
|
|||
taggedItemsName = categoryItemTags.getValues().keySet().toArray(new String[0]);
|
||||
}
|
||||
taggedItems = new HashMap<>(taggedItemsName.length);
|
||||
for (String name : taggedItemsName) {
|
||||
String tags = config.get("item_tags", name, "").getString();
|
||||
for (final String name : taggedItemsName) {
|
||||
final String tags = config.get("item_tags", name, "").getString();
|
||||
taggedItems.put(name, tags);
|
||||
}
|
||||
}
|
||||
|
@ -322,25 +322,25 @@ public class Dictionary {
|
|||
BLOCKS_LOGS = new HashSet<>();
|
||||
BLOCKS_LEAVES = new HashSet<>();
|
||||
String[] oreNames = OreDictionary.getOreNames();
|
||||
for (String oreName : oreNames) {
|
||||
String lowerOreName = oreName.toLowerCase();
|
||||
for (final String oreName : oreNames) {
|
||||
final String lowerOreName = oreName.toLowerCase();
|
||||
if (oreName.length() > 4 && oreName.substring(0, 3).equals("ore")) {
|
||||
ArrayList<ItemStack> itemStacks = OreDictionary.getOres(oreName);
|
||||
for (ItemStack itemStack : itemStacks) {
|
||||
final ArrayList<ItemStack> itemStacks = OreDictionary.getOres(oreName);
|
||||
for (final ItemStack itemStack : itemStacks) {
|
||||
BLOCKS_ORES.add(Block.getBlockFromItem(itemStack.getItem()));
|
||||
// WarpDrive.logger.info("- added " + oreName + " to ores as " + itemStack);
|
||||
}
|
||||
}
|
||||
if (lowerOreName.startsWith("log") || lowerOreName.endsWith("log") || lowerOreName.endsWith("logs")) {
|
||||
ArrayList<ItemStack> itemStacks = OreDictionary.getOres(oreName);
|
||||
for (ItemStack itemStack : itemStacks) {
|
||||
final ArrayList<ItemStack> itemStacks = OreDictionary.getOres(oreName);
|
||||
for (final ItemStack itemStack : itemStacks) {
|
||||
BLOCKS_LOGS.add(Block.getBlockFromItem(itemStack.getItem()));
|
||||
// WarpDrive.logger.info("- added " + oreName + " to logs as " + itemStack);
|
||||
}
|
||||
}
|
||||
if (lowerOreName.startsWith("leave") || lowerOreName.endsWith("leave") || lowerOreName.endsWith("leaves")) {
|
||||
ArrayList<ItemStack> itemStacks = OreDictionary.getOres(oreName);
|
||||
for (ItemStack itemStack : itemStacks) {
|
||||
final ArrayList<ItemStack> itemStacks = OreDictionary.getOres(oreName);
|
||||
for (final ItemStack itemStack : itemStacks) {
|
||||
BLOCKS_LEAVES.add(Block.getBlockFromItem(itemStack.getItem()));
|
||||
// WarpDrive.logger.info("- added " + oreName + " to leaves as " + itemStack);
|
||||
}
|
||||
|
@ -360,13 +360,13 @@ public class Dictionary {
|
|||
BLOCKS_STOPMINING = new HashSet<>(taggedBlocks.size());
|
||||
BLOCKS_PLACE = new HashMap<>(taggedBlocks.size());
|
||||
BLOCKS_NOCAMOUFLAGE = new HashSet<>(taggedBlocks.size());
|
||||
for (Entry<String, String> taggedBlock : taggedBlocks.entrySet()) {
|
||||
Block block = Block.getBlockFromName(taggedBlock.getKey());
|
||||
for (final Entry<String, String> taggedBlock : taggedBlocks.entrySet()) {
|
||||
final Block block = Block.getBlockFromName(taggedBlock.getKey());
|
||||
if (block == null) {
|
||||
WarpDrive.logger.info("Ignoring missing block " + taggedBlock.getKey());
|
||||
continue;
|
||||
}
|
||||
for (String tag : taggedBlock.getValue().replace("\t", " ").replace(",", " ").replace(" ", " ").split(" ")) {
|
||||
for (final String tag : taggedBlock.getValue().replace("\t", " ").replace(",", " ").replace(" ", " ").split(" ")) {
|
||||
switch (tag) {
|
||||
case "Soil" : BLOCKS_SOILS.add(block); break;
|
||||
case "Log" : BLOCKS_LOGS.add(block); break;
|
||||
|
@ -397,15 +397,15 @@ public class Dictionary {
|
|||
ENTITIES_LEFTBEHIND = new HashSet<>(taggedEntities.size());
|
||||
ENTITIES_NONLIVINGTARGET = new HashSet<>(taggedEntities.size());
|
||||
ENTITIES_LIVING_WITHOUT_AIR = new HashSet<>(taggedEntities.size());
|
||||
for (Entry<String, String> taggedEntity : taggedEntities.entrySet()) {
|
||||
String entityId = taggedEntity.getKey();
|
||||
for (final Entry<String, String> taggedEntity : taggedEntities.entrySet()) {
|
||||
final String entityId = taggedEntity.getKey();
|
||||
/* we can't detect missing entities, since some of them are 'hacked' in
|
||||
if (!EntityList.stringToIDMapping.containsKey(entityId)) {
|
||||
WarpDrive.logger.info("Ignoring missing entity " + entityId);
|
||||
continue;
|
||||
}
|
||||
/**/
|
||||
for (String tag : taggedEntity.getValue().replace("\t", " ").replace(",", " ").replace(" ", " ").split(" ")) {
|
||||
for (final String tag : taggedEntity.getValue().replace("\t", " ").replace(",", " ").replace(" ", " ").split(" ")) {
|
||||
switch (tag) {
|
||||
case "Anchor" : ENTITIES_ANCHOR.add(entityId); break;
|
||||
case "NoMass" : ENTITIES_NOMASS.add(entityId); break;
|
||||
|
@ -423,14 +423,14 @@ public class Dictionary {
|
|||
ITEMS_FLYINSPACE = new HashSet<>(taggedItems.size());
|
||||
ITEMS_NOFALLDAMAGE = new HashSet<>(taggedItems.size());
|
||||
ITEMS_BREATHING_HELMET = new HashSet<>(taggedItems.size());
|
||||
for (Entry<String, String> taggedItem : taggedItems.entrySet()) {
|
||||
String itemId = taggedItem.getKey();
|
||||
Item item = GameData.getItemRegistry().getObject(itemId);
|
||||
for (final Entry<String, String> taggedItem : taggedItems.entrySet()) {
|
||||
final String itemId = taggedItem.getKey();
|
||||
final Item item = GameData.getItemRegistry().getObject(itemId);
|
||||
if (item == null) {
|
||||
WarpDrive.logger.info("Ignoring missing item " + itemId);
|
||||
continue;
|
||||
}
|
||||
for (String tag : taggedItem.getValue().replace("\t", " ").replace(",", " ").replace(" ", " ").split(" ")) {
|
||||
for (final String tag : taggedItem.getValue().replace("\t", " ").replace(",", " ").replace(" ", " ").split(" ")) {
|
||||
switch (tag) {
|
||||
case "FlyInSpace" : ITEMS_FLYINSPACE.add(item); break;
|
||||
case "NoFallDamage" : ITEMS_NOFALLDAMAGE.add(item); break;
|
||||
|
@ -496,7 +496,7 @@ public class Dictionary {
|
|||
/**/
|
||||
|
||||
// scan blocks registry
|
||||
for(Object blockKey : Block.blockRegistry.getKeys()) {
|
||||
for (final Object blockKey : Block.blockRegistry.getKeys()) {
|
||||
Object object = Block.blockRegistry.getObject(blockKey);
|
||||
WarpDrive.logger.debug("Checking block registry for '" + blockKey + "': " + object);
|
||||
if (!(object instanceof Block)) {
|
||||
|
@ -558,7 +558,7 @@ public class Dictionary {
|
|||
}
|
||||
}
|
||||
|
||||
private static String getHashMessage(HashSet hashSet) {
|
||||
private static String getHashMessage(final HashSet hashSet) {
|
||||
final StringBuilder message = new StringBuilder();
|
||||
for (Object object : hashSet) {
|
||||
if (message.length() > 0) {
|
||||
|
@ -576,9 +576,9 @@ public class Dictionary {
|
|||
return message.toString();
|
||||
}
|
||||
|
||||
private static String getHashMessage(HashMap<Block, Integer> hashMap) {
|
||||
private static String getHashMessage(final HashMap<Block, Integer> hashMap) {
|
||||
final StringBuilder message = new StringBuilder();
|
||||
for (Entry<Block, Integer> entry : hashMap.entrySet()) {
|
||||
for (final Entry<Block, Integer> entry : hashMap.entrySet()) {
|
||||
if (message.length() > 0) {
|
||||
message.append(", ");
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class GenericSet<E extends IXmlRepresentableUnit> implements IXmlRepresen
|
|||
@Override
|
||||
public boolean loadFromXmlElement(Element element) throws InvalidXmlException {
|
||||
final List<Element> listChildren = XmlFileManager.getChildrenElementByTagName(element, nameElementUnit);
|
||||
for (Element elementChild : listChildren) {
|
||||
for (final Element elementChild : listChildren) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final E unit = (E) unitDefault.constructor();
|
||||
units.loadFromXML(unit, elementChild);
|
||||
|
@ -67,7 +67,7 @@ public class GenericSet<E extends IXmlRepresentableUnit> implements IXmlRepresen
|
|||
|
||||
final List<Element> listImports = XmlFileManager.getChildrenElementByTagName(element, "import");
|
||||
if (!listImports.isEmpty()) {
|
||||
for (Element elementImport : listImports) {
|
||||
for (final Element elementImport : listImports) {
|
||||
final String importGroup = elementImport.getAttribute("group");
|
||||
final String importName = elementImport.getAttribute("name");
|
||||
if (!importGroup.isEmpty()) {
|
||||
|
|
|
@ -82,9 +82,9 @@ public class GenericSetManager<E extends IXmlRepresentableUnit> extends XmlFileM
|
|||
while (!genericSetsDependencies.isEmpty() && iterationCount++ < 10) {
|
||||
final HashMap<GenericSet<E>, ArrayList<String>> genericSetsLeftToImport = new HashMap<>();
|
||||
|
||||
for (Entry<GenericSet<E>, ArrayList<String>> entry : genericSetsDependencies.entrySet()) {
|
||||
for (final Entry<GenericSet<E>, ArrayList<String>> entry : genericSetsDependencies.entrySet()) {
|
||||
final ArrayList<String> newDependencies = new ArrayList<>();
|
||||
for (String dependency : entry.getValue()) {
|
||||
for (final String dependency : entry.getValue()) {
|
||||
final GenericSet<E> genericSet = getGenericSet(dependency);
|
||||
if (genericSet == null) {
|
||||
WarpDrive.logger.error(String.format("Ignoring missing %s %s dependency in %s %s", nameElementSet, dependency, nameElementSet, entry.getKey()));
|
||||
|
@ -116,9 +116,9 @@ public class GenericSetManager<E extends IXmlRepresentableUnit> extends XmlFileM
|
|||
// recursion has reach the limit?
|
||||
if (!genericSetsDependencies.isEmpty()) {
|
||||
WarpDrive.logger.error("Too many import recursions, ignoring the remaining ones:");
|
||||
for (Entry<GenericSet<E>, ArrayList<String>> entry : genericSetsDependencies.entrySet()) {
|
||||
for (final Entry<GenericSet<E>, ArrayList<String>> entry : genericSetsDependencies.entrySet()) {
|
||||
WarpDrive.logger.warn(String.format("- %s %s is pending:", nameElementSet, entry.getKey()));
|
||||
for (String dependency : entry.getValue()) {
|
||||
for (final String dependency : entry.getValue()) {
|
||||
WarpDrive.logger.warn(" + " + dependency);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class RandomCollection<E extends IStringSerializable> {
|
|||
* @return Named object or null if there is no object with that name
|
||||
**/
|
||||
public E getNamedEntry(final String name) {
|
||||
for(E object : list) {
|
||||
for (final E object : list) {
|
||||
if (object.getName().equals(name)) {
|
||||
return object;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class RandomCollection<E extends IStringSerializable> {
|
|||
if (list.isEmpty()) {
|
||||
return "-none defined-";
|
||||
}
|
||||
for(E object : list) {
|
||||
for (final E object : list) {
|
||||
if (!names.isEmpty()) {
|
||||
names += ", ";
|
||||
}
|
||||
|
@ -197,12 +197,12 @@ public class RandomCollection<E extends IStringSerializable> {
|
|||
|
||||
public void loadFrom(RandomCollection<E> objects) {
|
||||
int previousWeight = 0;
|
||||
for (Entry<Integer, E> entry : objects.weightMap.entrySet()) {
|
||||
for (final Entry<Integer, E> entry : objects.weightMap.entrySet()) {
|
||||
addWeight(entry.getKey() - previousWeight, entry.getValue());
|
||||
previousWeight = entry.getKey();
|
||||
}
|
||||
double previousRatio = 0.0D;
|
||||
for (Entry<Double, E> entry : objects.ratioMap.entrySet()) {
|
||||
for (final Entry<Double, E> entry : objects.ratioMap.entrySet()) {
|
||||
addRatio(entry.getKey() - previousRatio, entry.getValue());
|
||||
previousRatio = entry.getKey();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RecipeParticleShapedOre implements IRecipe {
|
|||
if (recipe[indexRecipe] instanceof String[]) {
|
||||
String[] stringRecipeLines = ((String[]) recipe[indexRecipe++]);
|
||||
|
||||
for (String stringRecipeLine : stringRecipeLines) {
|
||||
for (final String stringRecipeLine : stringRecipeLines) {
|
||||
width = stringRecipeLine.length();
|
||||
shape += stringRecipeLine;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class RecipeParticleShapedOre implements IRecipe {
|
|||
|
||||
itemStackIngredients = new Object[recipe.recipeItems.length];
|
||||
|
||||
for(int i = 0; i < itemStackIngredients.length; i++) {
|
||||
for (int i = 0; i < itemStackIngredients.length; i++) {
|
||||
ItemStack itemStackIngredient = recipe.recipeItems[i];
|
||||
|
||||
if (itemStackIngredient == null) {
|
||||
|
@ -135,7 +135,7 @@ public class RecipeParticleShapedOre implements IRecipe {
|
|||
|
||||
itemStackIngredients[i] = recipe.recipeItems[i];
|
||||
|
||||
for(Entry<ItemStack, String> entry : replacements.entrySet()) {
|
||||
for (final Entry<ItemStack, String> entry : replacements.entrySet()) {
|
||||
if (OreDictionary.itemMatches(entry.getKey(), itemStackIngredient, true)) {
|
||||
itemStackIngredients[i] = OreDictionary.getOres(entry.getValue());
|
||||
break;
|
||||
|
|
|
@ -86,8 +86,8 @@ public class RecipeTuningDriver implements IRecipe {
|
|||
// find a matching dye from ore dictionary
|
||||
boolean matched = false;
|
||||
for (int indexDye = 0; indexDye < Recipes.oreDyes.length; indexDye++) {
|
||||
ArrayList<ItemStack> itemStackDyes = OreDictionary.getOres(Recipes.oreDyes[indexDye]);
|
||||
for (ItemStack itemStackDye : itemStackDyes) {
|
||||
final ArrayList<ItemStack> itemStackDyes = OreDictionary.getOres(Recipes.oreDyes[indexDye]);
|
||||
for (final ItemStack itemStackDye : itemStackDyes) {
|
||||
if (OreDictionary.itemMatches(itemStackSlot, itemStackDye, true)) {
|
||||
// match found, update dye combination
|
||||
matched = true;
|
||||
|
|
|
@ -1752,7 +1752,7 @@ public class Recipes {
|
|||
|
||||
private static void initDynamicHull() {
|
||||
// Hull ore dictionary
|
||||
for(int tier = 1; tier <= 3; tier++) {
|
||||
for (int tier = 1; tier <= 3; tier++) {
|
||||
int index = tier - 1;
|
||||
for (int woolColor = 0; woolColor < 16; woolColor++) {
|
||||
OreDictionary.registerOre("blockHull" + tier + "_plain", new ItemStack(WarpDrive.blockHulls_plain[index][0], 1, woolColor));
|
||||
|
@ -1896,7 +1896,7 @@ public class Recipes {
|
|||
}
|
||||
|
||||
// Hull blocks variation
|
||||
for(int tier = 1; tier <= 3; tier++) {
|
||||
for (int tier = 1; tier <= 3; tier++) {
|
||||
int index = tier - 1;
|
||||
for (int woolColor = 0; woolColor < 16; woolColor++) {
|
||||
|
||||
|
|
|
@ -486,8 +486,8 @@ public class WarpDriveConfig {
|
|||
onFMLPostInitialization();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<EntityPlayer> entityPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||
for (EntityPlayer entityPlayer : entityPlayers) {
|
||||
final List<EntityPlayer> entityPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||
for (final EntityPlayer entityPlayer : entityPlayers) {
|
||||
if ( entityPlayer instanceof EntityPlayerMP
|
||||
&& !(entityPlayer instanceof FakePlayer) ) {
|
||||
final CelestialObject celestialObject = CelestialObjectManager.get(entityPlayer.worldObj,
|
||||
|
@ -661,7 +661,7 @@ public class WarpDriveConfig {
|
|||
|
||||
// Ship movement costs
|
||||
SHIP_MOVEMENT_COSTS_FACTORS = new ShipMovementCosts.Factors[EnumShipMovementType.length];
|
||||
for (EnumShipMovementType shipMovementType : EnumShipMovementType.values()) {
|
||||
for (final EnumShipMovementType shipMovementType : EnumShipMovementType.values()) {
|
||||
SHIP_MOVEMENT_COSTS_FACTORS[shipMovementType.ordinal()] = new ShipMovementCosts.Factors(
|
||||
shipMovementType.maximumDistanceDefault,
|
||||
shipMovementType.energyRequiredDefault,
|
||||
|
@ -1251,7 +1251,7 @@ public class WarpDriveConfig {
|
|||
throw new RuntimeException(String.format("Critical error accessing configuration directory, searching for %s*%s files: %s", prefix, suffix, configDirectory));
|
||||
}
|
||||
if (files.length == 0) {
|
||||
for (String filename : filenames) {
|
||||
for (final String filename : filenames) {
|
||||
unpackResourceToFolder(filename, resourcePathSource, folderTarget);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ public class XmlPreprocessor {
|
|||
*/
|
||||
public static String checkModRequirements(Element element) {
|
||||
|
||||
ModCheckResults modCheckResults = new ModCheckResults();
|
||||
final ModCheckResults modCheckResults = new ModCheckResults();
|
||||
|
||||
for (String mod : element.getAttribute("mods").split(",")) {
|
||||
for (final String mod : element.getAttribute("mods").split(",")) {
|
||||
|
||||
// @TODO add version check
|
||||
|
||||
|
@ -107,23 +107,23 @@ public class XmlPreprocessor {
|
|||
|
||||
// 'in' takes precedence over 'from' attribute
|
||||
if (elementFor.hasAttribute("in")) {
|
||||
String[] inOptions = elementFor.getAttribute("in").split(",");
|
||||
final String[] inOptions = elementFor.getAttribute("in").split(",");
|
||||
|
||||
// copy children with replaced variable
|
||||
for(String variableValue : inOptions) {
|
||||
for (final String variableValue : inOptions) {
|
||||
if (WarpDriveConfig.LOGGING_WORLD_GENERATION) {
|
||||
WarpDrive.logger.info("Resolving for-loop with variable " + variableName + " = " + variableValue);
|
||||
}
|
||||
NodeList allChildren = root.getChildNodes();
|
||||
for(int childIndex = 0; childIndex < allChildren.getLength(); childIndex ++) {
|
||||
for (int childIndex = 0; childIndex < allChildren.getLength(); childIndex ++) {
|
||||
Node copy = copyNodeAndReplaceVariable(allChildren.item(childIndex), variableName, variableValue);
|
||||
root.getParentNode().appendChild(copy);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
String stringFrom = elementFor.getAttribute("from");
|
||||
String stringTo = elementFor.getAttribute("to");
|
||||
final String stringFrom = elementFor.getAttribute("from");
|
||||
final String stringTo = elementFor.getAttribute("to");
|
||||
|
||||
if (stringTo.isEmpty() || stringFrom.isEmpty()) {
|
||||
throw new InvalidXmlException("For element with no 'in' attribute requires both 'from' and 'to' attributes! " + variableName);
|
||||
|
@ -203,12 +203,12 @@ public class XmlPreprocessor {
|
|||
}
|
||||
|
||||
// then apply them
|
||||
for (String attr : nameToRemove) {
|
||||
attributes.removeNamedItem(attr);
|
||||
for (final String attribute : nameToRemove) {
|
||||
attributes.removeNamedItem(attribute);
|
||||
}
|
||||
|
||||
for (Attr attr : attrToAdd) {
|
||||
attributes.setNamedItem(attr);
|
||||
for (final Attr attribute : attrToAdd) {
|
||||
attributes.setNamedItem(attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ public class XmlPreprocessor {
|
|||
public String toString() {
|
||||
String string = (modResults.size() > 1 ? "{" : "");
|
||||
boolean isFirst = true;
|
||||
for (Entry<String, String> entry : modResults.entrySet()) {
|
||||
for (final Entry<String, String> entry : modResults.entrySet()) {
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
} else {
|
||||
|
|
|
@ -41,7 +41,7 @@ public abstract class AbstractStructure extends WorldGenerator implements IXmlRe
|
|||
public boolean loadFromXmlElement(final Element element) throws InvalidXmlException {
|
||||
|
||||
final List<Element> listVariables = XmlFileManager.getChildrenElementByTagName(element, "variable");
|
||||
for (Element elementVariable : listVariables) {
|
||||
for (final Element elementVariable : listVariables) {
|
||||
final String variableName = elementVariable.getAttribute("name");
|
||||
final String variableExpression = elementVariable.getTextContent();
|
||||
variables.put(variableName, variableExpression);
|
||||
|
|
|
@ -19,7 +19,7 @@ public abstract class AbstractStructureInstance extends WorldGenerator {
|
|||
this.structure = structure;
|
||||
|
||||
// evaluate variables
|
||||
for (Entry<String, String> entry : structure.variables.entrySet()) {
|
||||
for (final Entry<String, String> entry : structure.variables.entrySet()) {
|
||||
double value;
|
||||
String stringValue = entry.getValue();
|
||||
try {
|
||||
|
@ -45,7 +45,7 @@ public abstract class AbstractStructureInstance extends WorldGenerator {
|
|||
return valueOrExpression;
|
||||
}
|
||||
String result = valueOrExpression;
|
||||
for (Entry<String, Double> variable : variables.entrySet()) {
|
||||
for (final Entry<String, Double> variable : variables.entrySet()) {
|
||||
result = result.replaceAll(variable.getKey(), "" + variable.getValue());
|
||||
}
|
||||
return result;
|
||||
|
@ -59,9 +59,9 @@ public abstract class AbstractStructureInstance extends WorldGenerator {
|
|||
|
||||
// get variables values
|
||||
/*
|
||||
NBTTagCompound tagVariables = tag.getCompoundTag("wd_variables");
|
||||
NBTTagList names = tagVariables.getTagList("x", 0);
|
||||
for (Entry<String, Double> entry : tagVariables.getTagList("x", 0)) {
|
||||
final NBTTagCompound tagVariables = tag.getCompoundTag("wd_variables");
|
||||
final NBTTagList names = tagVariables.getTagList("x", 0);
|
||||
for (final Entry<String, Double> entry : tagVariables.getTagList("x", 0)) {
|
||||
tagVariables.setDouble(entry.getKey(), entry.getValue());
|
||||
}
|
||||
/**/
|
||||
|
@ -71,7 +71,7 @@ public abstract class AbstractStructureInstance extends WorldGenerator {
|
|||
tagCompound.setString("wd_structureGroup", structure.group);
|
||||
tagCompound.setString("wd_structureName", structure.name);
|
||||
final NBTTagCompound tagVariables = new NBTTagCompound();
|
||||
for (Entry<String, Double> entry : variables.entrySet()) {
|
||||
for (final Entry<String, Double> entry : variables.entrySet()) {
|
||||
tagVariables.setDouble(entry.getKey(), entry.getValue());
|
||||
}
|
||||
tagCompound.setTag("wd_variables", tagVariables);
|
||||
|
|
|
@ -79,11 +79,11 @@ public class MetaOrbInstance extends OrbInstance {
|
|||
private void addShell(final World world, final VectorI location, final int radius) {
|
||||
final double sqRadius = radius * radius;
|
||||
// iterate all blocks within cube with side 2 * radius
|
||||
for(int x = location.x - radius; x <= location.x + radius; x++) {
|
||||
for (int x = location.x - radius; x <= location.x + radius; x++) {
|
||||
final int dX2 = (x - location.x) * (x - location.x);
|
||||
for(int y = location.y - radius; y <= location.y + radius; y++) {
|
||||
for (int y = location.y - radius; y <= location.y + radius; y++) {
|
||||
final int dX2Y2 = dX2 + (y - location.y) * (y - location.y);
|
||||
for(int z = location.z - radius; z <= location.z + radius; z++) {
|
||||
for (int z = location.z - radius; z <= location.z + radius; z++) {
|
||||
// current radius
|
||||
final int sqRange = dX2Y2 + (location.z - z) * (location.z - z);
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class MetaOrbInstance extends OrbInstance {
|
|||
for (int index = 0; index < count; index++) {
|
||||
boolean found = false;
|
||||
|
||||
for(int step = 0; step < CORE_MAX_TRIES && !found; step++) {
|
||||
for (int step = 0; step < CORE_MAX_TRIES && !found; step++) {
|
||||
final VectorI location = new VectorI(
|
||||
(int)Math.round(xMin + diameter * random.nextDouble()),
|
||||
(int)Math.round(yMin + diameter * random.nextDouble()),
|
||||
|
|
|
@ -27,10 +27,10 @@ public class Orb extends AbstractStructure {
|
|||
public boolean loadFromXmlElement(Element element) throws InvalidXmlException {
|
||||
super.loadFromXmlElement(element);
|
||||
|
||||
List<Element> listShells = XmlFileManager.getChildrenElementByTagName(element, "shell");
|
||||
final List<Element> listShells = XmlFileManager.getChildrenElementByTagName(element, "shell");
|
||||
orbShells = new OrbShell[listShells.size()];
|
||||
int shellIndexOut = 0;
|
||||
for (Element elementShell : listShells) {
|
||||
for (final Element elementShell : listShells) {
|
||||
String orbShellName = elementShell.getAttribute("name");
|
||||
|
||||
orbShells[shellIndexOut] = new OrbShell(getFullName(), orbShellName);
|
||||
|
@ -43,7 +43,7 @@ public class Orb extends AbstractStructure {
|
|||
}
|
||||
}
|
||||
|
||||
List<Element> listSchematic = XmlFileManager.getChildrenElementByTagName(element, "schematic");
|
||||
final List<Element> listSchematic = XmlFileManager.getChildrenElementByTagName(element, "schematic");
|
||||
if (listSchematic.size() > 1) {
|
||||
WarpDrive.logger.error("Too many schematic defined, only first one will be used in structure " + getFullName());
|
||||
}
|
||||
|
@ -84,8 +84,8 @@ public class Orb extends AbstractStructure {
|
|||
super.loadFromXmlElement(element);
|
||||
|
||||
// resolve static imports
|
||||
for (String importGroupName : getImportGroupNames()) {
|
||||
GenericSet<Filler> fillerSet = WarpDriveConfig.FillerManager.getGenericSet(importGroupName);
|
||||
for (final String importGroupName : getImportGroupNames()) {
|
||||
final GenericSet<Filler> fillerSet = WarpDriveConfig.FillerManager.getGenericSet(importGroupName);
|
||||
if (fillerSet == null) {
|
||||
WarpDrive.logger.warn("Skipping missing FillerSet " + importGroupName + " in shell " + parentFullName + ":" + name);
|
||||
} else {
|
||||
|
@ -94,7 +94,7 @@ public class Orb extends AbstractStructure {
|
|||
}
|
||||
|
||||
// validate dynamic imports
|
||||
for (String importGroup : getImportGroups()) {
|
||||
for (final String importGroup : getImportGroups()) {
|
||||
if (!WarpDriveConfig.FillerManager.doesGroupExist(importGroup)) {
|
||||
WarpDrive.logger.warn("An invalid FillerSet group " + importGroup + " is referenced in shell " + parentFullName + ":" + name);
|
||||
}
|
||||
|
@ -121,12 +121,12 @@ public class Orb extends AbstractStructure {
|
|||
}
|
||||
|
||||
public OrbShell instantiate(Random random) {
|
||||
OrbShell orbShell = new OrbShell(parentFullName, name);
|
||||
final OrbShell orbShell = new OrbShell(parentFullName, name);
|
||||
orbShell.minThickness = minThickness;
|
||||
orbShell.maxThickness = maxThickness;
|
||||
try {
|
||||
orbShell.loadFrom(this);
|
||||
for (String importGroup : getImportGroups()) {
|
||||
for (final String importGroup : getImportGroups()) {
|
||||
GenericSet<Filler> fillerSet = WarpDriveConfig.FillerManager.getRandomSetFromGroup(random, importGroup);
|
||||
if (fillerSet == null) {
|
||||
WarpDrive.logger.info("Ignoring invalid group " + importGroup + " in shell " + name + " of structure " + parentFullName);
|
||||
|
|
|
@ -29,7 +29,7 @@ public class OrbInstance extends AbstractStructureInstance {
|
|||
totalThickness = 0;
|
||||
minThickness = 0;
|
||||
int orbShellIndexOut = 0;
|
||||
for(int orbShellIndexIn = 0; orbShellIndexIn < orb.orbShells.length; orbShellIndexIn++) {
|
||||
for (int orbShellIndexIn = 0; orbShellIndexIn < orb.orbShells.length; orbShellIndexIn++) {
|
||||
OrbShell orbShell = orb.orbShells[orbShellIndexIn].instantiate(random);
|
||||
if (orbShell != null) {
|
||||
orbShells[orbShellIndexOut] = orbShell;
|
||||
|
@ -42,7 +42,7 @@ public class OrbInstance extends AbstractStructureInstance {
|
|||
}
|
||||
|
||||
sqRadiusToOrbShell = new OrbShell[totalThickness * totalThickness];
|
||||
for(int sqRadius = 0; sqRadius < sqRadiusToOrbShell.length; sqRadius++) {
|
||||
for (int sqRadius = 0; sqRadius < sqRadiusToOrbShell.length; sqRadius++) {
|
||||
int cumulatedRange = 0;
|
||||
for (int shellIndex = 0; shellIndex < orbShells.length; shellIndex++) {
|
||||
cumulatedRange += orbShellThicknesses[shellIndex];
|
||||
|
|
|
@ -31,7 +31,7 @@ public class StructureManager extends XmlFileManager {
|
|||
structuresByGroup = new HashMap<>();
|
||||
INSTANCE.load(dir, "structure", "structure");
|
||||
|
||||
for (String group : REQUIRED_GROUPS) {
|
||||
for (final String group : REQUIRED_GROUPS) {
|
||||
if (!structuresByGroup.containsKey(group)) {
|
||||
WarpDrive.logger.error("Error: no structure defined for mandatory group " + group);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class FMLLoadingPlugin implements IFMLLoadingPlugin, IFMLCallHook {
|
|||
location = (File) data.get("coremodLocation");
|
||||
if (debugLog) {
|
||||
logger.info("injectData:");
|
||||
for (Entry<String, Object> entry : data.entrySet()) {
|
||||
for (final Entry<String, Object> entry : data.entrySet()) {
|
||||
logger.info("- " + entry.getKey() + " = " + entry.getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class DamageIrradiation extends DamageSource {
|
|||
v3Position.x + radius, v3Position.y + radius, v3Position.z + radius);
|
||||
final List<EntityLivingBase> listEntityLivingBase = world.getEntitiesWithinAABB(EntityLivingBase.class, axisAlignedBB);
|
||||
if (listEntityLivingBase != null) {
|
||||
for (EntityLivingBase entityLivingBase : listEntityLivingBase) {
|
||||
for (final EntityLivingBase entityLivingBase : listEntityLivingBase) {
|
||||
// cap damage below 1 m distance, since the entity is never really inside the source and damage tends to +INF
|
||||
final float distance = Math.min(1.0F, (float) Math.sqrt(v3Position.distanceTo_square(entityLivingBase)));
|
||||
onEntityEffect(strength / (distance * distance), world, v3Position, entityLivingBase);
|
||||
|
|
|
@ -84,7 +84,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
energy_maxStorage = 0;
|
||||
} else {
|
||||
int maxStorage = 0;
|
||||
for(TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
for (final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
maxStorage += tileEntityEnergyBank.energy_getMaxStorage();
|
||||
}
|
||||
energy_maxStorage = maxStorage;
|
||||
|
@ -195,7 +195,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
WarpDrive.blockVoidShellPlain,
|
||||
WarpDrive.blockVoidShellGlass);
|
||||
TrajectoryPoint trajectoryPoint = null;
|
||||
for(ForgeDirection direction : Commons.HORIZONTAL_DIRECTIONS) {
|
||||
for (ForgeDirection direction : Commons.HORIZONTAL_DIRECTIONS) {
|
||||
final VectorI next = firstVoidShell.clone(direction);
|
||||
if (whitelist.contains(next.getBlock_noChunkLoading(world))) {
|
||||
trajectoryPoint = new TrajectoryPoint(world, firstVoidShell.translate(direction), direction);
|
||||
|
@ -221,7 +221,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
HashSet<TrajectoryPoint> transferToAdd = new HashSet<>();
|
||||
while(!acceleratorToAdd.isEmpty()) {
|
||||
// add all accelerators found
|
||||
for (TrajectoryPoint trajectoryToAdd : acceleratorToAdd) {
|
||||
for (final TrajectoryPoint trajectoryToAdd : acceleratorToAdd) {
|
||||
trajectoryPoint = trajectoryToAdd;
|
||||
while ( trajectoryPoint.hasNoMissingVoidShells()
|
||||
&& isInRange(trajectoryPoint)
|
||||
|
@ -243,7 +243,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
acceleratorToAdd.clear();
|
||||
|
||||
// add all transfer found
|
||||
for (TrajectoryPoint trajectoryToAdd : transferToAdd) {
|
||||
for (final TrajectoryPoint trajectoryToAdd : transferToAdd) {
|
||||
trajectoryPoint = trajectoryToAdd;
|
||||
while ( trajectoryPoint.hasNoMissingVoidShells()
|
||||
&& isInRange(trajectoryPoint)
|
||||
|
@ -490,7 +490,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
if (trajectoryAccelerator == null) {
|
||||
return false;
|
||||
}
|
||||
for(final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
for (final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
if (tileEntityEnergyBank.isInvalid()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
// Pseudo-API for energy
|
||||
public int energy_getEnergyStored() {
|
||||
int energyStored = 0;
|
||||
for(final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
for (final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
energyStored += tileEntityEnergyBank.energy_getEnergyStored();
|
||||
}
|
||||
return energyStored;
|
||||
|
@ -509,7 +509,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
|
||||
public int energy_getPotentialOutput() {
|
||||
long potentialOutput = 0;
|
||||
for(final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
for (final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
potentialOutput = Math.min(potentialOutput + tileEntityEnergyBank.energy_getPotentialOutput(), Integer.MAX_VALUE);
|
||||
}
|
||||
return (int) potentialOutput;
|
||||
|
@ -525,7 +525,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
int energyConsumed = 0;
|
||||
int energyLeft = amount_internal - energyMean * energyBanks.size();
|
||||
assert(energyConsumed + energyLeft == amount_internal);
|
||||
for(final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
for (final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
final int energyToConsume = Math.min(tileEntityEnergyBank.energy_getPotentialOutput(), energyMean + energyLeft);
|
||||
tileEntityEnergyBank.energy_consume(energyToConsume);
|
||||
energyConsumed += energyToConsume;
|
||||
|
@ -534,7 +534,7 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
assert(energyConsumed + energyLeft == amount_internal);
|
||||
// then, draw remaining in no special order
|
||||
if (energyLeft > 0) {
|
||||
for(final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
for (final TileEntityEnergyBank tileEntityEnergyBank : energyBanks) {
|
||||
final int energyToConsume = Math.min(tileEntityEnergyBank.energy_getPotentialOutput(), energyLeft);
|
||||
tileEntityEnergyBank.energy_consume(energyToConsume);
|
||||
energyConsumed += energyToConsume;
|
||||
|
|
|
@ -17,12 +17,12 @@ public class CamerasRegistry {
|
|||
registry = new LinkedList<>();
|
||||
}
|
||||
|
||||
public CameraRegistryItem getCameraByVideoChannel(World world, int videoChannel) {
|
||||
public CameraRegistryItem getCameraByVideoChannel(final World world, final int videoChannel) {
|
||||
if (world == null) {
|
||||
return null;
|
||||
}
|
||||
CameraRegistryItem cam;
|
||||
for (Iterator<CameraRegistryItem> it = registry.iterator(); it.hasNext();) {
|
||||
for (final Iterator<CameraRegistryItem> it = registry.iterator(); it.hasNext();) {
|
||||
cam = it.next();
|
||||
if (cam.videoChannel == videoChannel && cam.dimensionId == world.provider.dimensionId) {
|
||||
if (isCamAlive(world, cam)) {
|
||||
|
@ -42,9 +42,9 @@ public class CamerasRegistry {
|
|||
return null;
|
||||
}
|
||||
|
||||
private CameraRegistryItem getCamByPosition(World world, ChunkPosition position) {
|
||||
private CameraRegistryItem getCamByPosition(final World world, final ChunkPosition position) {
|
||||
CameraRegistryItem cam;
|
||||
for (Iterator<CameraRegistryItem> it = registry.iterator(); it.hasNext();) {
|
||||
for (final Iterator<CameraRegistryItem> it = registry.iterator(); it.hasNext();) {
|
||||
cam = it.next();
|
||||
if (cam.position.chunkPosX == position.chunkPosX && cam.position.chunkPosY == position.chunkPosY && cam.position.chunkPosZ == position.chunkPosZ
|
||||
&& cam.dimensionId == world.provider.dimensionId) {
|
||||
|
@ -55,7 +55,7 @@ public class CamerasRegistry {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static boolean isCamAlive(World world, CameraRegistryItem cam) {
|
||||
private static boolean isCamAlive(final World world, final CameraRegistryItem cam) {
|
||||
if (world.provider.dimensionId != cam.dimensionId) {
|
||||
WarpDrive.logger.error("Inconsistent worldObj with camera " + world.provider.dimensionId + " vs " + cam.dimensionId);
|
||||
return false;
|
||||
|
@ -80,11 +80,11 @@ public class CamerasRegistry {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void removeDeadCams(World world) {
|
||||
private void removeDeadCams(final World world) {
|
||||
// LocalProfiler.start("CamRegistry Removing dead cameras");
|
||||
|
||||
CameraRegistryItem cam;
|
||||
for (Iterator<CameraRegistryItem> it = registry.iterator(); it.hasNext();) {
|
||||
for (final Iterator<CameraRegistryItem> it = registry.iterator(); it.hasNext();) {
|
||||
cam = it.next();
|
||||
if (!isCamAlive(world, cam)) {
|
||||
if (WarpDriveConfig.LOGGING_VIDEO_CHANNEL) {
|
||||
|
@ -98,8 +98,8 @@ public class CamerasRegistry {
|
|||
// LocalProfiler.stop();
|
||||
}
|
||||
|
||||
public void removeFromRegistry(World world, ChunkPosition position) {
|
||||
CameraRegistryItem cam = getCamByPosition(world, position);
|
||||
public void removeFromRegistry(final World world, final ChunkPosition position) {
|
||||
final CameraRegistryItem cam = getCamByPosition(world, position);
|
||||
if (cam != null) {
|
||||
if (WarpDriveConfig.LOGGING_VIDEO_CHANNEL) {
|
||||
WarpDrive.logger.info("Removing camera by request in dimension " + cam.dimensionId + " at "
|
||||
|
@ -109,12 +109,12 @@ public class CamerasRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateInRegistry(World world, ChunkPosition position, int videoChannel, EnumCameraType enumCameraType) {
|
||||
CameraRegistryItem cam = new CameraRegistryItem(world, position, videoChannel, enumCameraType);
|
||||
public void updateInRegistry(final World world, final ChunkPosition position, final int videoChannel, final EnumCameraType enumCameraType) {
|
||||
final CameraRegistryItem cam = new CameraRegistryItem(world, position, videoChannel, enumCameraType);
|
||||
removeDeadCams(world);
|
||||
|
||||
if (isCamAlive(world, cam)) {
|
||||
CameraRegistryItem existingCam = getCamByPosition(world, cam.position);
|
||||
final CameraRegistryItem existingCam = getCamByPosition(world, cam.position);
|
||||
if (existingCam == null) {
|
||||
if (WarpDriveConfig.LOGGING_VIDEO_CHANNEL) {
|
||||
WarpDrive.logger.info("Adding 'live' camera at "
|
||||
|
@ -143,7 +143,7 @@ public class CamerasRegistry {
|
|||
}
|
||||
WarpDrive.logger.info("Cameras registry for dimension " + world.provider.dimensionId + ":");
|
||||
|
||||
for (CameraRegistryItem cam : registry) {
|
||||
for (final CameraRegistryItem cam : registry) {
|
||||
WarpDrive.logger.info("- " + cam.videoChannel + " (" + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ + ")");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ public class CelestialObject implements Cloneable, IStringSerializable, ICelesti
|
|||
final NBTTagList nbtTagListRenderData = nbtTagCompound.getTagList("renderData", NBT.TAG_COMPOUND);
|
||||
final int countRender = nbtTagListRenderData.tagCount();
|
||||
setRenderData = new LinkedHashSet<>(countRender);
|
||||
for(int indexRenderData = 0; indexRenderData < countRender; indexRenderData++) {
|
||||
for (int indexRenderData = 0; indexRenderData < countRender; indexRenderData++) {
|
||||
final NBTTagCompound tagCompoundRenderData = nbtTagListRenderData.getCompoundTagAt(indexRenderData);
|
||||
setRenderData.add(new RenderData(tagCompoundRenderData));
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ public class CelestialObject implements Cloneable, IStringSerializable, ICelesti
|
|||
nbtTagCompound.setTag("factorFog", factorFog.writeToNBT(new NBTTagCompound()));
|
||||
|
||||
final NBTTagList nbtTagListRenderData = new NBTTagList();
|
||||
for(final RenderData renderData : setRenderData) {
|
||||
for (final RenderData renderData : setRenderData) {
|
||||
nbtTagListRenderData.appendTag(renderData.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
nbtTagCompound.setTag("renderData", nbtTagListRenderData);
|
||||
|
|
|
@ -98,7 +98,7 @@ public class CelestialObjectManager extends XmlFileManager {
|
|||
|
||||
public static void onFMLInitialization() {
|
||||
// only create dimensions if we own them
|
||||
for (CelestialObject celestialObject : SERVER.celestialObjects) {
|
||||
for (final CelestialObject celestialObject : SERVER.celestialObjects) {
|
||||
if (!celestialObject.isVirtual()) {
|
||||
switch (celestialObject.provider) {
|
||||
case CelestialObject.PROVIDER_SPACE:
|
||||
|
@ -201,7 +201,7 @@ public class CelestialObjectManager extends XmlFileManager {
|
|||
final int count = celestialObjectsById.size();
|
||||
celestialObjects = new CelestialObject[count];
|
||||
int index = 0;
|
||||
for (CelestialObject celestialObject : celestialObjectsById.values()) {
|
||||
for (final CelestialObject celestialObject : celestialObjectsById.values()) {
|
||||
celestialObjects[index++] = celestialObject;
|
||||
celestialObject.resolveParent(celestialObjectsById.get(celestialObject.parentId));
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ public enum EnumCameraType {
|
|||
|
||||
static {
|
||||
length = EnumCameraType.values().length;
|
||||
for (EnumCameraType enumCameraType : values()) {
|
||||
ID_MAP.put(enumCameraType.ordinal(), enumCameraType);
|
||||
for (final EnumCameraType cameraType : values()) {
|
||||
ID_MAP.put(cameraType.ordinal(), cameraType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ public enum EnumComponentType {
|
|||
|
||||
static {
|
||||
length = EnumComponentType.values().length;
|
||||
for (EnumComponentType enumComponentType : values()) {
|
||||
ID_MAP.put(enumComponentType.ordinal(), enumComponentType);
|
||||
for (final EnumComponentType componentType : values()) {
|
||||
ID_MAP.put(componentType.ordinal(), componentType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ public enum EnumDecorativeType {
|
|||
|
||||
static {
|
||||
length = EnumDecorativeType.values().length;
|
||||
for (EnumDecorativeType componentType : values()) {
|
||||
ID_MAP.put(componentType.ordinal(), componentType);
|
||||
for (final EnumDecorativeType decorativeType : values()) {
|
||||
ID_MAP.put(decorativeType.ordinal(), decorativeType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ public enum EnumForceFieldShape implements IForceFieldShape {
|
|||
|
||||
static {
|
||||
length = EnumForceFieldShape.values().length;
|
||||
for (EnumForceFieldShape enumForceFieldShape : values()) {
|
||||
ID_MAP.put(enumForceFieldShape.ordinal(), enumForceFieldShape);
|
||||
for (final EnumForceFieldShape forceFieldShape : values()) {
|
||||
ID_MAP.put(forceFieldShape.ordinal(), forceFieldShape);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ public enum EnumForceFieldUpgrade implements IForceFieldUpgrade, IForceFieldUpgr
|
|||
|
||||
static {
|
||||
length = EnumForceFieldUpgrade.values().length;
|
||||
for (EnumForceFieldUpgrade forceFieldShapeType : values()) {
|
||||
ID_MAP.put(forceFieldShapeType.ordinal(), forceFieldShapeType);
|
||||
for (final EnumForceFieldUpgrade forceFieldUpgrade : values()) {
|
||||
ID_MAP.put(forceFieldUpgrade.ordinal(), forceFieldUpgrade);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ public enum EnumHullPlainType {
|
|||
|
||||
static {
|
||||
length = EnumHullPlainType.values().length;
|
||||
for (EnumHullPlainType enumComponentType : values()) {
|
||||
ID_MAP.put(enumComponentType.ordinal(), enumComponentType);
|
||||
for (final EnumHullPlainType hullPlainType : values()) {
|
||||
ID_MAP.put(hullPlainType.ordinal(), hullPlainType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ public enum EnumLiftMode implements IStringSerializable {
|
|||
|
||||
static {
|
||||
length = EnumLiftMode.values().length;
|
||||
for (EnumLiftMode componentType : values()) {
|
||||
ID_MAP.put(componentType.ordinal(), componentType);
|
||||
for (final EnumLiftMode liftMode : values()) {
|
||||
ID_MAP.put(liftMode.ordinal(), liftMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ public enum EnumPermissionNode {
|
|||
|
||||
static {
|
||||
length = EnumPermissionNode.values().length;
|
||||
for (EnumPermissionNode enumPermissionNode : values()) {
|
||||
ID_MAP.put(enumPermissionNode.ordinal(), enumPermissionNode);
|
||||
for (final EnumPermissionNode permissionNode : values()) {
|
||||
ID_MAP.put(permissionNode.ordinal(), permissionNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ public enum EnumReactorReleaseMode implements IStringSerializable {
|
|||
|
||||
static {
|
||||
length = EnumReactorReleaseMode.values().length;
|
||||
for (EnumReactorReleaseMode componentType : values()) {
|
||||
ID_MAP.put(componentType.ordinal(), componentType);
|
||||
for (final EnumReactorReleaseMode reactorReleaseMode : values()) {
|
||||
ID_MAP.put(reactorReleaseMode.ordinal(), reactorReleaseMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public enum EnumShipCoreState implements IStringSerializable {
|
|||
|
||||
static {
|
||||
length = EnumShipCoreState.values().length;
|
||||
for (EnumShipCoreState shipCoreState : values()) {
|
||||
for (final EnumShipCoreState shipCoreState : values()) {
|
||||
ID_MAP.put(shipCoreState.ordinal(), shipCoreState);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ public enum EnumShipMovementType implements IStringSerializable {
|
|||
|
||||
static {
|
||||
length = EnumShipMovementType.values().length;
|
||||
for (EnumShipMovementType componentType : values()) {
|
||||
ID_MAP.put(componentType.ordinal(), componentType);
|
||||
for (final EnumShipMovementType shipMovementType : values()) {
|
||||
ID_MAP.put(shipMovementType.ordinal(), shipMovementType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ public enum EnumShipScannerState implements IStringSerializable {
|
|||
|
||||
static {
|
||||
length = EnumShipScannerState.values().length;
|
||||
for (EnumShipScannerState shipCoreState : values()) {
|
||||
ID_MAP.put(shipCoreState.ordinal(), shipCoreState);
|
||||
for (final EnumShipScannerState shipScannerState : values()) {
|
||||
ID_MAP.put(shipScannerState.ordinal(), shipScannerState);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,11 +42,11 @@ public enum EnumTooltipCondition implements IStringSerializable {
|
|||
|
||||
public static String formatAllValues() {
|
||||
final StringBuilder result = new StringBuilder();
|
||||
for (EnumTooltipCondition enumTooltipCondition : EnumTooltipCondition.values()) {
|
||||
for (final EnumTooltipCondition tooltipCondition : EnumTooltipCondition.values()) {
|
||||
if (result.length() > 0) {
|
||||
result.append(", ");
|
||||
}
|
||||
result.append(enumTooltipCondition);
|
||||
result.append(tooltipCondition);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
|
|
@ -85,12 +85,12 @@ public class ForceFieldRegistry {
|
|||
|
||||
// find all relays in that network
|
||||
Set<TileEntity> setToIterateNext;
|
||||
Set<TileEntity> setRelaysInRange = new HashSet<>();
|
||||
final Set<TileEntity> setRelaysInRange = new HashSet<>();
|
||||
while(!setToIterate.isEmpty()) {
|
||||
setToIterateNext = new HashSet<>();
|
||||
for (TileEntity tileEntityCurrent : setToIterate) {
|
||||
for (final TileEntity tileEntityCurrent : setToIterate) {
|
||||
setRelaysInRange.add(tileEntityCurrent);
|
||||
for (TileEntity tileEntityEntry : setRelays) {
|
||||
for (final TileEntity tileEntityEntry : setRelays) {
|
||||
if (!setRelaysInRange.contains(tileEntityEntry) && !setToIterate.contains(tileEntityEntry) && !setToIterateNext.contains(tileEntityEntry)) {
|
||||
range2 = (tileEntityCurrent.xCoord - tileEntityEntry.xCoord) * (tileEntityCurrent.xCoord - tileEntityEntry.xCoord)
|
||||
+ (tileEntityCurrent.yCoord - tileEntityEntry.yCoord) * (tileEntityCurrent.yCoord - tileEntityEntry.yCoord)
|
||||
|
@ -105,9 +105,9 @@ public class ForceFieldRegistry {
|
|||
}
|
||||
|
||||
// find all non-relays in range of that network
|
||||
Set<TileEntity> setEntries = new HashSet<>();
|
||||
for (TileEntity tileEntityRelayInRange : setRelaysInRange) {
|
||||
for (TileEntity tileEntityEntry : setNonRelays) {
|
||||
final Set<TileEntity> setEntries = new HashSet<>();
|
||||
for (final TileEntity tileEntityRelayInRange : setRelaysInRange) {
|
||||
for (final TileEntity tileEntityEntry : setNonRelays) {
|
||||
if (!setEntries.contains(tileEntityEntry)) {
|
||||
range2 = (tileEntityRelayInRange.xCoord - tileEntityEntry.xCoord) * (tileEntityRelayInRange.xCoord - tileEntityEntry.xCoord)
|
||||
+ (tileEntityRelayInRange.yCoord - tileEntityEntry.yCoord) * (tileEntityRelayInRange.yCoord - tileEntityEntry.yCoord)
|
||||
|
@ -145,16 +145,16 @@ public class ForceFieldRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
public static void removeFromRegistry(IBeamFrequency tileEntity) {
|
||||
public static void removeFromRegistry(final IBeamFrequency tileEntity) {
|
||||
assert(tileEntity instanceof TileEntity);
|
||||
|
||||
countRead++;
|
||||
Set<GlobalPosition> setGlobalPositions = registry.get(tileEntity.getBeamFrequency());
|
||||
final Set<GlobalPosition> setGlobalPositions = registry.get(tileEntity.getBeamFrequency());
|
||||
if (setGlobalPositions == null) {
|
||||
// noting to remove
|
||||
return;
|
||||
}
|
||||
for (Iterator<GlobalPosition> iterator = setGlobalPositions.iterator(); iterator.hasNext();) {
|
||||
for (final Iterator<GlobalPosition> iterator = setGlobalPositions.iterator(); iterator.hasNext();) {
|
||||
GlobalPosition globalPosition = iterator.next();
|
||||
if (globalPosition.equals(tileEntity)) {
|
||||
// found it, remove and exit
|
||||
|
@ -169,7 +169,7 @@ public class ForceFieldRegistry {
|
|||
public static void printRegistry(final String trigger) {
|
||||
WarpDrive.logger.info("Forcefield registry (" + registry.size() + " entries after " + trigger + "):");
|
||||
|
||||
for (Map.Entry<Integer, CopyOnWriteArraySet<GlobalPosition>> entry : registry.entrySet()) {
|
||||
for (final Map.Entry<Integer, CopyOnWriteArraySet<GlobalPosition>> entry : registry.entrySet()) {
|
||||
String message = "";
|
||||
for (GlobalPosition globalPosition : entry.getValue()) {
|
||||
if (!message.isEmpty()) {
|
||||
|
|
|
@ -143,14 +143,14 @@ public class ForceFieldSetup extends GlobalPosition {
|
|||
Vector3 v3Max = new Vector3( 1.0D, 1.0D, 1.0D);
|
||||
Vector3 v3Translation = new Vector3(0.0D, 0.0D, 0.0D);
|
||||
|
||||
for (TileEntity tileEntity : tileEntities) {
|
||||
for (final TileEntity tileEntity : tileEntities) {
|
||||
// only consider same dimension
|
||||
if (tileEntity.getWorldObj() == null || tileEntity.getWorldObj().provider.dimensionId != dimensionId) {
|
||||
continue;
|
||||
}
|
||||
// projectors
|
||||
if (tileEntity instanceof TileEntityForceFieldProjector) {
|
||||
TileEntityForceFieldProjector projector = (TileEntityForceFieldProjector) tileEntity;
|
||||
final TileEntityForceFieldProjector projector = (TileEntityForceFieldProjector) tileEntity;
|
||||
if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) {
|
||||
shapeProvider = projector.getShapeProvider();
|
||||
isDoubleSided = projector.isDoubleSided;
|
||||
|
@ -161,9 +161,9 @@ public class ForceFieldSetup extends GlobalPosition {
|
|||
v3Min = projector.getMin();
|
||||
v3Max = projector.getMax();
|
||||
v3Translation = projector.getTranslation();
|
||||
for (Entry<Object, Integer> entry : projector.getUpgradesOfType(null).entrySet()) {
|
||||
for (final Entry<Object, Integer> entry : projector.getUpgradesOfType(null).entrySet()) {
|
||||
if (entry.getKey() instanceof IForceFieldUpgrade) {
|
||||
IForceFieldUpgradeEffector upgradeEffector = ((IForceFieldUpgrade)entry.getKey()).getUpgradeEffector();
|
||||
final IForceFieldUpgradeEffector upgradeEffector = ((IForceFieldUpgrade)entry.getKey()).getUpgradeEffector();
|
||||
if (upgradeEffector != null) {
|
||||
Float currentValue = upgradeValues.get(upgradeEffector);
|
||||
if (currentValue == null) {
|
||||
|
@ -231,7 +231,7 @@ public class ForceFieldSetup extends GlobalPosition {
|
|||
|
||||
// apply scaling
|
||||
float speedRatio;
|
||||
for (Map.Entry<IForceFieldUpgradeEffector, Float> entry : upgradeValues.entrySet()) {
|
||||
for (final Map.Entry<IForceFieldUpgradeEffector, Float> entry : upgradeValues.entrySet()) {
|
||||
float scaledValue = entry.getKey().getScaledValue(1.0F, entry.getValue());
|
||||
if (scaledValue != 0.0F) {
|
||||
upgrades.put(entry.getKey(), scaledValue);
|
||||
|
@ -298,12 +298,12 @@ public class ForceFieldSetup extends GlobalPosition {
|
|||
return entityEnergyCost * FORCEFIELD_MAX_FACTOR_ENTITY_COST * Math.exp(FORCEFIELD_TAU_FACTOR_ENTITY_COST / countEntityInteractions);
|
||||
}
|
||||
|
||||
public int onEntityEffect(World world, final int blockX, final int blockY, final int blockZ, Entity entity) {
|
||||
public int onEntityEffect(final World world, final int blockX, final int blockY, final int blockZ, Entity entity) {
|
||||
int countdown = 0;
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
final TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityForceFieldProjector) {
|
||||
if (((TileEntityForceFieldProjector)tileEntity).onEntityInteracted(entity.getUniqueID())) {
|
||||
for (Map.Entry<IForceFieldUpgradeEffector, Float> entry : upgrades.entrySet()) {
|
||||
for (final Map.Entry<IForceFieldUpgradeEffector, Float> entry : upgrades.entrySet()) {
|
||||
Float value = entry.getValue();
|
||||
if (entry.getKey() == EnumForceFieldUpgrade.COOLING || entry.getKey() == EnumForceFieldUpgrade.HEATING) {
|
||||
value = temperatureLevel;
|
||||
|
|
|
@ -79,7 +79,7 @@ public class JumpBlock {
|
|||
this.z = z;
|
||||
|
||||
// save externals
|
||||
for (Entry<String, IBlockTransformer> entryBlockTransformer : WarpDriveConfig.blockTransformers.entrySet()) {
|
||||
for (final Entry<String, IBlockTransformer> entryBlockTransformer : WarpDriveConfig.blockTransformers.entrySet()) {
|
||||
if (entryBlockTransformer.getValue().isApplicable(block, blockMeta, tileEntity)) {
|
||||
final NBTBase nbtBase = entryBlockTransformer.getValue().saveExternals(world, x, y, z, block, blockMeta, tileEntity);
|
||||
// (we always save, even if null as a reminder on which transformer applies to this block)
|
||||
|
@ -237,7 +237,7 @@ public class JumpBlock {
|
|||
}
|
||||
int newBlockMeta = blockMeta;
|
||||
if (externals != null) {
|
||||
for (Entry<String, NBTBase> external : externals.entrySet()) {
|
||||
for (final Entry<String, NBTBase> external : externals.entrySet()) {
|
||||
IBlockTransformer blockTransformer = WarpDriveConfig.blockTransformers.get(external.getKey());
|
||||
if (blockTransformer != null) {
|
||||
newBlockMeta = blockTransformer.rotate(block, blockMeta, nbtToDeploy, transformation);
|
||||
|
@ -246,7 +246,7 @@ public class JumpBlock {
|
|||
} else {
|
||||
newBlockMeta = getMetadataRotation(nbtToDeploy, transformation.getRotationSteps());
|
||||
}
|
||||
ChunkCoordinates target = transformation.apply(x, y, z);
|
||||
final ChunkCoordinates target = transformation.apply(x, y, z);
|
||||
setBlockNoLight(targetWorld, target.posX, target.posY, target.posZ, block, newBlockMeta, 2);
|
||||
|
||||
// Re-schedule air blocks update
|
||||
|
@ -390,7 +390,7 @@ public class JumpBlock {
|
|||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Tile has " + fields.size() + " networked fields: " + fields);
|
||||
}
|
||||
for (String field : fields) {
|
||||
for (final String field : fields) {
|
||||
NetworkHelper_updateTileEntityField(tileEntity, field);
|
||||
}
|
||||
} catch (NoSuchMethodException exception) {
|
||||
|
@ -467,8 +467,8 @@ public class JumpBlock {
|
|||
tagCompound.setInteger("y", y);
|
||||
tagCompound.setInteger("z", z);
|
||||
if (externals != null && !externals.isEmpty()) {
|
||||
NBTTagCompound tagCompoundExternals = new NBTTagCompound();
|
||||
for (Entry<String, NBTBase> entry : externals.entrySet()) {
|
||||
final NBTTagCompound tagCompoundExternals = new NBTTagCompound();
|
||||
for (final Entry<String, NBTBase> entry : externals.entrySet()) {
|
||||
if (entry.getValue() == null) {
|
||||
tagCompoundExternals.setString(entry.getKey(), "");
|
||||
} else {
|
||||
|
|
|
@ -145,7 +145,7 @@ public class JumpShip {
|
|||
}
|
||||
|
||||
WarpDrive.logger.info(this + " messageToAllPlayersOnShip: " + message);
|
||||
for (MovingEntity movingEntity : entitiesOnShip) {
|
||||
for (final MovingEntity movingEntity : entitiesOnShip) {
|
||||
final Entity entity = movingEntity.getEntity();
|
||||
if (entity instanceof EntityPlayer) {
|
||||
Commons.addChatMessage((EntityPlayer) entity, messageFormatted);
|
||||
|
@ -166,7 +166,7 @@ public class JumpShip {
|
|||
|
||||
final List<Entity> list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
|
||||
|
||||
for (Entity entity : list) {
|
||||
for (final Entity entity : list) {
|
||||
if (entity == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -334,10 +334,10 @@ public class JumpShip {
|
|||
|
||||
final int blockMeta = worldObj.getBlockMetadata(x, y, z);
|
||||
final TileEntity tileEntity = worldObj.getTileEntity(x, y, z);
|
||||
JumpBlock jumpBlock = new JumpBlock(worldObj, x, y, z, block, blockMeta, tileEntity);
|
||||
final JumpBlock jumpBlock = new JumpBlock(worldObj, x, y, z, block, blockMeta, tileEntity);
|
||||
|
||||
if (jumpBlock.blockTileEntity != null && jumpBlock.externals != null) {
|
||||
for (Entry<String, NBTBase> external : jumpBlock.externals.entrySet()) {
|
||||
for (final Entry<String, NBTBase> external : jumpBlock.externals.entrySet()) {
|
||||
IBlockTransformer blockTransformer = WarpDriveConfig.blockTransformers.get(external.getKey());
|
||||
if (blockTransformer != null) {
|
||||
if (!blockTransformer.isJumpReady(jumpBlock.block, jumpBlock.blockMeta, jumpBlock.blockTileEntity, reason)) {
|
||||
|
@ -410,7 +410,7 @@ public class JumpShip {
|
|||
actualMass = tagCompound.getInteger("actualMass");
|
||||
final NBTTagList tagList = tagCompound.getTagList("jumpBlocks", Constants.NBT.TAG_COMPOUND);
|
||||
jumpBlocks = new JumpBlock[tagList.tagCount()];
|
||||
for(int index = 0; index < tagList.tagCount(); index++) {
|
||||
for (int index = 0; index < tagList.tagCount(); index++) {
|
||||
jumpBlocks[index] = new JumpBlock();
|
||||
jumpBlocks[index].readFromNBT(tagList.getCompoundTagAt(index));
|
||||
}
|
||||
|
|
|
@ -257,8 +257,8 @@ public class StarMapRegistry {
|
|||
tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
// printRegistry();
|
||||
int radius2 = radius * radius;
|
||||
for (Map.Entry<Integer, CopyOnWriteArraySet<StarMapRegistryItem>> entryDimension : registry.entrySet()) {
|
||||
for (StarMapRegistryItem starMapRegistryItem : entryDimension.getValue()) {
|
||||
for (final Map.Entry<Integer, CopyOnWriteArraySet<StarMapRegistryItem>> entryDimension : registry.entrySet()) {
|
||||
for (final StarMapRegistryItem starMapRegistryItem : entryDimension.getValue()) {
|
||||
if (starMapRegistryItem.type == EnumStarMapEntryType.ACCELERATOR) {
|
||||
continue;
|
||||
}
|
||||
|
@ -310,9 +310,9 @@ public class StarMapRegistry {
|
|||
public void printRegistry(final String trigger) {
|
||||
WarpDrive.logger.info("Starmap registry (" + registry.size() + " entries after " + trigger + "):");
|
||||
|
||||
for (Map.Entry<Integer, CopyOnWriteArraySet<StarMapRegistryItem>> entryDimension : registry.entrySet()) {
|
||||
for (final Map.Entry<Integer, CopyOnWriteArraySet<StarMapRegistryItem>> entryDimension : registry.entrySet()) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
for (StarMapRegistryItem registryItem : entryDimension.getValue()) {
|
||||
for (final StarMapRegistryItem registryItem : entryDimension.getValue()) {
|
||||
message.append(String.format("\n- %s '%s' @ DIM%d (%d %d %d) with %.3f isolation rate",
|
||||
registryItem.type, registryItem.name,
|
||||
registryItem.dimensionId, registryItem.x, registryItem.y, registryItem.z,
|
||||
|
@ -335,7 +335,7 @@ public class StarMapRegistry {
|
|||
if (setRegistryItems == null) {
|
||||
return false;
|
||||
}
|
||||
for (StarMapRegistryItem registryItem : setRegistryItems) {
|
||||
for (final StarMapRegistryItem registryItem : setRegistryItems) {
|
||||
assert(registryItem.dimensionId == core.getWorldObj().provider.dimensionId);
|
||||
|
||||
// only check cores
|
||||
|
@ -380,13 +380,13 @@ public class StarMapRegistry {
|
|||
LocalProfiler.start("Starmap registry cleanup");
|
||||
|
||||
boolean isValid;
|
||||
for (Map.Entry<Integer, CopyOnWriteArraySet<StarMapRegistryItem>> entryDimension : registry.entrySet()) {
|
||||
for (final Map.Entry<Integer, CopyOnWriteArraySet<StarMapRegistryItem>> entryDimension : registry.entrySet()) {
|
||||
final WorldServer world = DimensionManager.getWorld(entryDimension.getKey());
|
||||
// skip unloaded worlds
|
||||
if (world == null) {
|
||||
continue;
|
||||
}
|
||||
for (StarMapRegistryItem registryItem : entryDimension.getValue()) {
|
||||
for (final StarMapRegistryItem registryItem : entryDimension.getValue()) {
|
||||
isValid = false;
|
||||
if (registryItem != null) {
|
||||
|
||||
|
@ -463,7 +463,7 @@ public class StarMapRegistry {
|
|||
final NBTTagList tagList = tagCompound.getTagList("starMapRegistryItems", Constants.NBT.TAG_COMPOUND);
|
||||
final StarMapRegistryItem[] registryFlat = new StarMapRegistryItem[tagList.tagCount()];
|
||||
final HashMap<Integer, Integer> sizeDimensions = new HashMap<>();
|
||||
for(int index = 0; index < tagList.tagCount(); index++) {
|
||||
for (int index = 0; index < tagList.tagCount(); index++) {
|
||||
final StarMapRegistryItem starMapRegistryItem = new StarMapRegistryItem(tagList.getCompoundTagAt(index));
|
||||
registryFlat[index] = starMapRegistryItem;
|
||||
|
||||
|
@ -475,26 +475,26 @@ public class StarMapRegistry {
|
|||
|
||||
// pre-build the local collections using known stats to avoid re-allocations
|
||||
final HashMap<Integer, ArrayList<StarMapRegistryItem>> registryLocal = new HashMap<>();
|
||||
for(Entry<Integer, Integer> entryDimension : sizeDimensions.entrySet()) {
|
||||
for (final Entry<Integer, Integer> entryDimension : sizeDimensions.entrySet()) {
|
||||
registryLocal.put(entryDimension.getKey(), new ArrayList<>(entryDimension.getValue()));
|
||||
}
|
||||
|
||||
// fill the local collections
|
||||
for(StarMapRegistryItem starMapRegistryItem : registryFlat) {
|
||||
for (final StarMapRegistryItem starMapRegistryItem : registryFlat) {
|
||||
registryLocal.get(starMapRegistryItem.dimensionId).add(starMapRegistryItem);
|
||||
}
|
||||
|
||||
// transfer to main one
|
||||
registry.clear();
|
||||
for(Entry<Integer, ArrayList<StarMapRegistryItem>> entry : registryLocal.entrySet()) {
|
||||
for (final Entry<Integer, ArrayList<StarMapRegistryItem>> entry : registryLocal.entrySet()) {
|
||||
registry.put(entry.getKey(), new CopyOnWriteArraySet<>(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(final NBTTagCompound tagCompound) {
|
||||
final NBTTagList tagList = new NBTTagList();
|
||||
for(CopyOnWriteArraySet<StarMapRegistryItem> starMapRegistryItems : registry.values()) {
|
||||
for(StarMapRegistryItem starMapRegistryItem : starMapRegistryItems) {
|
||||
for (final CopyOnWriteArraySet<StarMapRegistryItem> starMapRegistryItems : registry.values()) {
|
||||
for (final StarMapRegistryItem starMapRegistryItem : starMapRegistryItems) {
|
||||
final NBTTagCompound tagCompoundItem = new NBTTagCompound();
|
||||
starMapRegistryItem.writeToNBT(tagCompoundItem);
|
||||
tagList.appendTag(tagCompoundItem);
|
||||
|
|
|
@ -40,7 +40,7 @@ public class StarMapRegistryItem extends GlobalPosition {
|
|||
|
||||
static {
|
||||
length = EnumStarMapEntryType.values().length;
|
||||
for (EnumStarMapEntryType enumStarMapEntryType : values()) {
|
||||
for (final EnumStarMapEntryType enumStarMapEntryType : values()) {
|
||||
mapNames.put(enumStarMapEntryType.getName(), enumStarMapEntryType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -597,24 +597,24 @@ public class Vector3 implements Cloneable {
|
|||
|
||||
public MovingObjectPosition rayTraceEntities(World world, float rotationYaw, float rotationPitch, double reachDistance) {
|
||||
MovingObjectPosition pickedEntity = null;
|
||||
Vec3 startingPosition = toVec3();
|
||||
Vec3 look = getDeltaPositionFromRotation(rotationYaw, rotationPitch).toVec3();
|
||||
Vec3 reachPoint = Vec3.createVectorHelper(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance,
|
||||
final Vec3 startingPosition = toVec3();
|
||||
final Vec3 look = getDeltaPositionFromRotation(rotationYaw, rotationPitch).toVec3();
|
||||
final Vec3 reachPoint = Vec3.createVectorHelper(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance,
|
||||
startingPosition.zCoord + look.zCoord * reachDistance);
|
||||
double playerBorder = 1.1 * reachDistance;
|
||||
AxisAlignedBB boxToScan = AxisAlignedBB.getBoundingBox(-playerBorder, -playerBorder, -playerBorder, playerBorder, playerBorder, playerBorder);
|
||||
List<Entity> entitiesHit = world.getEntitiesWithinAABBExcludingEntity(null, boxToScan);
|
||||
final double playerBorder = 1.1 * reachDistance;
|
||||
final AxisAlignedBB boxToScan = AxisAlignedBB.getBoundingBox(-playerBorder, -playerBorder, -playerBorder, playerBorder, playerBorder, playerBorder);
|
||||
final List<Entity> entitiesHit = world.getEntitiesWithinAABBExcludingEntity(null, boxToScan);
|
||||
double closestEntity = reachDistance;
|
||||
|
||||
if (entitiesHit == null || entitiesHit.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Entity entityHit : entitiesHit) {
|
||||
for (final Entity entityHit : entitiesHit) {
|
||||
if (entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null) {
|
||||
float border = entityHit.getCollisionBorderSize();
|
||||
AxisAlignedBB aabb = entityHit.boundingBox.expand(border, border, border);
|
||||
MovingObjectPosition hitMOP = aabb.calculateIntercept(startingPosition, reachPoint);
|
||||
final float border = entityHit.getCollisionBorderSize();
|
||||
final AxisAlignedBB aabb = entityHit.boundingBox.expand(border, border, border);
|
||||
final MovingObjectPosition hitMOP = aabb.calculateIntercept(startingPosition, reachPoint);
|
||||
|
||||
if (hitMOP != null) {
|
||||
if (aabb.isVecInside(startingPosition)) {
|
||||
|
@ -624,7 +624,7 @@ public class Vector3 implements Cloneable {
|
|||
closestEntity = 0.0D;
|
||||
}
|
||||
} else {
|
||||
double distance = startingPosition.distanceTo(hitMOP.hitVec);
|
||||
final double distance = startingPosition.distanceTo(hitMOP.hitVec);
|
||||
|
||||
if (distance < closestEntity || closestEntity == 0.0D) {
|
||||
pickedEntity = new MovingObjectPosition(entityHit);
|
||||
|
|
|
@ -19,7 +19,7 @@ public abstract class AbstractSequencer {
|
|||
while (!isUpdating.compareAndSet(false, true)) {
|
||||
Thread.yield();
|
||||
}
|
||||
for(Iterator<Entry<AbstractSequencer, Boolean>> iterator = sequencers.entrySet().iterator(); iterator.hasNext(); ) {
|
||||
for (final Iterator<Entry<AbstractSequencer, Boolean>> iterator = sequencers.entrySet().iterator(); iterator.hasNext(); ) {
|
||||
Entry<AbstractSequencer, Boolean> entry = iterator.next();
|
||||
boolean doContinue = entry.getKey().onUpdate();
|
||||
if (!doContinue) {
|
||||
|
|
|
@ -176,7 +176,7 @@ public class ChunkHandler {
|
|||
final Map<Long, ChunkData> mapRegistryItems = registry.get(event.world.provider.dimensionId);
|
||||
if (mapRegistryItems != null) {
|
||||
// unload chunks during shutdown
|
||||
for (ChunkData chunkData : mapRegistryItems.values()) {
|
||||
for (final ChunkData chunkData : mapRegistryItems.values()) {
|
||||
if (chunkData.isLoaded()) {
|
||||
chunkData.unload();
|
||||
}
|
||||
|
|
|
@ -1048,7 +1048,7 @@ public class JumpSequencer extends AbstractSequencer {
|
|||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Moving externals for block " + jumpBlock.block + "@" + jumpBlock.blockMeta + " at " + jumpBlock.x + " " + jumpBlock.y + " " + jumpBlock.z);
|
||||
}
|
||||
for (Entry<String, NBTBase> external : jumpBlock.externals.entrySet()) {
|
||||
for (final Entry<String, NBTBase> external : jumpBlock.externals.entrySet()) {
|
||||
final IBlockTransformer blockTransformer = WarpDriveConfig.blockTransformers.get(external.getKey());
|
||||
if (blockTransformer != null) {
|
||||
if ( shipMovementType != EnumShipMovementType.INSTANTIATE
|
||||
|
@ -1078,7 +1078,7 @@ public class JumpSequencer extends AbstractSequencer {
|
|||
|
||||
if ( shipMovementType != EnumShipMovementType.INSTANTIATE
|
||||
&& shipMovementType != EnumShipMovementType.RESTORE ) {
|
||||
for (MovingEntity movingEntity : ship.entitiesOnShip) {
|
||||
for (final MovingEntity movingEntity : ship.entitiesOnShip) {
|
||||
final Entity entity = movingEntity.getEntity();
|
||||
if (entity == null) {
|
||||
continue;
|
||||
|
@ -1370,7 +1370,7 @@ public class JumpSequencer extends AbstractSequencer {
|
|||
|
||||
if ( shipMovementType != EnumShipMovementType.INSTANTIATE
|
||||
&& shipMovementType != EnumShipMovementType.RESTORE ) {
|
||||
for (MovingEntity movingEntity : ship.entitiesOnShip) {
|
||||
for (final MovingEntity movingEntity : ship.entitiesOnShip) {
|
||||
final Entity entity = movingEntity.getEntity();
|
||||
if (entity == null) {
|
||||
continue;
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
|
|||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[EnumComponentType.length];
|
||||
for(EnumComponentType enumComponentType : EnumComponentType.values()) {
|
||||
for (final EnumComponentType enumComponentType : EnumComponentType.values()) {
|
||||
icons[enumComponentType.ordinal()] = iconRegister.registerIcon("warpdrive:component/" + enumComponentType.unlocalizedName);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
|
|||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs creativeTab, List list) {
|
||||
for(EnumComponentType enumComponentType : EnumComponentType.values()) {
|
||||
for (final EnumComponentType enumComponentType : EnumComponentType.values()) {
|
||||
list.add(new ItemStack(item, 1, enumComponentType.ordinal()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ public class ItemForceFieldShape extends Item {
|
|||
itemStackCache = new ItemStack[EnumForceFieldShape.length];
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(EnumForceFieldShape enumForceFieldShape) {
|
||||
if (enumForceFieldShape != null) {
|
||||
int damage = enumForceFieldShape.ordinal();
|
||||
public static ItemStack getItemStack(final EnumForceFieldShape forceFieldShape) {
|
||||
if (forceFieldShape != null) {
|
||||
int damage = forceFieldShape.ordinal();
|
||||
if (itemStackCache[damage] == null) {
|
||||
itemStackCache[damage] = new ItemStack(WarpDrive.itemForceFieldShape, 1, damage);
|
||||
}
|
||||
|
@ -48,15 +48,15 @@ public class ItemForceFieldShape extends Item {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStackNoCache(EnumForceFieldShape enumForceFieldShape, int amount) {
|
||||
return new ItemStack(WarpDrive.itemForceFieldShape, amount, enumForceFieldShape.ordinal());
|
||||
public static ItemStack getItemStackNoCache(final EnumForceFieldShape forceFieldShape, final int amount) {
|
||||
return new ItemStack(WarpDrive.itemForceFieldShape, amount, forceFieldShape.ordinal());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
public void registerIcons(final IIconRegister iconRegister) {
|
||||
icons = new IIcon[EnumForceFieldShape.length];
|
||||
for(EnumForceFieldShape enumForceFieldShape : EnumForceFieldShape.values()) {
|
||||
for (final EnumForceFieldShape enumForceFieldShape : EnumForceFieldShape.values()) {
|
||||
icons[enumForceFieldShape.ordinal()] = iconRegister.registerIcon("warpdrive:forcefield/shape_" + enumForceFieldShape.unlocalizedName);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class ItemForceFieldShape extends Item {
|
|||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs creativeTab, List list) {
|
||||
for(EnumForceFieldShape enumForceFieldShape : EnumForceFieldShape.values()) {
|
||||
for (final EnumForceFieldShape enumForceFieldShape : EnumForceFieldShape.values()) {
|
||||
if (enumForceFieldShape != EnumForceFieldShape.NONE) {
|
||||
list.add(new ItemStack(item, 1, enumForceFieldShape.ordinal()));
|
||||
}
|
||||
|
@ -97,12 +97,12 @@ public class ItemForceFieldShape extends Item {
|
|||
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean advancedItemTooltips) {
|
||||
super.addInformation(itemStack, entityPlayer, list, advancedItemTooltips);
|
||||
|
||||
String tooltipName1 = getUnlocalizedName(itemStack) + ".tooltip";
|
||||
final String tooltipName1 = getUnlocalizedName(itemStack) + ".tooltip";
|
||||
if (StatCollector.canTranslate(tooltipName1)) {
|
||||
Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1));
|
||||
}
|
||||
|
||||
String tooltipName2 = getUnlocalizedName() + ".tooltip";
|
||||
final String tooltipName2 = getUnlocalizedName() + ".tooltip";
|
||||
if ((!tooltipName1.equals(tooltipName2)) && StatCollector.canTranslate(tooltipName2)) {
|
||||
Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2));
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ public class ItemForceFieldUpgrade extends Item {
|
|||
itemStackCache = new ItemStack[EnumForceFieldUpgrade.length];
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(EnumForceFieldUpgrade enumForceFieldUpgrade) {
|
||||
if (enumForceFieldUpgrade != null) {
|
||||
int damage = enumForceFieldUpgrade.ordinal();
|
||||
public static ItemStack getItemStack(final EnumForceFieldUpgrade forceFieldUpgrade) {
|
||||
if (forceFieldUpgrade != null) {
|
||||
int damage = forceFieldUpgrade.ordinal();
|
||||
if (itemStackCache[damage] == null) {
|
||||
itemStackCache[damage] = new ItemStack(WarpDrive.itemForceFieldUpgrade, 1, damage);
|
||||
}
|
||||
|
@ -48,15 +48,15 @@ public class ItemForceFieldUpgrade extends Item {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStackNoCache(EnumForceFieldUpgrade enumForceFieldUpgrade, int amount) {
|
||||
return new ItemStack(WarpDrive.itemForceFieldUpgrade, amount, enumForceFieldUpgrade.ordinal());
|
||||
public static ItemStack getItemStackNoCache(final EnumForceFieldUpgrade forceFieldUpgrade, final int amount) {
|
||||
return new ItemStack(WarpDrive.itemForceFieldUpgrade, amount, forceFieldUpgrade.ordinal());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[EnumForceFieldUpgrade.length];
|
||||
for(EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
|
||||
for (final EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
|
||||
icons[enumForceFieldUpgrade.ordinal()] = iconRegister.registerIcon("warpdrive:forcefield/upgrade_" + enumForceFieldUpgrade.unlocalizedName);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class ItemForceFieldUpgrade extends Item {
|
|||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs creativeTab, List list) {
|
||||
for(EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
|
||||
for (final EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
|
||||
if (enumForceFieldUpgrade != EnumForceFieldUpgrade.NONE) {
|
||||
list.add(new ItemStack(item, 1, enumForceFieldUpgrade.ordinal()));
|
||||
}
|
||||
|
@ -97,23 +97,23 @@ public class ItemForceFieldUpgrade extends Item {
|
|||
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean advancedItemTooltips) {
|
||||
super.addInformation(itemStack, entityPlayer, list, advancedItemTooltips);
|
||||
|
||||
String tooltipName1 = getUnlocalizedName(itemStack) + ".tooltip";
|
||||
final String tooltipName1 = getUnlocalizedName(itemStack) + ".tooltip";
|
||||
if (StatCollector.canTranslate(tooltipName1)) {
|
||||
Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1));
|
||||
}
|
||||
|
||||
String tooltipName2 = getUnlocalizedName() + ".tooltip";
|
||||
final String tooltipName2 = getUnlocalizedName() + ".tooltip";
|
||||
if ((!tooltipName1.equals(tooltipName2)) && StatCollector.canTranslate(tooltipName2)) {
|
||||
Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2));
|
||||
}
|
||||
|
||||
Commons.addTooltip(list, "\n");
|
||||
|
||||
EnumForceFieldUpgrade enumForceFieldUpgrade = EnumForceFieldUpgrade.get(itemStack.getItemDamage());
|
||||
if (enumForceFieldUpgrade.maxCountOnProjector > 0) {
|
||||
EnumForceFieldUpgrade forceFieldUpgrade = EnumForceFieldUpgrade.get(itemStack.getItemDamage());
|
||||
if (forceFieldUpgrade.maxCountOnProjector > 0) {
|
||||
Commons.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.projector"));
|
||||
}
|
||||
if (enumForceFieldUpgrade.maxCountOnRelay > 0) {
|
||||
if (forceFieldUpgrade.maxCountOnRelay > 0) {
|
||||
Commons.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.relay"));
|
||||
}
|
||||
Commons.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.dismount"));
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ItemTuningFork extends Item implements IWarpTool {
|
|||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs creativeTab, List list) {
|
||||
for(int dyeColor = 0; dyeColor < 16; dyeColor++) {
|
||||
for (int dyeColor = 0; dyeColor < 16; dyeColor++) {
|
||||
list.add(new ItemStack(item, 1, dyeColor));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ public class PacketHandler {
|
|||
|
||||
MessageBeamEffect messageBeamEffect = new MessageBeamEffect(source, target, red, green, blue, age, energy);
|
||||
// Send packet to all players within cloaked area
|
||||
List<Entity> list = worldObj.getEntitiesWithinAABB(EntityPlayerMP.class, aabb);
|
||||
for (Entity entity : list) {
|
||||
final List<Entity> list = worldObj.getEntitiesWithinAABB(EntityPlayerMP.class, aabb);
|
||||
for (final Entity entity : list) {
|
||||
if (entity != null && entity instanceof EntityPlayerMP) {
|
||||
PacketHandler.simpleNetworkManager.sendTo(messageBeamEffect, (EntityPlayerMP) entity);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ public class RenderSpaceSky extends IRenderHandler {
|
|||
// Planets
|
||||
if (celestialObject != null && celestialObject.opacityCelestialObjects > 0.0F) {
|
||||
final Vector3 vectorPlayer = StarMapRegistry.getUniversalCoordinates(celestialObject, vec3Player.xCoord, vec3Player.yCoord, vec3Player.zCoord);
|
||||
for (CelestialObject celestialObjectChild : CelestialObjectManager.getRenderStack()) {
|
||||
for (final CelestialObject celestialObjectChild : CelestialObjectManager.getRenderStack()) {
|
||||
if (celestialObject == celestialObjectChild) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue