From 4cbc277de153b84b36068c8bf623c8d897081673 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Thu, 23 Feb 2017 21:46:38 +0100 Subject: [PATCH] Code cleanup (mostly imports) --- src/main/java/cr0s/warpdrive/CommonProxy.java | 15 +- src/main/java/cr0s/warpdrive/Commons.java | 278 +++++++++++++++ .../cr0s/warpdrive/CreativeTabWarpDrive.java | 1 + .../java/cr0s/warpdrive/GravityManager.java | 2 + .../java/cr0s/warpdrive/LocalProfiler.java | 4 +- src/main/java/cr0s/warpdrive/WarpDrive.java | 261 ++++++-------- .../warpdrive/WarpDrivePeripheralHandler.java | 8 +- .../java/cr0s/warpdrive/api/IAirCanister.java | 8 +- .../warpdrive/api/IBlockUpdateDetector.java | 2 +- .../cr0s/warpdrive/api/IBreathingHelmet.java | 6 +- .../cr0s/warpdrive/api/IDamageReceiver.java | 1 + .../cr0s/warpdrive/api/IForceFieldShape.java | 1 - .../api/IStarMapRegistryTileEntity.java | 5 +- .../java/cr0s/warpdrive/api/Particle.java | 17 +- .../cr0s/warpdrive/api/ParticleRegistry.java | 8 +- .../cr0s/warpdrive/api/ParticleStack.java | 5 +- .../block/BlockAbstractContainer.java | 8 +- .../warpdrive/block/BlockAirGenerator.java | 9 +- .../java/cr0s/warpdrive/block/BlockLaser.java | 5 +- .../warpdrive/block/BlockLaserMedium.java | 5 +- .../block/ItemBlockAbstractBase.java | 16 +- .../block/TileEntityAbstractBase.java | 161 +-------- .../block/TileEntityAbstractChunkLoading.java | 8 +- .../block/TileEntityAbstractEnergy.java | 21 +- .../block/TileEntityAbstractInterfaced.java | 24 +- .../block/TileEntityAbstractLaser.java | 17 +- .../block/TileEntityAirGenerator.java | 13 +- .../block/TileEntityChunkLoader.java | 34 +- .../cr0s/warpdrive/block/TileEntityLaser.java | 61 ++-- .../block/TileEntityLaserMedium.java | 6 +- .../atomic/BlockAbstractAccelerator.java | 1 + .../atomic/BlockAcceleratorControlPoint.java | 10 +- .../warpdrive/block/atomic/BlockChiller.java | 8 +- .../block/atomic/BlockParticlesInjector.java | 5 +- .../TileEntityAcceleratorControlPoint.java | 19 +- .../block/building/BlockShipScanner.java | 4 +- .../block/building/TileEntityShipScanner.java | 61 ++-- .../block/collection/BlockLaserTreeFarm.java | 7 +- .../block/collection/BlockMiningLaser.java | 7 +- .../collection/TileEntityAbstractMiner.java | 18 +- .../collection/TileEntityLaserTreeFarm.java | 55 +-- .../collection/TileEntityMiningLaser.java | 41 ++- .../block/detection/BlockCamera.java | 7 +- .../block/detection/BlockCloakingCoil.java | 4 +- .../block/detection/BlockCloakingCore.java | 9 +- .../block/detection/BlockMonitor.java | 15 +- .../warpdrive/block/detection/BlockRadar.java | 7 +- .../warpdrive/block/detection/BlockSiren.java | 8 +- .../block/detection/BlockWarpIsolation.java | 3 +- .../block/detection/TileEntityCamera.java | 25 +- .../detection/TileEntityCloakingCore.java | 29 +- .../block/detection/TileEntityMonitor.java | 23 +- .../block/detection/TileEntityRadar.java | 31 +- .../block/detection/TileEntitySiren.java | 12 +- .../block/energy/BlockEnanReactorCore.java | 1 + .../block/energy/BlockEnanReactorLaser.java | 1 + .../block/energy/BlockEnergyBank.java | 32 +- .../energy/BlockIC2reactorLaserMonitor.java | 7 +- .../energy/TileEntityEnanReactorCore.java | 33 +- .../energy/TileEntityEnanReactorLaser.java | 19 +- .../block/energy/TileEntityEnergyBank.java | 9 +- .../TileEntityIC2reactorLaserMonitor.java | 15 +- .../forcefield/BlockAbstractForceField.java | 1 + .../block/forcefield/BlockForceField.java | 14 +- .../forcefield/BlockForceFieldProjector.java | 39 ++- .../forcefield/BlockForceFieldRelay.java | 20 +- .../ItemBlockForceFieldProjector.java | 1 + .../forcefield/ItemBlockForceFieldRelay.java | 1 + .../TileEntityAbstractForceField.java | 9 +- .../forcefield/TileEntityForceField.java | 1 + .../TileEntityForceFieldProjector.java | 61 ++-- .../forcefield/TileEntityForceFieldRelay.java | 1 + .../warpdrive/block/hull/BlockHullGlass.java | 8 +- .../warpdrive/block/hull/BlockHullPlain.java | 14 +- .../warpdrive/block/hull/BlockHullStairs.java | 1 + .../warpdrive/block/hull/ItemBlockHull.java | 5 +- .../warpdrive/block/movement/BlockLift.java | 7 +- .../block/movement/BlockShipController.java | 10 +- .../block/movement/BlockShipCore.java | 11 +- .../block/movement/BlockTransporter.java | 5 +- .../block/movement/TileEntityLift.java | 33 +- .../movement/TileEntityShipController.java | 57 ++- .../block/movement/TileEntityShipCore.java | 36 +- .../block/movement/TileEntityTransporter.java | 46 +-- .../warpdrive/block/passive/BlockAir.java | 7 +- .../block/passive/BlockDecorative.java | 5 +- .../warpdrive/block/passive/BlockGas.java | 4 +- .../passive/BlockHighlyAdvancedMachine.java | 3 +- .../warpdrive/block/passive/BlockIridium.java | 3 +- .../block/passive/BlockTransportBeacon.java | 1 + .../block/passive/ItemBlockDecorative.java | 3 +- .../block/weapon/BlockLaserCamera.java | 12 +- .../block/weapon/BlockWeaponController.java | 10 +- .../block/weapon/TileEntityLaserCamera.java | 25 +- .../weapon/TileEntityWeaponController.java | 4 +- .../cr0s/warpdrive/client/ClientProxy.java | 3 +- .../cr0s/warpdrive/client/SirenSound.java | 5 +- .../cr0s/warpdrive/command/CommandDebug.java | 17 +- .../cr0s/warpdrive/command/CommandEntity.java | 35 +- .../warpdrive/command/CommandGenerate.java | 33 +- .../warpdrive/command/CommandInvisible.java | 4 +- .../warpdrive/command/CommandJumpgates.java | 6 +- .../cr0s/warpdrive/command/CommandSpace.java | 28 +- .../CompatAdvancedRepulsionSystems.java | 7 +- .../compat/CompatAppliedEnergistics2.java | 7 +- .../warpdrive/compat/CompatArsMagica2.java | 16 +- .../warpdrive/compat/CompatBiblioCraft.java | 7 +- .../cr0s/warpdrive/compat/CompatBotania.java | 7 +- .../compat/CompatCarpentersBlocks.java | 1 + .../warpdrive/compat/CompatComputerCraft.java | 9 +- .../cr0s/warpdrive/compat/CompatEnderIO.java | 8 +- .../warpdrive/compat/CompatEvilCraft.java | 7 +- .../compat/CompatForgeMultipart.java | 10 +- .../compat/CompatImmersiveEngineering.java | 12 +- .../compat/CompatIndustrialCraft2.java | 7 +- .../cr0s/warpdrive/compat/CompatJABBA.java | 7 +- .../cr0s/warpdrive/compat/CompatMekanism.java | 9 +- .../warpdrive/compat/CompatMetallurgy.java | 7 +- .../cr0s/warpdrive/compat/CompatNatura.java | 7 +- .../warpdrive/compat/CompatOpenComputers.java | 7 +- .../compat/CompatPneumaticCraft.java | 1 + .../warpdrive/compat/CompatRedstonePaste.java | 7 +- .../cr0s/warpdrive/compat/CompatSGCraft.java | 7 +- .../warpdrive/compat/CompatStargateTech2.java | 11 +- .../warpdrive/compat/CompatTConstruct.java | 7 +- .../warpdrive/compat/CompatThaumcraft.java | 8 +- .../compat/CompatThermalDynamics.java | 9 +- .../compat/CompatThermalExpansion.java | 2 +- .../warpdrive/compat/CompatWarpDrive.java | 2 + .../cr0s/warpdrive/config/Dictionary.java | 14 +- .../warpdrive/config/IXmlRepresentable.java | 6 +- .../warpdrive/config/RandomCollection.java | 7 +- .../config/RecipeParticleShapedOre.java | 16 +- .../warpdrive/config/RecipeTuningDriver.java | 9 +- .../java/cr0s/warpdrive/config/Recipes.java | 14 +- .../warpdrive/config/WarpDriveConfig.java | 331 ++++++++++-------- .../warpdrive/config/XmlPreprocessor.java | 25 +- .../cr0s/warpdrive/config/filler/Filler.java | 8 +- .../config/filler/FillerManager.java | 21 +- .../warpdrive/config/filler/FillerSet.java | 17 +- .../config/structures/AbstractInstance.java | 3 - .../config/structures/AbstractStructure.java | 13 +- .../warpdrive/config/structures/MetaOrb.java | 12 +- .../config/structures/MetaOrbInstance.java | 13 +- .../cr0s/warpdrive/config/structures/Orb.java | 13 +- .../config/structures/OrbInstance.java | 9 +- .../config/structures/StructureManager.java | 24 +- .../config/structures/StructureReference.java | 7 +- .../cr0s/warpdrive/core/ClassTransformer.java | 6 +- .../cr0s/warpdrive/core/FMLLoadingPlugin.java | 6 +- .../warpdrive/core/MyDummyModContainer.java | 4 +- .../warpdrive/data/CameraRegistryItem.java | 1 + .../cr0s/warpdrive/data/CamerasRegistry.java | 5 +- .../cr0s/warpdrive/data/CloakManager.java | 16 +- .../java/cr0s/warpdrive/data/CloakedArea.java | 17 +- .../cr0s/warpdrive/data/EnumCameraType.java | 6 +- .../warpdrive/data/EnumForceFieldShape.java | 1 + .../warpdrive/data/EnumForceFieldUpgrade.java | 16 +- .../warpdrive/data/ForceFieldRegistry.java | 10 +- .../cr0s/warpdrive/data/ForceFieldSetup.java | 27 +- .../cr0s/warpdrive/data/GlobalPosition.java | 2 + .../java/cr0s/warpdrive/data/JumpBlock.java | 47 ++- .../java/cr0s/warpdrive/data/JumpShip.java | 15 +- .../java/cr0s/warpdrive/data/Jumpgate.java | 3 +- .../warpdrive/data/JumpgatesRegistry.java | 4 +- .../cr0s/warpdrive/data/MovingEntity.java | 4 - .../cr0s/warpdrive/data/StarMapRegistry.java | 16 +- .../warpdrive/data/StarMapRegistryItem.java | 5 +- .../cr0s/warpdrive/data/Transformation.java | 3 +- .../java/cr0s/warpdrive/data/Vector3.java | 1 + .../java/cr0s/warpdrive/data/VectorI.java | 3 +- .../cr0s/warpdrive/event/ClientHandler.java | 23 +- .../cr0s/warpdrive/event/JumpSequencer.java | 44 ++- .../cr0s/warpdrive/event/LivingHandler.java | 20 +- .../cr0s/warpdrive/event/WorldHandler.java | 10 +- .../warpdrive/item/ItemAirCanisterFull.java | 7 +- .../cr0s/warpdrive/item/ItemComponent.java | 12 +- .../cr0s/warpdrive/item/ItemCrystalToken.java | 10 +- .../item/ItemElectromagneticCell.java | 16 +- .../warpdrive/item/ItemEnergyWrapper.java | 10 +- .../warpdrive/item/ItemForceFieldShape.java | 14 +- .../warpdrive/item/ItemForceFieldUpgrade.java | 18 +- .../item/ItemIC2reactorLaserFocus.java | 6 +- .../cr0s/warpdrive/item/ItemTuningDriver.java | 35 +- .../cr0s/warpdrive/item/ItemTuningFork.java | 24 +- .../java/cr0s/warpdrive/item/ItemUpgrade.java | 5 +- .../cr0s/warpdrive/item/ItemWarpArmor.java | 3 +- .../warpdrive/network/MessageBeamEffect.java | 13 +- .../cr0s/warpdrive/network/MessageCloak.java | 12 +- .../network/MessageSpawnParticle.java | 19 +- .../warpdrive/network/MessageTargeting.java | 13 +- .../network/MessageVideoChannel.java | 11 +- .../cr0s/warpdrive/network/PacketHandler.java | 11 +- .../warpdrive/render/ClientCameraHandler.java | 8 +- .../cr0s/warpdrive/render/EntityCamera.java | 7 +- .../cr0s/warpdrive/render/EntityFXBeam.java | 3 +- .../cr0s/warpdrive/render/RenderBlank.java | 3 +- .../render/RenderBlockForceField.java | 25 +- .../warpdrive/render/RenderBlockStandard.java | 1 + .../render/RenderEntityParticleBunch.java | 10 +- .../warpdrive/render/RenderOverlayCamera.java | 12 +- .../cr0s/warpdrive/render/RenderSpaceSky.java | 7 +- .../cr0s/warpdrive/world/EntitySphereGen.java | 11 +- .../cr0s/warpdrive/world/EntityStarCore.java | 4 +- .../warpdrive/world/HyperSpaceGenerator.java | 4 +- .../world/HyperSpaceWorldGenerator.java | 10 +- .../world/HyperSpaceWorldProvider.java | 10 +- .../cr0s/warpdrive/world/SpaceGenerator.java | 4 +- .../warpdrive/world/SpaceWorldGenerator.java | 17 +- .../warpdrive/world/SpaceWorldProvider.java | 7 +- .../warpdrive/world/WorldGenSmallShip.java | 7 +- .../cr0s/warpdrive/world/WorldGenStation.java | 9 +- .../warpdrive/world/WorldGenStructure.java | 7 +- 213 files changed, 2022 insertions(+), 1574 deletions(-) create mode 100644 src/main/java/cr0s/warpdrive/Commons.java diff --git a/src/main/java/cr0s/warpdrive/CommonProxy.java b/src/main/java/cr0s/warpdrive/CommonProxy.java index 9148648b..b1416204 100644 --- a/src/main/java/cr0s/warpdrive/CommonProxy.java +++ b/src/main/java/cr0s/warpdrive/CommonProxy.java @@ -1,12 +1,16 @@ package cr0s.warpdrive; -import com.mojang.authlib.GameProfile; -import cpw.mods.fml.common.registry.EntityRegistry; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.entity.EntityParticleBunch; import cr0s.warpdrive.render.EntityCamera; import cr0s.warpdrive.world.EntitySphereGen; import cr0s.warpdrive.world.EntityStarCore; + +import java.lang.ref.WeakReference; +import java.util.UUID; +import java.util.WeakHashMap; + +import com.mojang.authlib.GameProfile; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -15,16 +19,15 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.WorldSettings; + +import cpw.mods.fml.common.registry.EntityRegistry; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.event.world.BlockEvent; -import java.lang.ref.WeakReference; -import java.util.UUID; -import java.util.WeakHashMap; -public abstract class CommonProxy { +public class CommonProxy { private static final WeakHashMap> fakePlayers = new WeakHashMap<>(100); void registerEntities() { diff --git a/src/main/java/cr0s/warpdrive/Commons.java b/src/main/java/cr0s/warpdrive/Commons.java new file mode 100644 index 00000000..d8753e5a --- /dev/null +++ b/src/main/java/cr0s/warpdrive/Commons.java @@ -0,0 +1,278 @@ +package cr0s.warpdrive; + +import cr0s.warpdrive.data.VectorI; + +import net.minecraft.block.Block; +import net.minecraft.command.ICommandSender; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Common static methods + */ +public class Commons { + + public static void addChatMessage(final ICommandSender sender, final String message) { + if (sender == null) { + WarpDrive.logger.error("Unable to send message to NULL sender: " + message); + return; + } + String[] lines = message.replace("§", "" + (char)167).replace("\\n", "\n").replaceAll("\u00A0", " ").split("\n"); + for (String line : lines) { + sender.addChatMessage(new ChatComponentText(line)); + } + + // logger.info(message); + } + + // add tooltip information with text formatting and line splitting + // will ensure it fits on minimum screen width + public static void addTooltip(List list, String tooltip) { + final String charFormatting = "" + (char)167; + tooltip = tooltip.replace("§", charFormatting).replace("\\n", "\n").replace("|", "\n"); + tooltip = tooltip.replace(charFormatting + "r", charFormatting + "7"); + + String[] split = tooltip.split("\n"); + for (String line : split) { + String lineRemaining = line; + String formatNextLine = ""; + while (!lineRemaining.isEmpty()) { + int indexToCut = formatNextLine.length(); + int displayLength = 0; + int length = lineRemaining.length(); + while (indexToCut < length && displayLength <= 38) { + if (lineRemaining.charAt(indexToCut) == (char)167 && indexToCut + 1 < length) { + indexToCut++; + } else { + displayLength++; + } + indexToCut++; + } + if (indexToCut < length) { + indexToCut = lineRemaining.substring(0, indexToCut).lastIndexOf(' '); + if (indexToCut == -1 || indexToCut == 0) {// no space available, show the whole line 'as is' + list.add(lineRemaining); + lineRemaining = ""; + } else {// cut at last space + list.add(lineRemaining.substring(0, indexToCut).replaceAll("\u00A0", " ")); + + // compute remaining format + int index = formatNextLine.length(); + while (index <= indexToCut) { + if (lineRemaining.charAt(index) == (char)167 && index + 1 < indexToCut) { + index++; + formatNextLine += ("" + (char)167) + lineRemaining.charAt(index); + } + index++; + } + + // cut for next line, recovering current format + lineRemaining = formatNextLine + " " + lineRemaining.substring(indexToCut + 1); + } + } else { + list.add(lineRemaining.replaceAll("\u00A0", " ")); + lineRemaining = ""; + } + } + } + } + + public static Field getField(Class clazz, String deobfuscatedName, String obfuscatedName) { + Field fieldToReturn = null; + + try { + fieldToReturn = clazz.getDeclaredField(deobfuscatedName); + } catch (Exception exception1) { + try { + fieldToReturn = clazz.getDeclaredField(obfuscatedName); + } catch (Exception exception2) { + exception2.printStackTrace(); + String map = ""; + for(Field fieldDeclared : clazz.getDeclaredFields()) { + if (!map.isEmpty()) { + map += ", "; + } + map += fieldDeclared.getName(); + } + WarpDrive.logger.error(String.format("Unable to find %1$s field in %2$s class. Available fields are: %3$s", + deobfuscatedName, clazz.toString(), map)); + } + } + if (fieldToReturn != null) { + fieldToReturn.setAccessible(true); + } + return fieldToReturn; + } + + public static String format(final long value) { + // alternate: BigDecimal.valueOf(value).setScale(0, RoundingMode.HALF_EVEN).toPlainString(), + return String.format("%,d", Math.round(value)); + } + + public static ItemStack copyWithSize(ItemStack itemStack, int newSize) { + ItemStack ret = itemStack.copy(); + ret.stackSize = newSize; + return ret; + } + + public static Collection getConnectedInventories(TileEntity tileEntityConnection) { + Collection result = new ArrayList<>(6); + + for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + TileEntity tileEntity = tileEntityConnection.getWorldObj().getTileEntity( + tileEntityConnection.xCoord + side.offsetX, tileEntityConnection.yCoord + side.offsetY, tileEntityConnection.zCoord + side.offsetZ); + if (tileEntity != null && (tileEntity instanceof IInventory)) { + result.add((IInventory) tileEntity); + + if (tileEntity instanceof TileEntityChest) { + TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; + tileEntityChest.checkForAdjacentChests(); + if (tileEntityChest.adjacentChestXNeg != null) { + result.add(tileEntityChest.adjacentChestXNeg); + } else if (tileEntityChest.adjacentChestXPos != null) { + result.add(tileEntityChest.adjacentChestXPos); + } else if (tileEntityChest.adjacentChestZNeg != null) { + result.add(tileEntityChest.adjacentChestZNeg); + } else if (tileEntityChest.adjacentChestZPos != null) { + result.add(tileEntityChest.adjacentChestZPos); + } + } + } + } + return result; + } + + + // searching methods + + public static final ForgeDirection[] UP_DIRECTIONS = { ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.EAST }; + public static final ForgeDirection[] HORIZONTAL_DIRECTIONS = { ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.EAST }; + + public static Set getConnectedBlocks(World world, final VectorI start, final ForgeDirection[] directions, final Set whitelist, final int maxRange, final VectorI... ignore) { + return getConnectedBlocks(world, Collections.singletonList(start), directions, whitelist, maxRange, ignore); + } + + public static Set getConnectedBlocks(World world, final Collection start, final ForgeDirection[] directions, final Set whitelist, final int maxRange, final VectorI... ignore) { + Set toIgnore = new HashSet<>(); + if (ignore != null) { + toIgnore.addAll(Arrays.asList(ignore)); + } + + Set toIterate = new HashSet<>(); + toIterate.addAll(start); + + Set toIterateNext; + + Set iterated = new HashSet<>(); + + int range = 0; + while(!toIterate.isEmpty() && range < maxRange) { + toIterateNext = new HashSet<>(); + for (VectorI current : toIterate) { + if (whitelist.contains(current.getBlock_noChunkLoading(world))) { + iterated.add(current); + } + + 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))) { + toIterateNext.add(next); + } + } + } + } + toIterate = toIterateNext; + range++; + } + + return iterated; + } + + + // data manipulation methods + + public static int toInt(double d) { + return (int) Math.round(d); + } + + public static int toInt(Object object) { + return Commons.toInt(toDouble(object)); + } + + public static double toDouble(Object object) { + assert(!(object instanceof Object[])); + return Double.parseDouble(object.toString()); + } + + public static float toFloat(Object object) { + assert(!(object instanceof Object[])); + return Float.parseFloat(object.toString()); + } + + public static boolean toBool(Object object) { + if (object == null) { + return false; + } + assert(!(object instanceof Object[])); + if (object instanceof Boolean) { + return ((Boolean) object); + } + String string = object.toString(); + return string.equals("true") || string.equals("1.0") || string.equals("1") || string.equals("y") || string.equals("yes"); + } + + public static int clamp(final int min, final int max, final int value) { + return Math.min(max, Math.max(value, min)); + } + + public static float clamp(final float min, final float max, final float value) { + return Math.min(max, Math.max(value, min)); + } + + public static double clamp(final double min, final double max, final double value) { + return Math.min(max, Math.max(value, min)); + } + + + // configurable interpolation + + public static double interpolate(final double[] xValues, final double[] yValues, final double xInput) { + if (WarpDrive.isDev) { + assert(xValues.length == yValues.length); + assert(xValues.length > 1); + } + + // clamp to minimum + if (xInput < xValues[0]) { + return yValues[0]; + } + + 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); + } + } + + // clamp to maximum + return yValues[yValues.length - 1]; + } + + private static double interpolate(final double xMin, final double yMin, final double xMax, final double yMax, final double x) { + return yMin + (x - xMin) * (yMax - yMin) / (xMax - xMin); + } +} diff --git a/src/main/java/cr0s/warpdrive/CreativeTabWarpDrive.java b/src/main/java/cr0s/warpdrive/CreativeTabWarpDrive.java index e4b3020e..ba6284a6 100644 --- a/src/main/java/cr0s/warpdrive/CreativeTabWarpDrive.java +++ b/src/main/java/cr0s/warpdrive/CreativeTabWarpDrive.java @@ -2,6 +2,7 @@ package cr0s.warpdrive; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/cr0s/warpdrive/GravityManager.java b/src/main/java/cr0s/warpdrive/GravityManager.java index 2f5a146d..09391a19 100644 --- a/src/main/java/cr0s/warpdrive/GravityManager.java +++ b/src/main/java/cr0s/warpdrive/GravityManager.java @@ -1,6 +1,8 @@ package cr0s.warpdrive; + import cr0s.warpdrive.config.Dictionary; + import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/cr0s/warpdrive/LocalProfiler.java b/src/main/java/cr0s/warpdrive/LocalProfiler.java index 2c9664a9..622c6ec3 100644 --- a/src/main/java/cr0s/warpdrive/LocalProfiler.java +++ b/src/main/java/cr0s/warpdrive/LocalProfiler.java @@ -1,9 +1,9 @@ package cr0s.warpdrive; -import java.util.Stack; - import cr0s.warpdrive.config.WarpDriveConfig; +import java.util.Stack; + public class LocalProfiler { private static class StackElement { public long start; diff --git a/src/main/java/cr0s/warpdrive/WarpDrive.java b/src/main/java/cr0s/warpdrive/WarpDrive.java index a5bed7d6..9edbe651 100644 --- a/src/main/java/cr0s/warpdrive/WarpDrive.java +++ b/src/main/java/cr0s/warpdrive/WarpDrive.java @@ -1,65 +1,43 @@ package cr0s.warpdrive; -import java.lang.reflect.Field; -import java.util.List; -import java.util.UUID; - -import com.mojang.authlib.GameProfile; -import cr0s.warpdrive.block.*; -import cr0s.warpdrive.block.atomic.*; -import cr0s.warpdrive.block.detection.*; -import cr0s.warpdrive.block.forcefield.*; -import cr0s.warpdrive.block.hull.BlockHullStairs; -import cr0s.warpdrive.config.RecipeParticleShapedOre; -import cr0s.warpdrive.config.RecipeTuningDriver; -import cr0s.warpdrive.damage.*; -import cr0s.warpdrive.item.*; -import net.minecraft.block.Block; -import net.minecraft.block.BlockColored; -import net.minecraft.client.Minecraft; -import net.minecraft.command.ICommandSender; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; -import net.minecraft.item.ItemArmor.ArmorMaterial; -import net.minecraft.item.ItemDye; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.common.BiomeDictionary; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.ForgeChunkManager; -import net.minecraftforge.common.ForgeChunkManager.LoadingCallback; -import net.minecraftforge.common.ForgeChunkManager.Ticket; -import net.minecraftforge.common.ForgeChunkManager.Type; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.EnumHelper; - -import net.minecraftforge.oredict.RecipeSorter; -import org.apache.logging.log4j.Logger; - -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.Mod.Instance; -import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLMissingMappingsEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; -import cpw.mods.fml.common.registry.GameRegistry; - +import cr0s.warpdrive.block.BlockAirGenerator; +import cr0s.warpdrive.block.BlockChunkLoader; +import cr0s.warpdrive.block.BlockLaser; +import cr0s.warpdrive.block.BlockLaserMedium; +import cr0s.warpdrive.block.ItemBlockAbstractBase; +import cr0s.warpdrive.block.TileEntityAbstractChunkLoading; +import cr0s.warpdrive.block.TileEntityAirGenerator; +import cr0s.warpdrive.block.TileEntityChunkLoader; +import cr0s.warpdrive.block.TileEntityLaser; +import cr0s.warpdrive.block.TileEntityLaserMedium; +import cr0s.warpdrive.block.atomic.BlockAcceleratorControlPoint; +import cr0s.warpdrive.block.atomic.BlockChiller; +import cr0s.warpdrive.block.atomic.BlockElectromagnetGlass; +import cr0s.warpdrive.block.atomic.BlockElectromagnetPlain; +import cr0s.warpdrive.block.atomic.BlockParticlesCollider; +import cr0s.warpdrive.block.atomic.BlockParticlesInjector; +import cr0s.warpdrive.block.atomic.BlockVoidShellGlass; +import cr0s.warpdrive.block.atomic.BlockVoidShellPlain; +import cr0s.warpdrive.block.atomic.TileEntityAcceleratorControlPoint; +import cr0s.warpdrive.block.atomic.TileEntityParticlesInjector; import cr0s.warpdrive.block.building.BlockShipScanner; import cr0s.warpdrive.block.building.TileEntityShipScanner; import cr0s.warpdrive.block.collection.BlockLaserTreeFarm; import cr0s.warpdrive.block.collection.BlockMiningLaser; import cr0s.warpdrive.block.collection.TileEntityLaserTreeFarm; import cr0s.warpdrive.block.collection.TileEntityMiningLaser; +import cr0s.warpdrive.block.detection.BlockCamera; +import cr0s.warpdrive.block.detection.BlockCloakingCoil; +import cr0s.warpdrive.block.detection.BlockCloakingCore; +import cr0s.warpdrive.block.detection.BlockMonitor; +import cr0s.warpdrive.block.detection.BlockRadar; +import cr0s.warpdrive.block.detection.BlockSiren; +import cr0s.warpdrive.block.detection.BlockWarpIsolation; +import cr0s.warpdrive.block.detection.TileEntityCamera; +import cr0s.warpdrive.block.detection.TileEntityCloakingCore; +import cr0s.warpdrive.block.detection.TileEntityMonitor; +import cr0s.warpdrive.block.detection.TileEntityRadar; +import cr0s.warpdrive.block.detection.TileEntitySiren; import cr0s.warpdrive.block.energy.BlockEnanReactorCore; import cr0s.warpdrive.block.energy.BlockEnanReactorLaser; import cr0s.warpdrive.block.energy.BlockEnergyBank; @@ -68,8 +46,17 @@ import cr0s.warpdrive.block.energy.TileEntityEnanReactorCore; import cr0s.warpdrive.block.energy.TileEntityEnanReactorLaser; import cr0s.warpdrive.block.energy.TileEntityEnergyBank; import cr0s.warpdrive.block.energy.TileEntityIC2reactorLaserMonitor; +import cr0s.warpdrive.block.forcefield.BlockForceField; +import cr0s.warpdrive.block.forcefield.BlockForceFieldProjector; +import cr0s.warpdrive.block.forcefield.BlockForceFieldRelay; +import cr0s.warpdrive.block.forcefield.ItemBlockForceFieldProjector; +import cr0s.warpdrive.block.forcefield.ItemBlockForceFieldRelay; +import cr0s.warpdrive.block.forcefield.TileEntityForceField; +import cr0s.warpdrive.block.forcefield.TileEntityForceFieldProjector; +import cr0s.warpdrive.block.forcefield.TileEntityForceFieldRelay; import cr0s.warpdrive.block.hull.BlockHullGlass; import cr0s.warpdrive.block.hull.BlockHullPlain; +import cr0s.warpdrive.block.hull.BlockHullStairs; import cr0s.warpdrive.block.hull.ItemBlockHull; import cr0s.warpdrive.block.movement.BlockLift; import cr0s.warpdrive.block.movement.BlockShipController; @@ -96,8 +83,17 @@ import cr0s.warpdrive.command.CommandGenerate; import cr0s.warpdrive.command.CommandInvisible; import cr0s.warpdrive.command.CommandJumpgates; import cr0s.warpdrive.command.CommandSpace; +import cr0s.warpdrive.config.RecipeParticleShapedOre; +import cr0s.warpdrive.config.RecipeTuningDriver; import cr0s.warpdrive.config.Recipes; import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.damage.DamageAsphyxia; +import cr0s.warpdrive.damage.DamageCold; +import cr0s.warpdrive.damage.DamageIrradiation; +import cr0s.warpdrive.damage.DamageLaser; +import cr0s.warpdrive.damage.DamageShock; +import cr0s.warpdrive.damage.DamageTeleportation; +import cr0s.warpdrive.damage.DamageWarm; import cr0s.warpdrive.data.CamerasRegistry; import cr0s.warpdrive.data.CloakManager; import cr0s.warpdrive.data.JumpgatesRegistry; @@ -105,16 +101,71 @@ import cr0s.warpdrive.data.StarMapRegistry; import cr0s.warpdrive.event.ClientHandler; import cr0s.warpdrive.event.LivingHandler; import cr0s.warpdrive.event.WorldHandler; +import cr0s.warpdrive.item.ItemAirCanisterFull; +import cr0s.warpdrive.item.ItemComponent; +import cr0s.warpdrive.item.ItemCrystalToken; +import cr0s.warpdrive.item.ItemElectromagneticCell; +import cr0s.warpdrive.item.ItemForceFieldShape; +import cr0s.warpdrive.item.ItemForceFieldUpgrade; +import cr0s.warpdrive.item.ItemIC2reactorLaserFocus; +import cr0s.warpdrive.item.ItemTuningDriver; +import cr0s.warpdrive.item.ItemTuningFork; +import cr0s.warpdrive.item.ItemUpgrade; +import cr0s.warpdrive.item.ItemWarpArmor; import cr0s.warpdrive.network.PacketHandler; import cr0s.warpdrive.render.ClientCameraHandler; import cr0s.warpdrive.render.RenderBlockForceField; import cr0s.warpdrive.render.RenderBlockStandard; import cr0s.warpdrive.render.RenderOverlayCamera; import cr0s.warpdrive.world.BiomeSpace; -import cr0s.warpdrive.world.HyperSpaceWorldProvider; import cr0s.warpdrive.world.HyperSpaceWorldGenerator; -import cr0s.warpdrive.world.SpaceWorldProvider; +import cr0s.warpdrive.world.HyperSpaceWorldProvider; import cr0s.warpdrive.world.SpaceWorldGenerator; +import cr0s.warpdrive.world.SpaceWorldProvider; +import org.apache.logging.log4j.Logger; + +import java.lang.reflect.Field; +import java.util.List; +import java.util.UUID; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockColored; +import net.minecraft.client.Minecraft; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraft.item.ItemDye; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.biome.BiomeGenBase; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLMissingMappingsEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraftforge.common.BiomeDictionary; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.LoadingCallback; +import net.minecraftforge.common.ForgeChunkManager.Ticket; +import net.minecraftforge.common.ForgeChunkManager.Type; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.EnumHelper; +import net.minecraftforge.oredict.RecipeSorter; + @Mod(modid = WarpDrive.MODID, name = "WarpDrive", version = WarpDrive.VERSION, dependencies = "after:IC2;" + " after:CoFHCore;" + " after:ComputerCraft;" + " after:OpenComputer;" + " after:CCTurtle;" + " after:gregtech;" + " after:AppliedEnergistics;" + " after:EnderIO;") @@ -248,7 +299,7 @@ public class WarpDrive implements LoadingCallback { WarpDriveConfig.onFMLInitialization(); // open access to Block.blockHardness - fieldBlockHardness = WarpDrive.getField(Block.class, "blockHardness", "field_149782_v"); + fieldBlockHardness = Commons.getField(Block.class, "blockHardness", "field_149782_v"); // CORE CONTROLLER blockShipController = new BlockShipController(); @@ -690,19 +741,6 @@ public class WarpDrive implements LoadingCallback { } } - public static void addChatMessage(final ICommandSender sender, final String message) { - if (sender == null) { - logger.error("Unable to send message to NULL sender: " + message); - return; - } - String[] lines = message.replace("§", "" + (char)167).replace("\\n", "\n").replaceAll("\u00A0", " ").split("\n"); - for (String line : lines) { - sender.addChatMessage(new ChatComponentText(line)); - } - - // logger.info(message); - } - @Mod.EventHandler public void onFMLMissingMappings(FMLMissingMappingsEvent event) { for (FMLMissingMappingsEvent.MissingMapping mapping: event.get()) { @@ -904,87 +942,4 @@ public class WarpDrive implements LoadingCallback { } } - // add tooltip information with text formatting and line splitting - // will ensure it fits on minimum screen width - public static void addTooltip(List list, String tooltip) { - final String charFormatting = "" + (char)167; - tooltip = tooltip.replace("§", charFormatting).replace("\\n", "\n").replace("|", "\n"); - tooltip = tooltip.replace(charFormatting + "r", charFormatting + "7"); - - String[] split = tooltip.split("\n"); - for (String line : split) { - String lineRemaining = line; - String formatNextLine = ""; - while (!lineRemaining.isEmpty()) { - int indexToCut = formatNextLine.length(); - int displayLength = 0; - int length = lineRemaining.length(); - while (indexToCut < length && displayLength <= 38) { - if (lineRemaining.charAt(indexToCut) == (char)167 && indexToCut + 1 < length) { - indexToCut++; - } else { - displayLength++; - } - indexToCut++; - } - if (indexToCut < length) { - indexToCut = lineRemaining.substring(0, indexToCut).lastIndexOf(' '); - if (indexToCut == -1 || indexToCut == 0) {// no space available, show the whole line 'as is' - list.add(lineRemaining); - lineRemaining = ""; - } else {// cut at last space - list.add(lineRemaining.substring(0, indexToCut).replaceAll("\u00A0", " ")); - - // compute remaining format - int index = formatNextLine.length(); - while (index <= indexToCut) { - if (lineRemaining.charAt(index) == (char)167 && index + 1 < indexToCut) { - index++; - formatNextLine += ("" + (char)167) + lineRemaining.charAt(index); - } - index++; - } - - // cut for next line, recovering current format - lineRemaining = formatNextLine + " " + lineRemaining.substring(indexToCut + 1); - } - } else { - list.add(lineRemaining.replaceAll("\u00A0", " ")); - lineRemaining = ""; - } - } - } - } - - public static Field getField(Class clazz, String deobfuscatedName, String obfuscatedName) { - Field fieldToReturn = null; - - try { - fieldToReturn = clazz.getDeclaredField(deobfuscatedName); - } catch (Exception exception1) { - try { - fieldToReturn = clazz.getDeclaredField(obfuscatedName); - } catch (Exception exception2) { - exception2.printStackTrace(); - String map = ""; - for(Field fieldDeclared : clazz.getDeclaredFields()) { - if (!map.isEmpty()) { - map += ", "; - } - map += fieldDeclared.getName(); - } - WarpDrive.logger.error(String.format("Unable to find %1$s field in %2$s class. Available fields are: %3$s", - deobfuscatedName, clazz.toString(), map)); - } - } - if (fieldToReturn != null) { - fieldToReturn.setAccessible(true); - } - return fieldToReturn; - } - - public static String format(final long value) { - // alternate: BigDecimal.valueOf(value).setScale(0, RoundingMode.HALF_EVEN).toPlainString(), - return String.format("%,d", Math.round(value)); - } } diff --git a/src/main/java/cr0s/warpdrive/WarpDrivePeripheralHandler.java b/src/main/java/cr0s/warpdrive/WarpDrivePeripheralHandler.java index 41422570..b9ee7ebc 100644 --- a/src/main/java/cr0s/warpdrive/WarpDrivePeripheralHandler.java +++ b/src/main/java/cr0s/warpdrive/WarpDrivePeripheralHandler.java @@ -1,12 +1,14 @@ package cr0s.warpdrive; -import cpw.mods.fml.common.Optional; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheralProvider; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import cpw.mods.fml.common.Optional; + @Optional.InterfaceList({ @Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheralProvider", modid = "ComputerCraft") }) diff --git a/src/main/java/cr0s/warpdrive/api/IAirCanister.java b/src/main/java/cr0s/warpdrive/api/IAirCanister.java index 4e671177..2cdbad7b 100644 --- a/src/main/java/cr0s/warpdrive/api/IAirCanister.java +++ b/src/main/java/cr0s/warpdrive/api/IAirCanister.java @@ -5,9 +5,9 @@ import net.minecraft.item.ItemStack; @Deprecated // we should use fluid storage instead here public interface IAirCanister { // Return true if that itemStack is Air compatible (i.e. may or already contains air) - public boolean canContainAir(ItemStack itemStack); + boolean canContainAir(ItemStack itemStack); - public boolean containsAir(ItemStack itemStack); - public ItemStack emptyDrop(ItemStack itemStack); - public ItemStack fullDrop(ItemStack itemStack); + boolean containsAir(ItemStack itemStack); + ItemStack emptyDrop(ItemStack itemStack); + ItemStack fullDrop(ItemStack itemStack); } diff --git a/src/main/java/cr0s/warpdrive/api/IBlockUpdateDetector.java b/src/main/java/cr0s/warpdrive/api/IBlockUpdateDetector.java index 1114cc84..e3903aa8 100644 --- a/src/main/java/cr0s/warpdrive/api/IBlockUpdateDetector.java +++ b/src/main/java/cr0s/warpdrive/api/IBlockUpdateDetector.java @@ -2,5 +2,5 @@ package cr0s.warpdrive.api; public interface IBlockUpdateDetector { - public void updatedNeighbours(); + void updatedNeighbours(); } diff --git a/src/main/java/cr0s/warpdrive/api/IBreathingHelmet.java b/src/main/java/cr0s/warpdrive/api/IBreathingHelmet.java index cdca3eba..6f2f460f 100644 --- a/src/main/java/cr0s/warpdrive/api/IBreathingHelmet.java +++ b/src/main/java/cr0s/warpdrive/api/IBreathingHelmet.java @@ -4,9 +4,9 @@ import net.minecraft.entity.Entity; public interface IBreathingHelmet { - public boolean canBreath(Entity player); + boolean canBreath(Entity player); - public boolean removeAir(Entity player); + boolean removeAir(Entity player); - public int ticksPerCanDamage(); + int ticksPerCanDamage(); } \ No newline at end of file diff --git a/src/main/java/cr0s/warpdrive/api/IDamageReceiver.java b/src/main/java/cr0s/warpdrive/api/IDamageReceiver.java index da417682..29860215 100644 --- a/src/main/java/cr0s/warpdrive/api/IDamageReceiver.java +++ b/src/main/java/cr0s/warpdrive/api/IDamageReceiver.java @@ -1,6 +1,7 @@ package cr0s.warpdrive.api; import cr0s.warpdrive.data.Vector3; + import net.minecraft.util.DamageSource; import net.minecraft.world.World; diff --git a/src/main/java/cr0s/warpdrive/api/IForceFieldShape.java b/src/main/java/cr0s/warpdrive/api/IForceFieldShape.java index d9320117..6918be3e 100644 --- a/src/main/java/cr0s/warpdrive/api/IForceFieldShape.java +++ b/src/main/java/cr0s/warpdrive/api/IForceFieldShape.java @@ -3,7 +3,6 @@ package cr0s.warpdrive.api; import cr0s.warpdrive.data.ForceFieldSetup; import cr0s.warpdrive.data.VectorI; -import java.util.Collection; import java.util.Map; public interface IForceFieldShape { diff --git a/src/main/java/cr0s/warpdrive/api/IStarMapRegistryTileEntity.java b/src/main/java/cr0s/warpdrive/api/IStarMapRegistryTileEntity.java index c92eae92..605727d4 100644 --- a/src/main/java/cr0s/warpdrive/api/IStarMapRegistryTileEntity.java +++ b/src/main/java/cr0s/warpdrive/api/IStarMapRegistryTileEntity.java @@ -1,11 +1,12 @@ package cr0s.warpdrive.api; import cr0s.warpdrive.data.VectorI; -import net.minecraft.block.Block; -import net.minecraft.util.AxisAlignedBB; import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.util.AxisAlignedBB; + public interface IStarMapRegistryTileEntity { // get the registry type diff --git a/src/main/java/cr0s/warpdrive/api/Particle.java b/src/main/java/cr0s/warpdrive/api/Particle.java index bd60aa45..c765c33d 100644 --- a/src/main/java/cr0s/warpdrive/api/Particle.java +++ b/src/main/java/cr0s/warpdrive/api/Particle.java @@ -1,13 +1,14 @@ package cr0s.warpdrive.api; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.item.EnumRarity; -import net.minecraft.util.StatCollector; +import cr0s.warpdrive.Commons; import java.util.Locale; -import static cr0s.warpdrive.config.WarpDriveConfig.clamp; +import net.minecraft.item.EnumRarity; +import net.minecraft.util.StatCollector; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class Particle { protected final String registryName; @@ -27,17 +28,17 @@ public class Particle { } public Particle setColorIndex(final int colorIndex) { - this.colorIndex = clamp(0, 4, colorIndex); + this.colorIndex = Commons.clamp(0, 4, colorIndex); return this; } public Particle setColor(final int colorIndex) { - this.color = clamp(0x000000, 0xFFFFFF, color); + this.color = Commons.clamp(0x000000, 0xFFFFFF, color); return this; } public Particle setColor(final int red, final int green, final int blue) { - this.color = (clamp(0, 255, red) << 16) + (clamp(0, 255, green) << 8) + clamp(0, 255, blue); + this.color = (Commons.clamp(0, 255, red) << 16) + (Commons.clamp(0, 255, green) << 8) + Commons.clamp(0, 255, blue); return this; } diff --git a/src/main/java/cr0s/warpdrive/api/ParticleRegistry.java b/src/main/java/cr0s/warpdrive/api/ParticleRegistry.java index f191a469..5d846d74 100644 --- a/src/main/java/cr0s/warpdrive/api/ParticleRegistry.java +++ b/src/main/java/cr0s/warpdrive/api/ParticleRegistry.java @@ -3,15 +3,17 @@ package cr0s.warpdrive.api; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.ImmutableMap; + +import java.util.Map; + +import net.minecraft.item.EnumRarity; + import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.eventhandler.Event; -import net.minecraft.item.EnumRarity; import net.minecraftforge.common.MinecraftForge; -import java.util.Map; - public class ParticleRegistry { private static BiMap particles = HashBiMap.create(); diff --git a/src/main/java/cr0s/warpdrive/api/ParticleStack.java b/src/main/java/cr0s/warpdrive/api/ParticleStack.java index b401b832..5d3184e1 100644 --- a/src/main/java/cr0s/warpdrive/api/ParticleStack.java +++ b/src/main/java/cr0s/warpdrive/api/ParticleStack.java @@ -1,10 +1,11 @@ package cr0s.warpdrive.api; -import cpw.mods.fml.common.FMLLog; +import javax.annotation.Nonnull; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; +import cpw.mods.fml.common.FMLLog; public class ParticleStack { private final Particle particle; diff --git a/src/main/java/cr0s/warpdrive/block/BlockAbstractContainer.java b/src/main/java/cr0s/warpdrive/block/BlockAbstractContainer.java index bc7491ab..fe69cc01 100644 --- a/src/main/java/cr0s/warpdrive/block/BlockAbstractContainer.java +++ b/src/main/java/cr0s/warpdrive/block/BlockAbstractContainer.java @@ -1,10 +1,12 @@ package cr0s.warpdrive.block; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IBlockBase; +import cr0s.warpdrive.api.IBlockUpdateDetector; import cr0s.warpdrive.config.WarpDriveConfig; import defense.api.IEMPBlock; import defense.api.IExplosion; + import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -17,8 +19,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBlockUpdateDetector; + +import cpw.mods.fml.common.Optional; import net.minecraftforge.common.util.ForgeDirection; @Optional.InterfaceList({ diff --git a/src/main/java/cr0s/warpdrive/block/BlockAirGenerator.java b/src/main/java/cr0s/warpdrive/block/BlockAirGenerator.java index 58a97560..8b88cf53 100644 --- a/src/main/java/cr0s/warpdrive/block/BlockAirGenerator.java +++ b/src/main/java/cr0s/warpdrive/block/BlockAirGenerator.java @@ -1,5 +1,9 @@ package cr0s.warpdrive.block; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.api.IAirCanister; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.util.Random; import net.minecraft.block.material.Material; @@ -12,9 +16,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IAirCanister; -import cr0s.warpdrive.config.WarpDriveConfig; public class BlockAirGenerator extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -91,7 +92,7 @@ public class BlockAirGenerator extends BlockAbstractContainer { TileEntityAirGenerator airGenerator = (TileEntityAirGenerator)tileEntity; ItemStack heldItemStack = entityPlayer.getHeldItem(); if (heldItemStack == null) { - WarpDrive.addChatMessage(entityPlayer, airGenerator.getStatus()); + Commons.addChatMessage(entityPlayer, airGenerator.getStatus()); return true; } else { Item heldItem = heldItemStack.getItem(); diff --git a/src/main/java/cr0s/warpdrive/block/BlockLaser.java b/src/main/java/cr0s/warpdrive/block/BlockLaser.java index 41dfa817..35774dcf 100644 --- a/src/main/java/cr0s/warpdrive/block/BlockLaser.java +++ b/src/main/java/cr0s/warpdrive/block/BlockLaser.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.block; +import cr0s.warpdrive.Commons; + import java.util.Random; import net.minecraft.block.material.Material; @@ -9,7 +11,6 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; public class BlockLaser extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -68,7 +69,7 @@ public class BlockLaser extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityLaser) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaser)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityLaser)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/BlockLaserMedium.java b/src/main/java/cr0s/warpdrive/block/BlockLaserMedium.java index 74e4a291..60fcd00e 100644 --- a/src/main/java/cr0s/warpdrive/block/BlockLaserMedium.java +++ b/src/main/java/cr0s/warpdrive/block/BlockLaserMedium.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.block; +import cr0s.warpdrive.Commons; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -7,7 +9,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; public class BlockLaserMedium extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -67,7 +68,7 @@ public class BlockLaserMedium extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityLaserMedium) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaserMedium) tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityLaserMedium) tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/ItemBlockAbstractBase.java b/src/main/java/cr0s/warpdrive/block/ItemBlockAbstractBase.java index 8ab5e0bf..536a157e 100644 --- a/src/main/java/cr0s/warpdrive/block/ItemBlockAbstractBase.java +++ b/src/main/java/cr0s/warpdrive/block/ItemBlockAbstractBase.java @@ -1,9 +1,10 @@ package cr0s.warpdrive.block; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.api.IBlockBase; + +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -14,7 +15,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class ItemBlockAbstractBase extends ItemBlock { @@ -74,14 +76,14 @@ public class ItemBlockAbstractBase extends ItemBlock { String tooltipName1 = getUnlocalizedName(itemStack) + ".tooltip"; if (StatCollector.canTranslate(tooltipName1)) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1)); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1)); } String tooltipName2 = getUnlocalizedName() + ".tooltip"; if ((!tooltipName1.equals(tooltipName2)) && StatCollector.canTranslate(tooltipName2)) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2)); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2)); } - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(getStatus(itemStack.getTagCompound(), itemStack.getItemDamage()))); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(getStatus(itemStack.getTagCompound(), itemStack.getItemDamage()))); } } diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java index 867bd62b..5e9132df 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java @@ -1,10 +1,20 @@ package cr0s.warpdrive.block; import cr0s.warpdrive.CommonProxy; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IBlockUpdateDetector; import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.VectorI; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; + import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; @@ -12,22 +22,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; public abstract class TileEntityAbstractBase extends TileEntity implements IBlockUpdateDetector { private boolean isFirstTick = true; @@ -49,10 +45,6 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc public void updatedNeighbours() { } - protected boolean isOnPlanet() { - return worldObj.provider.dimensionId == 0; - } - protected void updateMetadata(int metadata) { if (getBlockMetadata() != metadata) { worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 2); @@ -69,47 +61,14 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc // Inventory management methods - public static ItemStack copyWithSize(ItemStack itemStack, int newSize) { - ItemStack ret = itemStack.copy(); - ret.stackSize = newSize; - return ret; - } - - public static Collection getConnectedInventories(TileEntity tileEntityConnection) { - Collection result = new ArrayList<>(6); - - for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - TileEntity tileEntity = tileEntityConnection.getWorldObj().getTileEntity( - tileEntityConnection.xCoord + side.offsetX, tileEntityConnection.yCoord + side.offsetY, tileEntityConnection.zCoord + side.offsetZ); - if (tileEntity != null && (tileEntity instanceof IInventory)) { - result.add((IInventory) tileEntity); - - if (tileEntity instanceof TileEntityChest) { - TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; - tileEntityChest.checkForAdjacentChests(); - if (tileEntityChest.adjacentChestXNeg != null) { - result.add(tileEntityChest.adjacentChestXNeg); - } else if (tileEntityChest.adjacentChestXPos != null) { - result.add(tileEntityChest.adjacentChestXPos); - } else if (tileEntityChest.adjacentChestZNeg != null) { - result.add(tileEntityChest.adjacentChestZNeg); - } else if (tileEntityChest.adjacentChestZPos != null) { - result.add(tileEntityChest.adjacentChestZPos); - } - } - } - } - return result; - } - protected boolean addToConnectedInventories(final ItemStack itemStack) { List itemStacks = new ArrayList<>(1); itemStacks.add(itemStack); - return addToInventories(itemStacks, getConnectedInventories(this)); + return addToInventories(itemStacks, Commons.getConnectedInventories(this)); } protected boolean addToConnectedInventories(final List itemStacks) { - return addToInventories(itemStacks, getConnectedInventories(this)); + return addToInventories(itemStacks, Commons.getConnectedInventories(this)); } protected boolean addToInventories(final List itemStacks, final Collection inventories) { @@ -138,7 +97,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc int transfer; while (qtyLeft > 0) { transfer = Math.min(qtyLeft, itemStackLeft.getMaxStackSize()); - ItemStack itemStackDrop = copyWithSize(itemStackLeft, transfer); + ItemStack itemStackDrop = Commons.copyWithSize(itemStackLeft, transfer); EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5D, yCoord + 1.0D, zCoord + 0.5D, itemStackDrop); worldObj.spawnEntityInWorld(entityItem); qtyLeft -= transfer; @@ -189,7 +148,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc } transfer = Math.min(qtyLeft, itemStackSource.getMaxStackSize()); - ItemStack dest = copyWithSize(itemStackSource, transfer); + ItemStack dest = Commons.copyWithSize(itemStackSource, transfer); inventory.setInventorySlotContents(i, dest); qtyLeft -= transfer; @@ -203,96 +162,6 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc } - // searching methods - - public static final ForgeDirection[] UP_DIRECTIONS = { ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.EAST }; - public static final ForgeDirection[] HORIZONTAL_DIRECTIONS = { ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.EAST }; - public static Set getConnectedBlocks(World world, final VectorI start, final ForgeDirection[] directions, final Set whitelist, final int maxRange, final VectorI... ignore) { - return getConnectedBlocks(world, Collections.singletonList(start), directions, whitelist, maxRange, ignore); - } - public static Set getConnectedBlocks(World world, final Collection start, final ForgeDirection[] directions, final Set whitelist, final int maxRange, final VectorI... ignore) { - Set toIgnore = new HashSet<>(); - if (ignore != null) { - toIgnore.addAll(Arrays.asList(ignore)); - } - - Set toIterate = new HashSet<>(); - toIterate.addAll(start); - - Set toIterateNext; - - Set iterated = new HashSet<>(); - - int range = 0; - while(!toIterate.isEmpty() && range < maxRange) { - toIterateNext = new HashSet<>(); - for (VectorI current : toIterate) { - if (whitelist.contains(current.getBlock_noChunkLoading(world))) { - iterated.add(current); - } - - 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))) { - toIterateNext.add(next); - } - } - } - } - toIterate = toIterateNext; - range++; - } - - return iterated; - } - - - // data manipulation methods - - protected static int toInt(double d) { - return (int) Math.round(d); - } - - protected static int toInt(Object object) { - return toInt(toDouble(object)); - } - - protected static double toDouble(Object object) { - assert(!(object instanceof Object[])); - return Double.parseDouble(object.toString()); - } - - protected static float toFloat(Object object) { - assert(!(object instanceof Object[])); - return Float.parseFloat(object.toString()); - } - - protected static boolean toBool(Object object) { - if (object == null) { - return false; - } - assert(!(object instanceof Object[])); - if (object instanceof Boolean) { - return ((Boolean) object); - } - String string = object.toString(); - return string.equals("true") || string.equals("1.0") || string.equals("1") || string.equals("y") || string.equals("yes"); - } - - public static int clamp(final int min, final int max, final int value) { - return Math.min(max, Math.max(value, min)); - } - - public static float clamp(final float min, final float max, final float value) { - return Math.min(max, Math.max(value, min)); - } - - public static double clamp(final double min, final double max, final double value) { - return Math.min(max, Math.max(value, min)); - } - - // area protection protected boolean isBlockBreakCanceled(final UUID uuidPlayer, World world, final int eventX, final int eventY, final int eventZ) { return CommonProxy.isBlockBreakCanceled(uuidPlayer, xCoord, yCoord, zCoord, world, eventX, eventY, eventZ); diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractChunkLoading.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractChunkLoading.java index 17c31a51..10d03b41 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractChunkLoading.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractChunkLoading.java @@ -1,16 +1,16 @@ package cr0s.warpdrive.block; +import com.google.common.collect.ImmutableSet; +import cr0s.warpdrive.WarpDrive; + import java.util.ArrayList; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.ChunkCoordIntPair; + import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; -import com.google.common.collect.ImmutableSet; - -import cr0s.warpdrive.WarpDrive; - public abstract class TileEntityAbstractChunkLoading extends TileEntityAbstractEnergy { private final ArrayList ticketList = new ArrayList<>(); diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractEnergy.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractEnergy.java index 32c03705..91b6f070 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractEnergy.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractEnergy.java @@ -1,25 +1,28 @@ package cr0s.warpdrive.block; +import cofh.api.energy.IEnergyHandler; +import cofh.api.energy.IEnergyReceiver; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.peripheral.IComputerAccess; import ic2.api.energy.event.EnergyTileLoadEvent; import ic2.api.energy.event.EnergyTileUnloadEvent; import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySource; -import cofh.api.energy.IEnergyHandler; -import cofh.api.energy.IEnergyReceiver; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.StatCollector; + +import cpw.mods.fml.common.Optional; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.config.WarpDriveConfig; -import dan200.computercraft.api.lua.ILuaContext; -import dan200.computercraft.api.peripheral.IComputerAccess; @Optional.InterfaceList({ @Optional.Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore"), @@ -81,7 +84,7 @@ public abstract class TileEntityAbstractEnergy extends TileEntityAbstractInterfa } public int energy_getEnergyStored() { - return clamp(0, energy_getMaxStorage(), energyStored_internal); + return Commons.clamp(0, energy_getMaxStorage(), energyStored_internal); } // Methods to override @@ -150,8 +153,8 @@ public abstract class TileEntityAbstractEnergy extends TileEntityAbstractInterfa return ""; } return StatCollector.translateToLocalFormatted("warpdrive.energy.statusLine", - WarpDrive.format((long) convertInternalToEU_floor(energy_getEnergyStored())), - WarpDrive.format((long) convertInternalToEU_floor(energy_getMaxStorage())) ); + Commons.format((long) convertInternalToEU_floor(energy_getEnergyStored())), + Commons.format((long) convertInternalToEU_floor(energy_getMaxStorage())) ); } @Override diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractInterfaced.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractInterfaced.java index 075ccf51..59816c83 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractInterfaced.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractInterfaced.java @@ -1,8 +1,11 @@ package cr0s.warpdrive.block; -import java.net.URL; -import java.util.*; - +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import dan200.computercraft.api.ComputerCraftAPI; +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.peripheral.IComputerAccess; +import dan200.computercraft.api.peripheral.IPeripheral; import li.cil.oc.api.FileSystem; import li.cil.oc.api.Network; import li.cil.oc.api.machine.Arguments; @@ -14,14 +17,17 @@ import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.network.Message; import li.cil.oc.api.network.Node; import li.cil.oc.api.network.Visibility; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import net.minecraft.nbt.NBTTagCompound; + import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import dan200.computercraft.api.ComputerCraftAPI; -import dan200.computercraft.api.lua.ILuaContext; -import dan200.computercraft.api.peripheral.IComputerAccess; -import dan200.computercraft.api.peripheral.IPeripheral; // OpenComputer API: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/java/li/cil/oc/api diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractLaser.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractLaser.java index b21462d1..18ae6afe 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractLaser.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractLaser.java @@ -1,18 +1,19 @@ package cr0s.warpdrive.block; +import cr0s.warpdrive.config.WarpDriveConfig; +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + import java.util.LinkedList; import java.util.List; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.config.WarpDriveConfig; -import dan200.computercraft.api.lua.ILuaContext; -import dan200.computercraft.api.peripheral.IComputerAccess; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; // Abstract class to manage laser mediums public abstract class TileEntityAbstractLaser extends TileEntityAbstractInterfaced { diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAirGenerator.java b/src/main/java/cr0s/warpdrive/block/TileEntityAirGenerator.java index 7bdb7649..303e8fd0 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAirGenerator.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAirGenerator.java @@ -1,9 +1,6 @@ package cr0s.warpdrive.block; -import net.minecraft.block.Block; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.WarpDriveConfig; import dan200.computercraft.api.lua.ILuaContext; @@ -12,6 +9,12 @@ import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; +import net.minecraft.block.Block; +import net.minecraft.nbt.NBTTagCompound; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; + public class TileEntityAirGenerator extends TileEntityAbstractEnergy { private int cooldownTicks = 0; private boolean isEnabled = true; @@ -126,7 +129,7 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy { public Object[] enable(Object[] arguments) { if (arguments.length == 1) { - isEnabled = toBool(arguments[0]); + isEnabled = Commons.toBool(arguments[0]); } return new Object[] { isEnabled }; } diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityChunkLoader.java b/src/main/java/cr0s/warpdrive/block/TileEntityChunkLoader.java index cbecc1d4..c68a1309 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityChunkLoader.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityChunkLoader.java @@ -1,15 +1,17 @@ package cr0s.warpdrive.block; - -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.UpgradeType; import cr0s.warpdrive.item.ItemUpgrade; +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.peripheral.IComputerAccess; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.chunk.Chunk; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.UpgradeType; -import dan200.computercraft.api.lua.ILuaContext; -import dan200.computercraft.api.peripheral.IComputerAccess; + +import cpw.mods.fml.common.Optional; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading { @@ -93,10 +95,10 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading { return; } } - negDX = - clamp(0, WarpDriveConfig.CL_MAX_DISTANCE, negDX); - posDX = clamp(0, WarpDriveConfig.CL_MAX_DISTANCE, posDX); - negDZ = - clamp(0, WarpDriveConfig.CL_MAX_DISTANCE, negDZ); - posDZ = clamp(0, WarpDriveConfig.CL_MAX_DISTANCE, posDZ); + negDX = - Commons.clamp(0, WarpDriveConfig.CL_MAX_DISTANCE, negDX); + posDX = Commons.clamp(0, WarpDriveConfig.CL_MAX_DISTANCE, posDX); + negDZ = - Commons.clamp(0, WarpDriveConfig.CL_MAX_DISTANCE, negDZ); + posDZ = Commons.clamp(0, WarpDriveConfig.CL_MAX_DISTANCE, posDZ); minChunk = new ChunkCoordIntPair(myChunk.chunkXPos+negDX,myChunk.chunkZPos+negDZ); maxChunk = new ChunkCoordIntPair(myChunk.chunkXPos+posDX,myChunk.chunkZPos+posDZ); area = (posDX - negDX + 1) * (posDZ - negDZ + 1); @@ -136,7 +138,7 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading { switch (methodName) { case "radius": if (arguments.length == 1) { - int dist = toInt(arguments[0]); + int dist = Commons.toInt(arguments[0]); negDX = dist; negDZ = dist; posDX = dist; @@ -147,16 +149,16 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading { return new Object[]{false}; case "bounds": if (arguments.length == 4) { - negDX = toInt(arguments[0]); - posDX = toInt(arguments[1]); - negDZ = toInt(arguments[2]); - posDZ = toInt(arguments[3]); + negDX = Commons.toInt(arguments[0]); + posDX = Commons.toInt(arguments[1]); + negDZ = Commons.toInt(arguments[2]); + posDZ = Commons.toInt(arguments[3]); changedDistance(); } return new Object[]{negDX, posDX, negDZ, posDZ}; case "active": if (arguments.length == 1) - shouldLoad = toBool(arguments[0]); + shouldLoad = Commons.toBool(arguments[0]); return new Object[]{shouldChunkLoad()}; case "upgrades": return new Object[] { getUpgradesAsString() }; diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java b/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java index d0346e84..29ddef2e 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java @@ -1,14 +1,28 @@ package cr0s.warpdrive.block; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBeamFrequency; +import cr0s.warpdrive.api.IDamageReceiver; +import cr0s.warpdrive.api.IVideoChannel; +import cr0s.warpdrive.block.weapon.BlockLaserCamera; +import cr0s.warpdrive.block.weapon.TileEntityLaserCamera; +import cr0s.warpdrive.config.Dictionary; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.Vector3; +import cr0s.warpdrive.data.VectorI; +import cr0s.warpdrive.network.PacketHandler; +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import java.util.TreeMap; -import cr0s.warpdrive.api.IVideoChannel; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; @@ -21,19 +35,8 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; + import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBeamFrequency; -import cr0s.warpdrive.api.IDamageReceiver; -import cr0s.warpdrive.block.weapon.BlockLaserCamera; -import cr0s.warpdrive.block.weapon.TileEntityLaserCamera; -import cr0s.warpdrive.config.Dictionary; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.Vector3; -import cr0s.warpdrive.data.VectorI; -import cr0s.warpdrive.network.PacketHandler; -import dan200.computercraft.api.lua.ILuaContext; -import dan200.computercraft.api.peripheral.IComputerAccess; public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFrequency { @@ -146,7 +149,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre private void emitBeam(int beamEnergy) { int energy = beamEnergy; - int beamLengthBlocks = clamp(0, WarpDriveConfig.LASER_CANNON_RANGE_MAX, energy / 200); + int beamLengthBlocks = Commons.clamp(0, WarpDriveConfig.LASER_CANNON_RANGE_MAX, energy / 200); if (energy == 0 || beamFrequency > 65000 || beamFrequency <= 0) { if (WarpDriveConfig.LOGGING_WEAPON) { @@ -272,7 +275,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre // apply effects mopEntity.entityHit.setFire(WarpDriveConfig.LASER_CANNON_ENTITY_HIT_SET_ON_FIRE_SECONDS); if (entity != null) { - float damage = (float)clamp(0.0D, WarpDriveConfig.LASER_CANNON_ENTITY_HIT_MAX_DAMAGE, + float damage = (float) Commons.clamp(0.0D, WarpDriveConfig.LASER_CANNON_ENTITY_HIT_MAX_DAMAGE, WarpDriveConfig.LASER_CANNON_ENTITY_HIT_BASE_DAMAGE + energy / WarpDriveConfig.LASER_CANNON_ENTITY_HIT_ENERGY_PER_DAMAGE); entity.attackEntityFrom(DamageSource.inFire, damage); } else { @@ -280,7 +283,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre } if (energy > WarpDriveConfig.LASER_CANNON_ENTITY_HIT_EXPLOSION_ENERGY_THRESHOLD) { - float strength = (float)clamp(0.0D, WarpDriveConfig.LASER_CANNON_ENTITY_HIT_EXPLOSION_MAX_STRENGTH, + float strength = (float) Commons.clamp(0.0D, WarpDriveConfig.LASER_CANNON_ENTITY_HIT_EXPLOSION_MAX_STRENGTH, WarpDriveConfig.LASER_CANNON_ENTITY_HIT_EXPLOSION_BASE_STRENGTH + energy / WarpDriveConfig.LASER_CANNON_ENTITY_HIT_EXPLOSION_ENERGY_PER_STRENGTH); worldObj.newExplosion(null, mopEntity.entityHit.posX, mopEntity.entityHit.posY, mopEntity.entityHit.posZ, strength, true, true); } @@ -345,7 +348,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre // explode on unbreakable blocks if (hardness < 0.0F) { - float strength = (float)clamp(0.0D, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_MAX_STRENGTH, + float strength = (float) Commons.clamp(0.0D, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_MAX_STRENGTH, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_BASE_STRENGTH + energy / WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_ENERGY_PER_STRENGTH); if (WarpDriveConfig.LOGGING_WEAPON) { WarpDrive.logger.info("Explosion triggered with strength " + strength); @@ -356,9 +359,9 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre } // Compute parameters - int energyCost = clamp(WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ENERGY_MIN, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ENERGY_MAX, + int energyCost = Commons.clamp(WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ENERGY_MIN, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ENERGY_MAX, Math.round(hardness * WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ENERGY_PER_BLOCK_HARDNESS)); - double absorptionChance = clamp(0.0D, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ABSORPTION_MAX, + double absorptionChance = Commons.clamp(0.0D, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ABSORPTION_MAX, hardness * WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ABSORPTION_PER_BLOCK_HARDNESS); do { @@ -411,7 +414,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre } if (hardness >= WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_HARDNESS_THRESHOLD) { - float strength = (float)clamp(0.0D, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_MAX_STRENGTH, + float strength = (float) Commons.clamp(0.0D, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_MAX_STRENGTH, WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_BASE_STRENGTH + energy / WarpDriveConfig.LASER_CANNON_BLOCK_HIT_EXPLOSION_ENERGY_PER_STRENGTH); if (WarpDriveConfig.LOGGING_WEAPON) { WarpDrive.logger.info("Explosion triggered with strength " + strength); @@ -599,13 +602,13 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre try { float newYaw, newPitch; if (arguments.length == 2) { - newYaw = toFloat(arguments[0]); - newPitch = toFloat(arguments[1]); + newYaw = Commons.toFloat(arguments[0]); + newPitch = Commons.toFloat(arguments[1]); initiateBeamEmission(newYaw, newPitch); } else if (arguments.length == 3) { - float deltaX = -toFloat(arguments[0]); - float deltaY = -toFloat(arguments[1]); - float deltaZ = toFloat(arguments[2]); + float deltaX = -Commons.toFloat(arguments[0]); + float deltaY = -Commons.toFloat(arguments[1]); + float deltaZ = Commons.toFloat(arguments[2]); double horizontalDistance = MathHelper.sqrt_double(deltaX * deltaX + deltaZ * deltaZ); //noinspection SuspiciousNameCombination newYaw = (float) (Math.atan2(deltaX, deltaZ) * 180.0D / Math.PI); @@ -655,7 +658,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre case "beamFrequency": if (arguments.length == 1) { - setBeamFrequency(toInt(arguments[0])); + setBeamFrequency(Commons.toInt(arguments[0])); } return new Integer[]{ beamFrequency }; diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityLaserMedium.java b/src/main/java/cr0s/warpdrive/block/TileEntityLaserMedium.java index a9db8000..a602de77 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityLaserMedium.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityLaserMedium.java @@ -1,9 +1,11 @@ package cr0s.warpdrive.block; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; import cr0s.warpdrive.config.WarpDriveConfig; +import net.minecraft.nbt.NBTTagCompound; + +import net.minecraftforge.common.util.ForgeDirection; + public class TileEntityLaserMedium extends TileEntityAbstractEnergy { private int ticks = 0; diff --git a/src/main/java/cr0s/warpdrive/block/atomic/BlockAbstractAccelerator.java b/src/main/java/cr0s/warpdrive/block/atomic/BlockAbstractAccelerator.java index 5ba48f7d..29636ad8 100644 --- a/src/main/java/cr0s/warpdrive/block/atomic/BlockAbstractAccelerator.java +++ b/src/main/java/cr0s/warpdrive/block/atomic/BlockAbstractAccelerator.java @@ -3,6 +3,7 @@ package cr0s.warpdrive.block.atomic; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IBlockBase; import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EnumCreatureType; diff --git a/src/main/java/cr0s/warpdrive/block/atomic/BlockAcceleratorControlPoint.java b/src/main/java/cr0s/warpdrive/block/atomic/BlockAcceleratorControlPoint.java index 7132070e..eab4f636 100644 --- a/src/main/java/cr0s/warpdrive/block/atomic/BlockAcceleratorControlPoint.java +++ b/src/main/java/cr0s/warpdrive/block/atomic/BlockAcceleratorControlPoint.java @@ -1,8 +1,7 @@ package cr0s.warpdrive.block.atomic; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.Commons; + import net.minecraft.block.ITileEntityProvider; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -10,6 +9,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class BlockAcceleratorControlPoint extends BlockAbstractAccelerator implements ITileEntityProvider { @SideOnly(Side.CLIENT) @@ -46,7 +48,7 @@ public class BlockAcceleratorControlPoint extends BlockAbstractAccelerator imple TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityAcceleratorControlPoint) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityAcceleratorControlPoint)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityAcceleratorControlPoint)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/atomic/BlockChiller.java b/src/main/java/cr0s/warpdrive/block/atomic/BlockChiller.java index 0a958d55..b5741202 100644 --- a/src/main/java/cr0s/warpdrive/block/atomic/BlockChiller.java +++ b/src/main/java/cr0s/warpdrive/block/atomic/BlockChiller.java @@ -1,10 +1,11 @@ package cr0s.warpdrive.block.atomic; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.data.Vector3; import cr0s.warpdrive.network.PacketHandler; + +import java.util.Random; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -13,7 +14,8 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockChiller extends BlockAbstractAccelerator { diff --git a/src/main/java/cr0s/warpdrive/block/atomic/BlockParticlesInjector.java b/src/main/java/cr0s/warpdrive/block/atomic/BlockParticlesInjector.java index 9b39a41d..726f359b 100644 --- a/src/main/java/cr0s/warpdrive/block/atomic/BlockParticlesInjector.java +++ b/src/main/java/cr0s/warpdrive/block/atomic/BlockParticlesInjector.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.block.atomic; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class BlockParticlesInjector extends BlockAcceleratorControlPoint { @SideOnly(Side.CLIENT) diff --git a/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorControlPoint.java b/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorControlPoint.java index eee0bc65..b8441aa4 100644 --- a/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorControlPoint.java +++ b/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorControlPoint.java @@ -1,22 +1,24 @@ package cr0s.warpdrive.block.atomic; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IControlChannel; import cr0s.warpdrive.block.TileEntityAbstractInterfaced; import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.StatCollector; +import cpw.mods.fml.common.Optional; + public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfaced implements IControlChannel { // persistent properties @@ -24,9 +26,7 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa private int controlChannel = -1; // computed properties - private final static int PACKET_SEND_INTERVAL_TICKS = 60 * 20; private static final int UPDATE_INTERVAL_TICKS = 20; - private int packetSendTicks = 10; private int updateTicks; public TileEntityAcceleratorControlPoint() { @@ -58,12 +58,6 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa updateTicks = UPDATE_INTERVAL_TICKS; updateMetadata((controlChannel == -1) ? 0 : 1); } - - packetSendTicks--; - if (packetSendTicks <= 0) { - packetSendTicks = PACKET_SEND_INTERVAL_TICKS; - PacketHandler.sendVideoChannelPacket(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, controlChannel); - } } @Override @@ -85,7 +79,6 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa WarpDrive.logger.info(this + " Accelerator control point controlChannel channel set to " + controlChannel); } // force update through main thread since CC runs on server as 'client' - packetSendTicks = 0; markDirty(); } } @@ -160,7 +153,7 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa if (arguments.length == 1) { boolean enable; try { - enable = toBool(arguments[0]); + enable = Commons.toBool(arguments[0]); } catch (Exception exception) { throw new Exception("Function expects a boolean value"); } @@ -187,7 +180,7 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa case "controlChannel": if (arguments.length == 1) { - setControlChannel(toInt(arguments[0])); + setControlChannel(Commons.toInt(arguments[0])); } return new Integer[] { controlChannel }; diff --git a/src/main/java/cr0s/warpdrive/block/building/BlockShipScanner.java b/src/main/java/cr0s/warpdrive/block/building/BlockShipScanner.java index 067c16f8..0ea9867f 100644 --- a/src/main/java/cr0s/warpdrive/block/building/BlockShipScanner.java +++ b/src/main/java/cr0s/warpdrive/block/building/BlockShipScanner.java @@ -2,6 +2,7 @@ package cr0s.warpdrive.block.building; import java.util.Random; +import cr0s.warpdrive.Commons; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -9,7 +10,6 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockShipScanner extends BlockAbstractContainer { @@ -67,7 +67,7 @@ public class BlockShipScanner extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityShipScanner) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipScanner)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityShipScanner)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/building/TileEntityShipScanner.java b/src/main/java/cr0s/warpdrive/block/building/TileEntityShipScanner.java index f7c59a03..dd9b9b33 100644 --- a/src/main/java/cr0s/warpdrive/block/building/TileEntityShipScanner.java +++ b/src/main/java/cr0s/warpdrive/block/building/TileEntityShipScanner.java @@ -1,5 +1,23 @@ package cr0s.warpdrive.block.building; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.block.TileEntityAbstractEnergy; +import cr0s.warpdrive.block.movement.TileEntityShipCore; +import cr0s.warpdrive.config.Dictionary; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.JumpBlock; +import cr0s.warpdrive.data.JumpShip; +import cr0s.warpdrive.data.Transformation; +import cr0s.warpdrive.data.Vector3; +import cr0s.warpdrive.item.ItemCrystalToken; +import cr0s.warpdrive.network.PacketHandler; +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -9,11 +27,6 @@ import java.util.Date; import java.util.List; import java.util.UUID; -import cr0s.warpdrive.data.JumpShip; -import cr0s.warpdrive.item.ItemCrystalToken; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -28,20 +41,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.MathHelper; + +import cpw.mods.fml.common.Optional; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.TileEntityAbstractEnergy; -import cr0s.warpdrive.block.movement.TileEntityShipCore; -import cr0s.warpdrive.config.Dictionary; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.JumpBlock; -import cr0s.warpdrive.data.Transformation; -import cr0s.warpdrive.data.Vector3; -import cr0s.warpdrive.network.PacketHandler; -import dan200.computercraft.api.lua.ILuaContext; -import dan200.computercraft.api.peripheral.IComputerAccess; public class TileEntityShipScanner extends TileEntityAbstractEnergy { private boolean isActive = false; @@ -170,7 +173,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy { if (tileEntity instanceof TileEntityShipCore) { ((TileEntityShipCore)tileEntity).summonOwnerOnDeploy(playerName); if (entityPlayerMP != null) { - WarpDrive.addChatMessage(entityPlayerMP, "§6" + "Welcome aboard captain. Use the computer to get moving..."); + Commons.addChatMessage(entityPlayerMP, "§6" + "Welcome aboard captain. Use the computer to get moving..."); } } @@ -240,7 +243,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy { // Warn owner if deployment done but wait next tick for teleportation if (currentDeployIndex >= blocksToDeployCount) { if (entityPlayerMP != null) { - WarpDrive.addChatMessage(entityPlayerMP, "Ship complete. Teleporting captain to the main deck"); + Commons.addChatMessage(entityPlayerMP, "Ship complete. Teleporting captain to the main deck"); } } } @@ -782,10 +785,10 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy { private Object[] deploy(Object[] arguments) { if (arguments.length == 5) { String fileName = (String) arguments[0]; - int x = toInt(arguments[1]); - int y = toInt(arguments[2]); - int z = toInt(arguments[3]); - byte rotationSteps = (byte) toInt(arguments[4]); + int x = Commons.toInt(arguments[1]); + int y = Commons.toInt(arguments[2]); + int z = Commons.toInt(arguments[3]); + byte rotationSteps = (byte) Commons.toInt(arguments[4]); if (!new File(WarpDriveConfig.G_SCHEMALOCATION + "/" + fileName + ".schematic").exists()) { return new Object[] { 0, "Specified schematic file was not found!" }; @@ -866,7 +869,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy { } if (entityPlayers.size() > 1) { for (EntityPlayer entityPlayer : entityPlayers) { - WarpDrive.addChatMessage(entityPlayer, "§c" + "Too many players detected: please stand in the beam one at a time."); + Commons.addChatMessage(entityPlayer, "§c" + "Too many players detected: please stand in the beam one at a time."); cooldownPlayerDetection = 3 * SS_SEARCH_INTERVAL_TICKS; } warmupPlayerId = null; @@ -886,7 +889,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy { } } if (itemStack == null || slotIndex >= entityPlayer.inventory.getSizeInventory()) { - WarpDrive.addChatMessage(entityPlayer, "Please come back once you've a Crystal token."); + Commons.addChatMessage(entityPlayer, "Please come back once you've a Crystal token."); cooldownPlayerDetection = 3 * SS_SEARCH_INTERVAL_TICKS; return; } @@ -896,11 +899,11 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy { warmupPlayerId = entityPlayer.getUniqueID(); warmupPlayer = SS_SEARCH_WARMUP_INTERVALS + 1; warmupSchematicName = ItemCrystalToken.getSchematicName(itemStack); - WarpDrive.addChatMessage(entityPlayer, "§6" + String.format("Token '%1$s' detected!", warmupSchematicName, SS_SEARCH_WARMUP_INTERVALS)); + Commons.addChatMessage(entityPlayer, "§6" + String.format("Token '%1$s' detected!", warmupSchematicName, SS_SEARCH_WARMUP_INTERVALS)); } warmupPlayer--; if (warmupPlayer > 0) { - WarpDrive.addChatMessage(entityPlayer, String.format("Stand by for ship materialization in %2$d...", warmupSchematicName, warmupPlayer)); + Commons.addChatMessage(entityPlayer, String.format("Stand by for ship materialization in %2$d...", warmupSchematicName, warmupPlayer)); return; } // warmup done @@ -912,11 +915,11 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy { deployShip(ItemCrystalToken.getSchematicName(itemStack), targetX - xCoord, targetY - yCoord, targetZ - zCoord, rotationSteps, true, reason); if (!isActive) { // failed - WarpDrive.addChatMessage(entityPlayer, "§c" + reason.toString()); + Commons.addChatMessage(entityPlayer, "§c" + reason.toString()); cooldownPlayerDetection = 5 * SS_SEARCH_INTERVAL_TICKS; return; } - WarpDrive.addChatMessage(entityPlayer, "§6" + reason.toString()); + Commons.addChatMessage(entityPlayer, "§6" + reason.toString()); // success => remove token if (!entityPlayer.capabilities.isCreativeMode) { diff --git a/src/main/java/cr0s/warpdrive/block/collection/BlockLaserTreeFarm.java b/src/main/java/cr0s/warpdrive/block/collection/BlockLaserTreeFarm.java index 999b110f..70841870 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/BlockLaserTreeFarm.java +++ b/src/main/java/cr0s/warpdrive/block/collection/BlockLaserTreeFarm.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.block.collection; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; + import java.util.Random; import net.minecraft.block.material.Material; @@ -10,8 +13,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockLaserTreeFarm extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -97,7 +98,7 @@ public class BlockLaserTreeFarm extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityLaserTreeFarm) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaserTreeFarm)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityLaserTreeFarm)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/collection/BlockMiningLaser.java b/src/main/java/cr0s/warpdrive/block/collection/BlockMiningLaser.java index 6e0acc79..ad800177 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/BlockMiningLaser.java +++ b/src/main/java/cr0s/warpdrive/block/collection/BlockMiningLaser.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.block.collection; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; + import java.util.Random; import net.minecraft.block.material.Material; @@ -10,8 +13,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockMiningLaser extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -93,7 +94,7 @@ public class BlockMiningLaser extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityMiningLaser) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityMiningLaser)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityMiningLaser)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityAbstractMiner.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityAbstractMiner.java index 66529f3c..aed49a73 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityAbstractMiner.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityAbstractMiner.java @@ -1,5 +1,11 @@ package cr0s.warpdrive.block.collection; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.block.TileEntityAbstractLaser; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.Vector3; +import cr0s.warpdrive.data.VectorI; + import java.util.ArrayList; import java.util.List; @@ -8,22 +14,18 @@ import net.minecraft.block.BlockLiquid; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + import net.minecraftforge.common.util.ForgeDirection; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.TileEntityAbstractLaser; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.Vector3; -import cr0s.warpdrive.data.VectorI; public abstract class TileEntityAbstractMiner extends TileEntityAbstractLaser { // machine type - protected ForgeDirection laserOutputSide = ForgeDirection.NORTH; + protected ForgeDirection laserOutputSide = ForgeDirection.NORTH; // machine state - protected boolean enableSilktouch = false; + protected boolean enableSilktouch = false; // pre-computation - protected Vector3 laserOutput = null; + protected Vector3 laserOutput = null; public TileEntityAbstractMiner() { super(); diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java index f43c315e..318bbe02 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java @@ -1,21 +1,6 @@ package cr0s.warpdrive.block.collection; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.LinkedList; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import cpw.mods.fml.common.Optional; -import net.minecraft.block.Block; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.IPlantable; -import net.minecraftforge.common.util.ForgeDirection; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.Dictionary; import cr0s.warpdrive.config.WarpDriveConfig; @@ -24,6 +9,24 @@ import cr0s.warpdrive.data.VectorI; import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedList; + +import net.minecraft.block.Block; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.IPlantable; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { private boolean breakLeaves = false; @@ -327,7 +330,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { VectorI soil = soils.get(soilIndex); Block block = worldObj.getBlock(soil.x, soil.y, soil.z); soilIndex++; - Collection inventories = getConnectedInventories(this); + Collection inventories = Commons.getConnectedInventories(this); if (inventories == null || inventories.isEmpty()) { currentState = STATE_WARMUP; delayTargetTicks = TREE_FARM_WARMUP_DELAY_TICKS; @@ -523,7 +526,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { if (breakLeaves) { whitelist.addAll(Dictionary.BLOCKS_LEAVES); } - logPositions = getConnectedBlocks(worldObj, logPositions, UP_DIRECTIONS, whitelist, WarpDriveConfig.TREE_FARM_MAX_LOG_DISTANCE + laserMediumCount * WarpDriveConfig.TREE_FARM_MAX_LOG_DISTANCE_PER_MEDIUM); + logPositions = Commons.getConnectedBlocks(worldObj, logPositions, Commons.UP_DIRECTIONS, whitelist, WarpDriveConfig.TREE_FARM_MAX_LOG_DISTANCE + laserMediumCount * WarpDriveConfig.TREE_FARM_MAX_LOG_DISTANCE_PER_MEDIUM); } if (WarpDriveConfig.LOGGING_COLLECTION) { WarpDrive.logger.info("Found " + logPositions.size() + " valuables"); @@ -548,12 +551,12 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { if (radiusX == 0) { radiusX = 1; } - radiusX = clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, radiusX); + radiusX = Commons.clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, radiusX); radiusZ = tag.getInteger("radiusZ"); if (radiusZ == 0) { radiusZ = 1; } - radiusZ = clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, radiusZ); + radiusZ = Commons.clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, radiusZ); breakLeaves = tag.getBoolean("breakLeaves"); tapTrees = tag.getBoolean("tapTrees"); @@ -636,12 +639,12 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { private Object[] radius(Object[] arguments) { try { if (arguments.length == 1) { - radiusX = clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, toInt(arguments[0])); + radiusX = Commons.clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, Commons.toInt(arguments[0])); radiusZ = radiusX; markDirty(); } else if (arguments.length == 2) { - radiusX = clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, toInt(arguments[0])); - radiusZ = clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, toInt(arguments[1])); + radiusX = Commons.clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, Commons.toInt(arguments[0])); + radiusZ = Commons.clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, Commons.toInt(arguments[1])); markDirty(); } } catch(NumberFormatException exception) { @@ -654,7 +657,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { private Object[] breakLeaves(Object[] arguments) { if (arguments.length == 1) { try { - breakLeaves = toBool(arguments[0]); + breakLeaves = Commons.toBool(arguments[0]); markDirty(); } catch (Exception exception) { return new Object[] { breakLeaves }; @@ -666,7 +669,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { private Object[] silktouch(Object[] arguments) { if (arguments.length == 1) { try { - enableSilktouch = toBool(arguments[0]); + enableSilktouch = Commons.toBool(arguments[0]); markDirty(); } catch (Exception exception) { return new Object[] { enableSilktouch }; @@ -678,7 +681,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { private Object[] tapTrees(Object[] arguments) { if (arguments.length == 1) { try { - tapTrees = toBool(arguments[0]); + tapTrees = Commons.toBool(arguments[0]); markDirty(); } catch (Exception exception) { return new Object[] { tapTrees }; diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java index 120486c9..c9c9f9ed 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java @@ -1,17 +1,6 @@ package cr0s.warpdrive.block.collection; -import java.util.ArrayList; -import java.util.Arrays; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidRegistry; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.Dictionary; import cr0s.warpdrive.config.WarpDriveConfig; @@ -20,6 +9,20 @@ import cr0s.warpdrive.data.VectorI; import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import java.util.ArrayList; +import java.util.Arrays; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidRegistry; public class TileEntityMiningLaser extends TileEntityAbstractMiner { private final boolean canSilktouch = (WarpDriveConfig.MINING_LASER_SILKTOUCH_DEUTERIUM_L <= 0 || FluidRegistry.isFluidRegistered("deuterium")); @@ -84,7 +87,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { return; } - boolean isOnEarth = isOnPlanet(); + boolean isOnPlanet = WarpDrive.starMap.isPlanet(worldObj); delayTicks--; if (currentState == STATE_WARMUP) { @@ -99,7 +102,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { } else if (currentState == STATE_SCANNING) { if (delayTicks == WarpDriveConfig.MINING_LASER_SCAN_DELAY_TICKS - 1) { // check power level - enoughPower = consumeEnergyFromLaserMediums(isOnEarth ? WarpDriveConfig.MINING_LASER_PLANET_ENERGY_PER_LAYER : WarpDriveConfig.MINING_LASER_SPACE_ENERGY_PER_LAYER, true); + enoughPower = consumeEnergyFromLaserMediums(isOnPlanet ? WarpDriveConfig.MINING_LASER_PLANET_ENERGY_PER_LAYER : WarpDriveConfig.MINING_LASER_SPACE_ENERGY_PER_LAYER, true); if (!enoughPower) { updateMetadata(BlockMiningLaser.ICON_SCANNING_LOW_POWER); delayTicks = WarpDriveConfig.MINING_LASER_WARMUP_DELAY_TICKS; @@ -128,7 +131,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { } // consume power - enoughPower = consumeEnergyFromLaserMediums(isOnEarth ? WarpDriveConfig.MINING_LASER_PLANET_ENERGY_PER_LAYER : WarpDriveConfig.MINING_LASER_SPACE_ENERGY_PER_LAYER, false); + enoughPower = consumeEnergyFromLaserMediums(isOnPlanet ? WarpDriveConfig.MINING_LASER_PLANET_ENERGY_PER_LAYER : WarpDriveConfig.MINING_LASER_SPACE_ENERGY_PER_LAYER, false); if (!enoughPower) { updateMetadata(BlockMiningLaser.ICON_SCANNING_LOW_POWER); delayTicks = WarpDriveConfig.MINING_LASER_WARMUP_DELAY_TICKS; @@ -182,7 +185,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { } // consume power - int requiredPower = isOnEarth ? WarpDriveConfig.MINING_LASER_PLANET_ENERGY_PER_BLOCK : WarpDriveConfig.MINING_LASER_SPACE_ENERGY_PER_BLOCK; + int requiredPower = isOnPlanet ? WarpDriveConfig.MINING_LASER_PLANET_ENERGY_PER_BLOCK : WarpDriveConfig.MINING_LASER_SPACE_ENERGY_PER_BLOCK; if (!mineAllBlocks) { requiredPower *= WarpDriveConfig.MINING_LASER_ORESONLY_ENERGY_FACTOR; } @@ -442,7 +445,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { private Object[] onlyOres(Object[] arguments) { if (arguments.length == 1) { try { - mineAllBlocks = ! toBool(arguments[0]); + mineAllBlocks = ! Commons.toBool(arguments[0]); markDirty(); if (WarpDriveConfig.LOGGING_LUA) { WarpDrive.logger.info(this + " onlyOres set to " + !mineAllBlocks); @@ -457,7 +460,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { private Object[] offset(Object[] arguments) { if (arguments.length == 1) { try { - layerOffset = Math.min(256, Math.abs(toInt(arguments[0]))); + layerOffset = Math.min(256, Math.abs(Commons.toInt(arguments[0]))); markDirty(); if (WarpDriveConfig.LOGGING_LUA) { WarpDrive.logger.info(this + " offset set to " + layerOffset); @@ -472,7 +475,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { private Object[] silktouch(Object[] arguments) { if (arguments.length == 1) { try { - enableSilktouch = toBool(arguments[0]); + enableSilktouch = Commons.toBool(arguments[0]); markDirty(); if (WarpDriveConfig.LOGGING_LUA) { WarpDrive.logger.info(this + " silktouch set to " + enableSilktouch); diff --git a/src/main/java/cr0s/warpdrive/block/detection/BlockCamera.java b/src/main/java/cr0s/warpdrive/block/detection/BlockCamera.java index 035bf68a..fbe133eb 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/BlockCamera.java +++ b/src/main/java/cr0s/warpdrive/block/detection/BlockCamera.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.block.detection; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; + import java.util.Random; import net.minecraft.block.material.Material; @@ -9,8 +12,6 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockCamera extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -63,7 +64,7 @@ public class BlockCamera extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityCamera) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityCamera)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityCamera)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/detection/BlockCloakingCoil.java b/src/main/java/cr0s/warpdrive/block/detection/BlockCloakingCoil.java index 77fef6ee..6e6553fb 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/BlockCloakingCoil.java +++ b/src/main/java/cr0s/warpdrive/block/detection/BlockCloakingCoil.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.block.detection; +import cr0s.warpdrive.WarpDrive; + import java.util.Random; import net.minecraft.block.Block; @@ -7,8 +9,8 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.util.IIcon; + import net.minecraftforge.common.util.ForgeDirection; -import cr0s.warpdrive.WarpDrive; public class BlockCloakingCoil extends Block { private IIcon[] iconBuffer; diff --git a/src/main/java/cr0s/warpdrive/block/detection/BlockCloakingCore.java b/src/main/java/cr0s/warpdrive/block/detection/BlockCloakingCore.java index a89f1720..dd37e38c 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/BlockCloakingCore.java +++ b/src/main/java/cr0s/warpdrive/block/detection/BlockCloakingCore.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.block.detection; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; + import java.util.Random; import net.minecraft.block.Block; @@ -13,8 +16,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockCloakingCore extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -82,12 +83,12 @@ public class BlockCloakingCore extends BlockAbstractContainer { if (tileEntity instanceof TileEntityCloakingCore) { TileEntityCloakingCore cloakingCore = (TileEntityCloakingCore)tileEntity; if (entityPlayer.getHeldItem() == null) { - WarpDrive.addChatMessage(entityPlayer, cloakingCore.getStatus()); + Commons.addChatMessage(entityPlayer, cloakingCore.getStatus()); // + " isInvalid? " + te.isInvalid() + " Valid? " + te.isValid + " Cloaking? " + te.isCloaking + " Enabled? " + te.isEnabled return true; } else if (entityPlayer.getHeldItem().getItem() == Item.getItemFromBlock(Blocks.redstone_torch)) { cloakingCore.isEnabled = !cloakingCore.isEnabled; - WarpDrive.addChatMessage(entityPlayer, cloakingCore.getStatus()); + Commons.addChatMessage(entityPlayer, cloakingCore.getStatus()); return true; // } else if (xxx) {// TODO if player has advanced tool // WarpDrive.addChatMessage(entityPlayer, cloakingCore.getStatus() + "\n" + cloakingCore.getEnergyStatus()); diff --git a/src/main/java/cr0s/warpdrive/block/detection/BlockMonitor.java b/src/main/java/cr0s/warpdrive/block/detection/BlockMonitor.java index c185b096..148623c5 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/BlockMonitor.java +++ b/src/main/java/cr0s/warpdrive/block/detection/BlockMonitor.java @@ -1,5 +1,11 @@ package cr0s.warpdrive.block.detection; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.block.BlockAbstractContainer; +import cr0s.warpdrive.data.CameraRegistryItem; +import cr0s.warpdrive.render.ClientCameraHandler; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -9,11 +15,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; -import cr0s.warpdrive.data.CameraRegistryItem; -import cr0s.warpdrive.render.ClientCameraHandler; - public class BlockMonitor extends BlockAbstractContainer { private IIcon iconFront; private IIcon iconSide; @@ -55,10 +56,10 @@ public class BlockMonitor extends BlockAbstractContainer { int videoChannel = ((TileEntityMonitor)tileEntity).getVideoChannel(); CameraRegistryItem camera = WarpDrive.cameras.getCameraByVideoChannel(world, videoChannel); if (camera == null || entityPlayer.isSneaking()) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityMonitor)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityMonitor)tileEntity).getStatus()); return true; } else { - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.monitor.viewingCamera", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.monitor.viewingCamera", videoChannel, camera.position.chunkPosX, camera.position.chunkPosY, diff --git a/src/main/java/cr0s/warpdrive/block/detection/BlockRadar.java b/src/main/java/cr0s/warpdrive/block/detection/BlockRadar.java index 60c2fd80..7a9b4e00 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/BlockRadar.java +++ b/src/main/java/cr0s/warpdrive/block/detection/BlockRadar.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.block.detection; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; + import java.util.Random; import net.minecraft.block.material.Material; @@ -11,8 +14,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockRadar extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -105,7 +106,7 @@ public class BlockRadar extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityRadar) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityRadar)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityRadar)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/detection/BlockSiren.java b/src/main/java/cr0s/warpdrive/block/detection/BlockSiren.java index fdff29b4..a526257c 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/BlockSiren.java +++ b/src/main/java/cr0s/warpdrive/block/detection/BlockSiren.java @@ -1,9 +1,10 @@ package cr0s.warpdrive.block.detection; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.BlockAbstractContainer; + +import java.util.List; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -13,7 +14,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockSiren extends BlockAbstractContainer { diff --git a/src/main/java/cr0s/warpdrive/block/detection/BlockWarpIsolation.java b/src/main/java/cr0s/warpdrive/block/detection/BlockWarpIsolation.java index 5ae879ad..afa58645 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/BlockWarpIsolation.java +++ b/src/main/java/cr0s/warpdrive/block/detection/BlockWarpIsolation.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.block.detection; +import cr0s.warpdrive.WarpDrive; + import java.util.Random; import net.minecraft.block.Block; @@ -7,7 +9,6 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.util.IIcon; -import cr0s.warpdrive.WarpDrive; public class BlockWarpIsolation extends Block { private IIcon[] iconBuffer; diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java index e291cb55..5f664410 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java @@ -1,15 +1,6 @@ package cr0s.warpdrive.block.detection; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.StatCollector; -import net.minecraft.world.ChunkPosition; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IVideoChannel; import cr0s.warpdrive.block.TileEntityAbstractInterfaced; @@ -19,6 +10,18 @@ import cr0s.warpdrive.data.EnumCameraType; import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.StatCollector; +import net.minecraft.world.ChunkPosition; + +import cpw.mods.fml.common.Optional; public class TileEntityCamera extends TileEntityAbstractInterfaced implements IVideoChannel { private int videoChannel = -1; @@ -175,7 +178,7 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced implements IV if (methodName.equals("videoChannel")) { if (arguments.length == 1) { - setVideoChannel(toInt(arguments[0])); + setVideoChannel(Commons.toInt(arguments[0])); } return new Integer[] { videoChannel }; } diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java index 6c8e810e..87f04583 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java @@ -1,16 +1,6 @@ package cr0s.warpdrive.block.detection; -import java.util.Arrays; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.TileEntityAbstractEnergy; import cr0s.warpdrive.config.WarpDriveConfig; @@ -19,6 +9,19 @@ import cr0s.warpdrive.data.Vector3; import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import java.util.Arrays; + +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.StatCollector; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityCloakingCore extends TileEntityAbstractEnergy { public boolean isEnabled = false; @@ -420,7 +423,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy { switch (methodName) { case "tier": if (arguments.length == 1) { - if (toInt(arguments[0]) == 2) { + if (Commons.toInt(arguments[0]) == 2) { tier = 2; } else { tier = 1; @@ -434,7 +437,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy { case "enable": if (arguments.length == 1) { - isEnabled = toBool(arguments[0]); + isEnabled = Commons.toBool(arguments[0]); markDirty(); } return new Object[] { isEnabled }; diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java index 16466766..aaa886f0 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java @@ -1,14 +1,6 @@ package cr0s.warpdrive.block.detection; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.StatCollector; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IVideoChannel; import cr0s.warpdrive.block.TileEntityAbstractInterfaced; @@ -17,6 +9,17 @@ import cr0s.warpdrive.data.CameraRegistryItem; import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.StatCollector; + +import cpw.mods.fml.common.Optional; public class TileEntityMonitor extends TileEntityAbstractInterfaced implements IVideoChannel { private int videoChannel = -1; @@ -134,7 +137,7 @@ public class TileEntityMonitor extends TileEntityAbstractInterfaced implements I if (methodName.equals("videoChannel")) { if (arguments.length == 1) { - setVideoChannel(toInt(arguments[0])); + setVideoChannel(Commons.toInt(arguments[0])); } return new Integer[] { videoChannel }; } diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityRadar.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityRadar.java index 37064c38..e6132fb5 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityRadar.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityRadar.java @@ -1,14 +1,6 @@ package cr0s.warpdrive.block.detection; -import java.util.ArrayList; -import java.util.Arrays; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.TileEntityAbstractEnergy; import cr0s.warpdrive.config.WarpDriveConfig; @@ -16,6 +8,17 @@ import cr0s.warpdrive.data.StarMapRegistryItem; import cr0s.warpdrive.data.VectorI; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import java.util.ArrayList; +import java.util.Arrays; + +import net.minecraft.nbt.NBTTagCompound; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityRadar extends TileEntityAbstractEnergy { private ArrayList results; @@ -137,11 +140,11 @@ public class TileEntityRadar extends TileEntityAbstractEnergy { if (arguments.length == 1 && getBlockMetadata() != 2) { int newRadius; try { - newRadius = toInt(arguments[0]); + newRadius = Commons.toInt(arguments[0]); } catch(Exception exception) { return new Integer[] { radius }; } - radius = clamp(0, 10000, newRadius); + radius = Commons.clamp(0, 10000, newRadius); } return new Integer[] { radius }; } @@ -149,7 +152,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy { private Object[] getEnergyRequired(Object[] arguments) { try { if (arguments.length == 1) { - return new Object[] { calculateEnergyRequired(toInt(arguments[0])) }; + return new Object[] { calculateEnergyRequired(Commons.toInt(arguments[0])) }; } } catch (Exception exception) { return new Integer[] { -1 }; @@ -160,7 +163,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy { private Object[] getScanDuration(Object[] arguments) { try { if (arguments.length == 1) { - return new Object[] { 0.050D * calculateScanDuration(toInt(arguments[0])) }; + return new Object[] { 0.050D * calculateScanDuration(Commons.toInt(arguments[0])) }; } } catch (Exception exception) { return new Integer[] { -1 }; @@ -199,7 +202,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy { if (arguments.length == 1 && (results != null)) { int index; try { - index = toInt(arguments[0]); + index = Commons.toInt(arguments[0]); } catch(Exception exception) { return new Object[] { false, COMPUTER_ERROR_TAG, null, 0, 0, 0 }; } diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntitySiren.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntitySiren.java index 3aaaf2ff..5b7c71ac 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntitySiren.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntitySiren.java @@ -1,12 +1,14 @@ package cr0s.warpdrive.block.detection; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.block.TileEntityAbstractBase; +import cr0s.warpdrive.client.SirenSound; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.client.SirenSound; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.TileEntityAbstractBase; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; public class TileEntitySiren extends TileEntityAbstractBase { public enum SirenState { diff --git a/src/main/java/cr0s/warpdrive/block/energy/BlockEnanReactorCore.java b/src/main/java/cr0s/warpdrive/block/energy/BlockEnanReactorCore.java index 3deb07df..004c45d6 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/BlockEnanReactorCore.java +++ b/src/main/java/cr0s/warpdrive/block/energy/BlockEnanReactorCore.java @@ -1,6 +1,7 @@ package cr0s.warpdrive.block.energy; import cr0s.warpdrive.block.BlockAbstractContainer; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; diff --git a/src/main/java/cr0s/warpdrive/block/energy/BlockEnanReactorLaser.java b/src/main/java/cr0s/warpdrive/block/energy/BlockEnanReactorLaser.java index b7daca28..0d02a8f4 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/BlockEnanReactorLaser.java +++ b/src/main/java/cr0s/warpdrive/block/energy/BlockEnanReactorLaser.java @@ -1,6 +1,7 @@ package cr0s.warpdrive.block.energy; import cr0s.warpdrive.block.BlockAbstractContainer; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; diff --git a/src/main/java/cr0s/warpdrive/block/energy/BlockEnergyBank.java b/src/main/java/cr0s/warpdrive/block/energy/BlockEnergyBank.java index 8e7a7be4..9207536d 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/BlockEnergyBank.java +++ b/src/main/java/cr0s/warpdrive/block/energy/BlockEnergyBank.java @@ -1,11 +1,14 @@ package cr0s.warpdrive.block.energy; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.api.IWarpTool; +import cr0s.warpdrive.block.BlockAbstractContainer; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.EnumComponentType; import cr0s.warpdrive.item.ItemComponent; + +import java.util.List; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -20,10 +23,9 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; -import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockEnergyBank extends BlockAbstractContainer { @SideOnly(Side.CLIENT) @@ -130,18 +132,18 @@ public class BlockEnergyBank extends BlockAbstractContainer { ItemStack itemStack = new ItemStack(Item.getItemFromBlock(this), 1, world.getBlockMetadata(x, y, z)); switch (tileEntityEnergyBank.getMode(facing)) { case TileEntityEnergyBank.MODE_INPUT: - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", StatCollector.translateToLocalFormatted(itemStack.getUnlocalizedName() + ".name")) + StatCollector.translateToLocalFormatted("warpdrive.energy.side.changedToInput", facing.name())); return true; case TileEntityEnergyBank.MODE_OUTPUT: - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", StatCollector.translateToLocalFormatted(itemStack.getUnlocalizedName() + ".name")) + StatCollector.translateToLocalFormatted("warpdrive.energy.side.changedToOutput", facing.name())); return true; case TileEntityEnergyBank.MODE_DISABLED: default: - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", StatCollector.translateToLocalFormatted(itemStack.getUnlocalizedName() + ".name")) + StatCollector.translateToLocalFormatted("warpdrive.energy.side.changedToDisabled", facing.name())); return true; @@ -164,7 +166,7 @@ public class BlockEnergyBank extends BlockAbstractContainer { if (enumComponentType == null) { // no more upgrades to dismount - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.noUpgradeToDismount")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.noUpgradeToDismount")); return true; } @@ -178,25 +180,25 @@ public class BlockEnergyBank extends BlockAbstractContainer { tileEntityEnergyBank.dismountUpgrade(enumComponentType); // upgrade dismounted - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.dismounted", enumComponentType.name())); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.dismounted", enumComponentType.name())); return false; } } else if (itemStackHeld == null) {// no sneaking and no item in hand => show status - WarpDrive.addChatMessage(entityPlayer, tileEntityEnergyBank.getStatus()); + Commons.addChatMessage(entityPlayer, tileEntityEnergyBank.getStatus()); return true; } else if (enumComponentType != null) {// no sneaking and an upgrade in hand => mounting an upgrade // validate type if (tileEntityEnergyBank.getUpgradeMaxCount(enumComponentType) <= 0) { // invalid upgrade type - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.invalidUpgrade")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.invalidUpgrade")); return true; } if (!tileEntityEnergyBank.canUpgrade(enumComponentType)) { // too many upgrades - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.tooManyUpgrades", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.tooManyUpgrades", tileEntityEnergyBank.getUpgradeMaxCount(enumComponentType))); return true; } @@ -205,7 +207,7 @@ public class BlockEnergyBank extends BlockAbstractContainer { // validate quantity if (itemStackHeld.stackSize < 1) { // not enough upgrade items - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.notEnoughUpgrades")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.notEnoughUpgrades")); return true; } @@ -216,7 +218,7 @@ public class BlockEnergyBank extends BlockAbstractContainer { // mount the new upgrade item tileEntityEnergyBank.mountUpgrade(enumComponentType); // upgrade mounted - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.mounted", enumComponentType.name())); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.mounted", enumComponentType.name())); } return false; diff --git a/src/main/java/cr0s/warpdrive/block/energy/BlockIC2reactorLaserMonitor.java b/src/main/java/cr0s/warpdrive/block/energy/BlockIC2reactorLaserMonitor.java index 41a574f0..ac9d7203 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/BlockIC2reactorLaserMonitor.java +++ b/src/main/java/cr0s/warpdrive/block/energy/BlockIC2reactorLaserMonitor.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.block.energy; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -7,8 +10,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockIC2reactorLaserMonitor extends BlockAbstractContainer { static IIcon[] icons; @@ -68,7 +69,7 @@ public class BlockIC2reactorLaserMonitor extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityIC2reactorLaserMonitor) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityIC2reactorLaserMonitor) tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityIC2reactorLaserMonitor) tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorCore.java b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorCore.java index 128a160c..0dc4d54c 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorCore.java +++ b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorCore.java @@ -1,21 +1,24 @@ package cr0s.warpdrive.block.energy; -import java.util.Arrays; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.TileEntityAbstractEnergy; import cr0s.warpdrive.config.WarpDriveConfig; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import java.util.Arrays; + +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy { private int containedEnergy = 0; @@ -311,7 +314,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy { if (arguments.length == 1) { boolean activate; try { - activate = toBool(arguments[0]); + activate = Commons.toBool(arguments[0]); } catch (Exception exception) { throw new Exception("Function expects a boolean value"); } @@ -341,7 +344,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy { boolean doRelease; if (arguments.length > 0) { try { - doRelease = toBool(arguments[0]); + doRelease = Commons.toBool(arguments[0]); } catch (Exception exception) { throw new Exception("Function expects a boolean value"); } @@ -362,7 +365,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy { private Object[] releaseRate(Object[] arguments) throws Exception { int rate; try { - rate = toInt(arguments[0]); + rate = Commons.toInt(arguments[0]); } catch (Exception exception) { throw new Exception("Function expects an integer value"); } @@ -388,7 +391,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy { private Object[] releaseAbove(Object[] arguments) throws Exception { int above; try { - above = toInt(arguments[0]); + above = Commons.toInt(arguments[0]); } catch (Exception exception) { throw new Exception("Function expects an integer value"); } diff --git a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorLaser.java b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorLaser.java index 78b44230..fabd51fa 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorLaser.java +++ b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorLaser.java @@ -1,12 +1,6 @@ package cr0s.warpdrive.block.energy; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import cpw.mods.fml.common.Optional; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.TileEntityAbstractLaser; import cr0s.warpdrive.config.WarpDriveConfig; @@ -14,6 +8,15 @@ import cr0s.warpdrive.data.Vector3; import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser { Vector3 myVec; @@ -175,7 +178,7 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser { case "stabilize": if (arguments.length >= 1) { - stabilize(toInt(arguments[0])); + stabilize(Commons.toInt(arguments[0])); } break; diff --git a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnergyBank.java b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnergyBank.java index 6c4601d1..aa7e5ef3 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnergyBank.java +++ b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnergyBank.java @@ -1,14 +1,17 @@ package cr0s.warpdrive.block.energy; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.TileEntityAbstractEnergy; +import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.EnumComponentType; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.common.util.ForgeDirection; -import cr0s.warpdrive.block.TileEntityAbstractEnergy; -import cr0s.warpdrive.config.WarpDriveConfig; public class TileEntityEnergyBank extends TileEntityAbstractEnergy { @@ -46,7 +49,7 @@ public class TileEntityEnergyBank extends TileEntityAbstractEnergy { } private double getEfficiency() { - int upgradeCount = clamp(0, getUpgradeMaxCount(EnumComponentType.SUPERCONDUCTOR), getUpgradeCount(EnumComponentType.SUPERCONDUCTOR)); + int upgradeCount = Commons.clamp(0, getUpgradeMaxCount(EnumComponentType.SUPERCONDUCTOR), getUpgradeCount(EnumComponentType.SUPERCONDUCTOR)); return WarpDriveConfig.ENERGY_BANK_EFFICIENCY_PER_UPGRADE[upgradeCount]; } diff --git a/src/main/java/cr0s/warpdrive/block/energy/TileEntityIC2reactorLaserMonitor.java b/src/main/java/cr0s/warpdrive/block/energy/TileEntityIC2reactorLaserMonitor.java index 32f8968f..b429b876 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/TileEntityIC2reactorLaserMonitor.java +++ b/src/main/java/cr0s/warpdrive/block/energy/TileEntityIC2reactorLaserMonitor.java @@ -1,5 +1,11 @@ package cr0s.warpdrive.block.energy; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.block.TileEntityAbstractEnergy; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.Vector3; +import cr0s.warpdrive.item.ItemIC2reactorLaserFocus; +import cr0s.warpdrive.network.PacketHandler; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorChamber; @@ -14,14 +20,9 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; + import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.TileEntityAbstractEnergy; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.Vector3; -import cr0s.warpdrive.item.ItemIC2reactorLaserFocus; -import cr0s.warpdrive.network.PacketHandler; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityIC2reactorLaserMonitor extends TileEntityAbstractEnergy { private int ticks = WarpDriveConfig.IC2_REACTOR_COOLING_INTERVAL_TICKS; diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/BlockAbstractForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/BlockAbstractForceField.java index 18d471ed..bf4d3c33 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/BlockAbstractForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/BlockAbstractForceField.java @@ -2,6 +2,7 @@ package cr0s.warpdrive.block.forcefield; import cr0s.warpdrive.block.BlockAbstractContainer; import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.world.World; diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceField.java index ec67c8f5..bad2c920 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceField.java @@ -1,16 +1,18 @@ package cr0s.warpdrive.block.forcefield; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IDamageReceiver; import cr0s.warpdrive.block.hull.BlockHullGlass; import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.ForceFieldSetup; import cr0s.warpdrive.data.EnumPermissionNode; +import cr0s.warpdrive.data.ForceFieldSetup; import cr0s.warpdrive.data.Vector3; import cr0s.warpdrive.data.VectorI; import cr0s.warpdrive.render.RenderBlockForceField; + +import java.util.List; +import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.BlockGlass; import net.minecraft.block.material.Material; @@ -31,10 +33,10 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; -import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraftforge.common.util.ForgeDirection; public class BlockForceField extends BlockAbstractForceField implements IDamageReceiver { @SideOnly(Side.CLIENT) diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceFieldProjector.java b/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceFieldProjector.java index 4a7f5e1d..0cf5743a 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceFieldProjector.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceFieldProjector.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.block.forcefield; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.data.EnumForceFieldShape; import cr0s.warpdrive.data.EnumForceFieldUpgrade; import cr0s.warpdrive.item.ItemForceFieldShape; import cr0s.warpdrive.item.ItemForceFieldUpgrade; + +import java.util.List; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -20,9 +21,10 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraftforge.common.util.ForgeDirection; public class BlockForceFieldProjector extends BlockAbstractForceField { @SideOnly(Side.CLIENT) @@ -78,6 +80,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { } @SideOnly(Side.CLIENT) + @Override public void getSubBlocks(Item item, CreativeTabs creativeTab, List list) { for (int i = 0; i < 2; ++i) { list.add(new ItemStack(item, 1, i)); @@ -132,7 +135,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { if (enumForceFieldUpgrade == EnumForceFieldUpgrade.NONE) { // no more upgrades to dismount - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.noUpgradeToDismount")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.noUpgradeToDismount")); return true; } @@ -146,7 +149,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { tileEntityForceFieldProjector.dismountUpgrade(enumForceFieldUpgrade); // upgrade dismounted - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.dismounted", enumForceFieldUpgrade.name())); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.dismounted", enumForceFieldUpgrade.name())); return false; } else {// default to dismount shape @@ -162,21 +165,21 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { tileEntityForceFieldProjector.setShape(EnumForceFieldShape.NONE); // shape dismounted - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.shapeDismounted")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.shapeDismounted")); } else { // wrong side - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.wrongShapeSide")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.wrongShapeSide")); return true; } } else { // no shape to dismount - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.noShapeToDismount")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.noShapeToDismount")); return true; } } } else if (itemStackHeld == null) {// no sneaking and no item in hand => show status - WarpDrive.addChatMessage(entityPlayer, tileEntityForceFieldProjector.getStatus()); + Commons.addChatMessage(entityPlayer, tileEntityForceFieldProjector.getStatus()); return true; } else if (itemStackHeld.getItem() instanceof ItemForceFieldShape) {// no sneaking and shape in hand => mounting a shape @@ -185,7 +188,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { // validate quantity if (itemStackHeld.stackSize < (tileEntityForceFieldProjector.isDoubleSided ? 2 : 1)) { // not enough shape items - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted( + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted( tileEntityForceFieldProjector.isDoubleSided ? "warpdrive.upgrade.result.notEnoughShapes.double" : "warpdrive.upgrade.result.notEnoughShapes.single")); return true; @@ -206,11 +209,11 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { // mount the new shape item(s) tileEntityForceFieldProjector.setShape(EnumForceFieldShape.get(itemStackHeld.getItemDamage())); // shape mounted - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.shapeMounted")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.shapeMounted")); } else { // wrong side - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.wrongShapeSide")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.wrongShapeSide")); return true; } @@ -218,12 +221,12 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { // validate type if (tileEntityForceFieldProjector.getUpgradeMaxCount(enumForceFieldUpgrade) <= 0) { // invalid upgrade type - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.invalidProjectorUpgrade")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.invalidProjectorUpgrade")); return true; } if (!tileEntityForceFieldProjector.canUpgrade(enumForceFieldUpgrade)) { // too many upgrades - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.tooManyUpgrades", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.tooManyUpgrades", tileEntityForceFieldProjector.getUpgradeMaxCount(enumForceFieldUpgrade))); return true; } @@ -232,7 +235,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { // validate quantity if (itemStackHeld.stackSize < 1) { // not enough upgrade items - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.notEnoughUpgrades")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.notEnoughUpgrades")); return true; } @@ -243,7 +246,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField { // mount the new upgrade item tileEntityForceFieldProjector.mountUpgrade(enumForceFieldUpgrade); // upgrade mounted - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.mounted", enumForceFieldUpgrade)); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.mounted", enumForceFieldUpgrade)); } return false; diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceFieldRelay.java b/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceFieldRelay.java index c019a7e2..0dd73c8e 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceFieldRelay.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceFieldRelay.java @@ -1,10 +1,9 @@ package cr0s.warpdrive.block.forcefield; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.data.EnumForceFieldUpgrade; import cr0s.warpdrive.item.ItemForceFieldUpgrade; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; @@ -16,6 +15,9 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class BlockForceFieldRelay extends BlockAbstractForceField { @SideOnly(Side.CLIENT) private IIcon[] icons; @@ -97,23 +99,23 @@ public class BlockForceFieldRelay extends BlockAbstractForceField { tileEntityForceFieldRelay.setUpgrade(EnumForceFieldUpgrade.NONE); // upgrade dismounted - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.dismounted", enumForceFieldUpgrade.name())); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.dismounted", enumForceFieldUpgrade.name())); } else { // no more upgrades to dismount - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.noUpgradeToDismount")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.noUpgradeToDismount")); return true; } } else if (itemStackHeld == null) {// no sneaking and no item in hand to show status - WarpDrive.addChatMessage(entityPlayer, tileEntityForceFieldRelay.getStatus()); + Commons.addChatMessage(entityPlayer, tileEntityForceFieldRelay.getStatus()); return true; } else if (itemStackHeld.getItem() instanceof ItemForceFieldUpgrade) { // validate type if (EnumForceFieldUpgrade.get(itemStackHeld.getItemDamage()).maxCountOnRelay <= 0) { // invalid upgrade type - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.invalidRelayUpgrade")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.invalidRelayUpgrade")); return true; } @@ -121,7 +123,7 @@ public class BlockForceFieldRelay extends BlockAbstractForceField { // validate quantity if (itemStackHeld.stackSize < 1) { // not enough upgrade items - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.notEnoughUpgrades")); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.notEnoughUpgrades")); return true; } @@ -141,7 +143,7 @@ public class BlockForceFieldRelay extends BlockAbstractForceField { EnumForceFieldUpgrade enumForceFieldUpgrade = EnumForceFieldUpgrade.get(itemStackHeld.getItemDamage()); tileEntityForceFieldRelay.setUpgrade(enumForceFieldUpgrade); // upgrade mounted - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.mounted", enumForceFieldUpgrade.name())); + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.mounted", enumForceFieldUpgrade.name())); } return false; diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/ItemBlockForceFieldProjector.java b/src/main/java/cr0s/warpdrive/block/forcefield/ItemBlockForceFieldProjector.java index 9dc1ebd5..222159e1 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/ItemBlockForceFieldProjector.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/ItemBlockForceFieldProjector.java @@ -1,6 +1,7 @@ package cr0s.warpdrive.block.forcefield; import cr0s.warpdrive.block.ItemBlockAbstractBase; + import net.minecraft.block.Block; import net.minecraft.item.ItemStack; diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/ItemBlockForceFieldRelay.java b/src/main/java/cr0s/warpdrive/block/forcefield/ItemBlockForceFieldRelay.java index 80f6b6d8..c0dc2ed4 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/ItemBlockForceFieldRelay.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/ItemBlockForceFieldRelay.java @@ -1,6 +1,7 @@ package cr0s.warpdrive.block.forcefield; import cr0s.warpdrive.block.ItemBlockAbstractBase; + import net.minecraft.block.Block; public class ItemBlockForceFieldRelay extends ItemBlockAbstractBase { diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java index c3af9dd1..333000d5 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java @@ -1,6 +1,6 @@ package cr0s.warpdrive.block.forcefield; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IBeamFrequency; import cr0s.warpdrive.block.TileEntityAbstractEnergy; @@ -12,6 +12,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -19,6 +20,8 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.StatCollector; +import cpw.mods.fml.common.Optional; + public class TileEntityAbstractForceField extends TileEntityAbstractEnergy implements IBeamFrequency { // persistent properties protected byte tier = -1; @@ -166,7 +169,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple if (arguments.length == 1) { boolean enable; try { - enable = toBool(arguments[0]); + enable = Commons.toBool(arguments[0]); } catch (Exception exception) { throw new Exception("Function expects a boolean value"); } @@ -188,7 +191,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple case "beamFrequency": if (arguments.length == 1) { - setBeamFrequency(toInt(arguments[0])); + setBeamFrequency(Commons.toInt(arguments[0])); } return new Integer[]{ beamFrequency }; } diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceField.java index 678bbd46..d71fe819 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceField.java @@ -7,6 +7,7 @@ import cr0s.warpdrive.config.Dictionary; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.ForceFieldSetup; import cr0s.warpdrive.data.VectorI; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java index f63ef038..f42d914e 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java @@ -1,18 +1,32 @@ package cr0s.warpdrive.block.forcefield; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IBeamFrequency; import cr0s.warpdrive.api.IForceFieldShape; -import cr0s.warpdrive.config.*; import cr0s.warpdrive.config.Dictionary; -import cr0s.warpdrive.data.*; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.EnumForceFieldShape; +import cr0s.warpdrive.data.EnumForceFieldUpgrade; +import cr0s.warpdrive.data.ForceFieldSetup; +import cr0s.warpdrive.data.Vector3; +import cr0s.warpdrive.data.VectorI; import cr0s.warpdrive.network.PacketHandler; -import cpw.mods.fml.common.Optional; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; + import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockStaticLiquid; @@ -29,14 +43,13 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; + +import cpw.mods.fml.common.Optional; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import java.util.*; -import java.util.concurrent.atomic.AtomicBoolean; - public class TileEntityForceFieldProjector extends TileEntityAbstractForceField { private static final int PROJECTOR_MAX_ENERGY_STORED = 30000; private static final int PROJECTOR_COOLDOWN_TICKS = 300; @@ -233,7 +246,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField continue; } - WarpDrive.addChatMessage((EntityPlayer) entity, msg); + Commons.addChatMessage((EntityPlayer) entity, msg); } } } @@ -723,7 +736,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField } private void setMin(final float x, final float y, final float z) { - v3Min = new Vector3(clamp(-1.0D, 0.0D, x), clamp(-1.0D, 0.0D, y), clamp(-1.0D, 0.0D, z)); + v3Min = new Vector3(Commons.clamp(-1.0D, 0.0D, x), Commons.clamp(-1.0D, 0.0D, y), Commons.clamp(-1.0D, 0.0D, z)); } public Vector3 getMax() { @@ -731,7 +744,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField } private void setMax(final float x, final float y, final float z) { - v3Max = new Vector3(clamp(0.0D, 1.0D, x), clamp(0.0D, 1.0D, y), clamp(0.0D, 1.0D, z)); + v3Max = new Vector3(Commons.clamp(0.0D, 1.0D, x), Commons.clamp(0.0D, 1.0D, y), Commons.clamp(0.0D, 1.0D, z)); } public float getRotationYaw() { @@ -782,8 +795,8 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField float oldYaw = this.rotationYaw; float oldPitch = this.rotationPitch; float oldRoll = this.rotationRoll; - this.rotationYaw = clamp( -45.0F, +45.0F, rotationYaw); - this.rotationPitch = clamp( -45.0F, +45.0F, rotationPitch); + this.rotationYaw = Commons.clamp( -45.0F, +45.0F, rotationYaw); + this.rotationPitch = Commons.clamp( -45.0F, +45.0F, rotationPitch); this.rotationRoll = (rotationRoll + 720.0F) % 360.0F - 180.0F; if (oldYaw != this.rotationYaw || oldPitch != this.rotationPitch || oldRoll != this.rotationRoll) { isDirty.set(true); @@ -818,7 +831,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField } private void setTranslation(final float x, final float y, final float z) { - v3Translation = new Vector3(clamp(-1.0D, 1.0D, x), clamp(-1.0D, 1.0D, y), clamp(-1.0D, 1.0D, z)); + v3Translation = new Vector3(Commons.clamp(-1.0D, 1.0D, x), Commons.clamp(-1.0D, 1.0D, y), Commons.clamp(-1.0D, 1.0D, z)); } @Override @@ -1071,31 +1084,31 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField switch (methodName) { case "min": if (arguments.length == 1) { - setMin(toFloat(arguments[0]), toFloat(arguments[0]), toFloat(arguments[0])); + setMin(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0])); } else if (arguments.length == 2) { - setMin(toFloat(arguments[0]), toFloat(arguments[1]), toFloat(arguments[0])); + setMin(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0])); } else if (arguments.length == 3) { - setMin(toFloat(arguments[0]), toFloat(arguments[1]), toFloat(arguments[2])); + setMin(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[2])); } return new Double[] { v3Min.x, v3Min.y, v3Min.z }; case "max": if (arguments.length == 1) { - setMax(toFloat(arguments[0]), toFloat(arguments[0]), toFloat(arguments[0])); + setMax(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0])); } else if (arguments.length == 2) { - setMax(toFloat(arguments[0]), toFloat(arguments[1]), toFloat(arguments[0])); + setMax(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0])); } else if (arguments.length == 3) { - setMax(toFloat(arguments[0]), toFloat(arguments[1]), toFloat(arguments[2])); + setMax(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[2])); } return new Double[] { v3Max.x, v3Max.y, v3Max.z }; case "rotation": if (arguments.length == 1) { - setRotation(toFloat(arguments[0]), rotationPitch, rotationRoll); + setRotation(Commons.toFloat(arguments[0]), rotationPitch, rotationRoll); } else if (arguments.length == 2) { - setRotation(toFloat(arguments[0]), toFloat(arguments[1]), rotationRoll); + setRotation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), rotationRoll); } else if (arguments.length == 3) { - setRotation(toFloat(arguments[0]), toFloat(arguments[1]), toFloat(arguments[2])); + setRotation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[2])); } return new Float[] { rotationYaw, rotationPitch, rotationRoll }; @@ -1104,11 +1117,11 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField case "translation": if (arguments.length == 1) { - setTranslation(toFloat(arguments[0]), toFloat(arguments[0]), toFloat(arguments[0])); + setTranslation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0])); } else if (arguments.length == 2) { - setTranslation(toFloat(arguments[0]), toFloat(arguments[1]), toFloat(arguments[0])); + setTranslation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0])); } else if (arguments.length == 3) { - setTranslation(toFloat(arguments[0]), toFloat(arguments[1]), toFloat(arguments[2])); + setTranslation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[2])); } return new Double[] { v3Translation.x, v3Translation.y, v3Translation.z }; } diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldRelay.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldRelay.java index b28cad2e..70eca013 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldRelay.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldRelay.java @@ -4,6 +4,7 @@ import cr0s.warpdrive.api.IForceFieldUpgrade; import cr0s.warpdrive.api.IForceFieldUpgradeEffector; import cr0s.warpdrive.data.EnumForceFieldUpgrade; import cr0s.warpdrive.data.ForceFieldSetup; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; diff --git a/src/main/java/cr0s/warpdrive/block/hull/BlockHullGlass.java b/src/main/java/cr0s/warpdrive/block/hull/BlockHullGlass.java index 86a04b5e..7e91887d 100644 --- a/src/main/java/cr0s/warpdrive/block/hull/BlockHullGlass.java +++ b/src/main/java/cr0s/warpdrive/block/hull/BlockHullGlass.java @@ -1,6 +1,10 @@ package cr0s.warpdrive.block.hull; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IDamageReceiver; +import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.Vector3; + import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.block.BlockGlass; @@ -8,10 +12,8 @@ import net.minecraft.block.material.Material; import net.minecraft.util.DamageSource; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.common.util.ForgeDirection; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IDamageReceiver; -import cr0s.warpdrive.config.WarpDriveConfig; public class BlockHullGlass extends BlockColored implements IDamageReceiver { final byte tier; diff --git a/src/main/java/cr0s/warpdrive/block/hull/BlockHullPlain.java b/src/main/java/cr0s/warpdrive/block/hull/BlockHullPlain.java index 0459bec4..343bce6e 100644 --- a/src/main/java/cr0s/warpdrive/block/hull/BlockHullPlain.java +++ b/src/main/java/cr0s/warpdrive/block/hull/BlockHullPlain.java @@ -1,10 +1,12 @@ package cr0s.warpdrive.block.hull; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IDamageReceiver; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.Vector3; + import java.util.List; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.data.Vector3; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; @@ -16,9 +18,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IDamageReceiver; -import cr0s.warpdrive.config.WarpDriveConfig; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockHullPlain extends Block implements IDamageReceiver { @SideOnly(Side.CLIENT) diff --git a/src/main/java/cr0s/warpdrive/block/hull/BlockHullStairs.java b/src/main/java/cr0s/warpdrive/block/hull/BlockHullStairs.java index e6ce8ae5..7ddd23a2 100644 --- a/src/main/java/cr0s/warpdrive/block/hull/BlockHullStairs.java +++ b/src/main/java/cr0s/warpdrive/block/hull/BlockHullStairs.java @@ -4,6 +4,7 @@ import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IDamageReceiver; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.Vector3; + import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.block.BlockStairs; diff --git a/src/main/java/cr0s/warpdrive/block/hull/ItemBlockHull.java b/src/main/java/cr0s/warpdrive/block/hull/ItemBlockHull.java index 841bc7f9..b7ac959e 100644 --- a/src/main/java/cr0s/warpdrive/block/hull/ItemBlockHull.java +++ b/src/main/java/cr0s/warpdrive/block/hull/ItemBlockHull.java @@ -1,7 +1,5 @@ package cr0s.warpdrive.block.hull; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.item.EnumRarity; @@ -10,6 +8,9 @@ import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class ItemBlockHull extends ItemBlock { public ItemBlockHull(Block block) { diff --git a/src/main/java/cr0s/warpdrive/block/movement/BlockLift.java b/src/main/java/cr0s/warpdrive/block/movement/BlockLift.java index 47ed0b9c..44380cdd 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/BlockLift.java +++ b/src/main/java/cr0s/warpdrive/block/movement/BlockLift.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.block.movement; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; + import java.util.Random; import net.minecraft.block.material.Material; @@ -10,8 +13,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockLift extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -93,7 +94,7 @@ public class BlockLift extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityLift) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityLift)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityLift)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/movement/BlockShipController.java b/src/main/java/cr0s/warpdrive/block/movement/BlockShipController.java index a4dcc006..4b4d6973 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/BlockShipController.java +++ b/src/main/java/cr0s/warpdrive/block/movement/BlockShipController.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.block.movement; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; + import java.util.Random; import net.minecraft.block.material.Material; @@ -10,10 +13,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockShipController extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -106,9 +108,9 @@ public class BlockShipController extends BlockAbstractContainer { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityShipController) { if (entityPlayer.isSneaking()) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipController)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityShipController)tileEntity).getStatus()); } else { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipController)tileEntity).attachPlayer(entityPlayer)); + Commons.addChatMessage(entityPlayer, ((TileEntityShipController)tileEntity).attachPlayer(entityPlayer)); } return true; } diff --git a/src/main/java/cr0s/warpdrive/block/movement/BlockShipCore.java b/src/main/java/cr0s/warpdrive/block/movement/BlockShipCore.java index 37ce0e09..ac9e1163 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/BlockShipCore.java +++ b/src/main/java/cr0s/warpdrive/block/movement/BlockShipCore.java @@ -1,10 +1,13 @@ package cr0s.warpdrive.block.movement; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.block.BlockAbstractContainer; +import cr0s.warpdrive.data.EnumComponentType; +import cr0s.warpdrive.item.ItemComponent; + import java.util.ArrayList; import java.util.Random; -import cr0s.warpdrive.data.EnumComponentType; -import cr0s.warpdrive.item.ItemComponent; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityTNTPrimed; @@ -14,8 +17,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockShipCore extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -132,7 +133,7 @@ public class BlockShipCore extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityShipCore) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipCore)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityShipCore)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/movement/BlockTransporter.java b/src/main/java/cr0s/warpdrive/block/movement/BlockTransporter.java index 05b13474..026f7c5f 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/BlockTransporter.java +++ b/src/main/java/cr0s/warpdrive/block/movement/BlockTransporter.java @@ -1,7 +1,8 @@ package cr0s.warpdrive.block.movement; -import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.block.BlockAbstractContainer; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -54,7 +55,7 @@ public class BlockTransporter extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityTransporter) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityTransporter)tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityTransporter)tileEntity).getStatus()); return true; } } diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityLift.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityLift.java index 0815894f..2efe0be6 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityLift.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityLift.java @@ -1,23 +1,26 @@ package cr0s.warpdrive.block.movement; -import java.util.List; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.block.TileEntityAbstractEnergy; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.Vector3; import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityLift extends TileEntityAbstractEnergy { private static final int MODE_REDSTONE = -1; @@ -169,13 +172,13 @@ public class TileEntityLift extends TileEntityAbstractEnergy { public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); if (tag.hasKey("mode")) { - mode = clamp(-1, 2, tag.getByte("mode")); + mode = Commons.clamp(-1, 2, tag.getByte("mode")); } if (tag.hasKey("computerEnabled")) { computerEnabled = tag.getBoolean("computerEnabled"); } if (tag.hasKey("computerMode")) { - computerMode = clamp(-1, 2, tag.getByte("computerMode")); + computerMode = Commons.clamp(-1, 2, tag.getByte("computerMode")); } } @@ -254,7 +257,7 @@ public class TileEntityLift extends TileEntityAbstractEnergy { } else if (methodName.equals("active")) { if (arguments.length == 1) { - computerEnabled = toBool(arguments[0]); + computerEnabled = Commons.toBool(arguments[0]); } return new Object[] { !computerEnabled && isEnabled }; } diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java index 61e0e8c8..ece16dd6 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java @@ -1,17 +1,6 @@ package cr0s.warpdrive.block.movement; -import java.util.ArrayList; -import java.util.Arrays; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.DamageSource; -import net.minecraft.util.StatCollector; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.TileEntityAbstractInterfaced; import cr0s.warpdrive.block.movement.TileEntityShipCore.EnumShipCoreMode; @@ -19,11 +8,21 @@ import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.VectorI; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import java.util.ArrayList; +import java.util.Arrays; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.DamageSource; +import net.minecraft.util.StatCollector; + +import cpw.mods.fml.common.Optional; -/** - * Protocol block tile entity - * @author Cr0s - */ public class TileEntityShipController extends TileEntityAbstractInterfaced { // Variables private int distance = 0; @@ -595,9 +594,9 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { try { if (arguments.length == 3) { int argInt0, argInt1, argInt2; - argInt0 = clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(toInt(arguments[0]))); - argInt1 = clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(toInt(arguments[1]))); - argInt2 = clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(toInt(arguments[2]))); + argInt0 = Commons.clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(Commons.toInt(arguments[0]))); + argInt1 = Commons.clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(Commons.toInt(arguments[1]))); + argInt2 = Commons.clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(Commons.toInt(arguments[2]))); if (WarpDriveConfig.LOGGING_LUA) { WarpDrive.logger.info(this + " Positive dimensions set to front " + argInt0 + ", right " + argInt1 + ", up " + argInt2); } @@ -616,9 +615,9 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { try { if (arguments.length == 3) { int argInt0, argInt1, argInt2; - argInt0 = clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(toInt(arguments[0]))); - argInt1 = clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(toInt(arguments[1]))); - argInt2 = clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(toInt(arguments[2]))); + argInt0 = Commons.clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(Commons.toInt(arguments[0]))); + argInt1 = Commons.clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(Commons.toInt(arguments[1]))); + argInt2 = Commons.clamp(0, WarpDriveConfig.SHIP_MAX_SIDE_SIZE, Math.abs(Commons.toInt(arguments[2]))); if (WarpDriveConfig.LOGGING_LUA) { WarpDrive.logger.info(this + " Negative dimensions set to back " + argInt0 + ", left " + argInt1 + ", down " + argInt2); } @@ -636,7 +635,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { private Object[] mode(Object[] arguments) { try { if (arguments.length == 1) { - setMode(toInt(arguments[0])); + setMode(Commons.toInt(arguments[0])); } } catch (Exception exception) { return new Integer[] { mode.getCode() }; @@ -648,7 +647,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { private Object[] distance(Object[] arguments) { try { if (arguments.length == 1) { - setDistance(toInt(arguments[0])); + setDistance(Commons.toInt(arguments[0])); } } catch (Exception exception) { return new Integer[] { getDistance() }; @@ -660,7 +659,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { private Object[] direction(Object[] arguments) { try { if (arguments.length == 1) { - setDirection(toInt(arguments[0])); + setDirection(Commons.toInt(arguments[0])); } } catch (Exception exception) { return new Integer[] { getDirection() }; @@ -672,7 +671,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { private Object[] movement(Object[] arguments) { try { if (arguments.length == 3) { - setMovement(toInt(arguments[0]), toInt(arguments[1]), toInt(arguments[2])); + setMovement(Commons.toInt(arguments[0]), Commons.toInt(arguments[1]), Commons.toInt(arguments[2])); } } catch (Exception exception) { return new Integer[] { moveFront, moveUp, moveRight }; @@ -684,7 +683,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { private Object[] rotationSteps(Object[] arguments) { try { if (arguments.length == 1) { - setRotationSteps((byte)toInt(arguments[0])); + setRotationSteps((byte) Commons.toInt(arguments[0])); } } catch (Exception exception) { return new Integer[] { (int) rotationSteps }; @@ -712,7 +711,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { } int playerIndex; try { - playerIndex = toInt(arguments[0]); + playerIndex = Commons.toInt(arguments[0]); } catch (Exception exception) { return new Object[] { false }; } @@ -727,7 +726,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { private Object[] getEnergyRequired(Object[] arguments) { try { if (arguments.length == 1 && core != null) { - return new Object[] { core.calculateRequiredEnergy(getMode(), core.shipMass, toInt(arguments[0])) }; + return new Object[] { core.calculateRequiredEnergy(getMode(), core.shipMass, Commons.toInt(arguments[0])) }; } } catch (Exception exception) { return new Integer[] { -1 }; diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipCore.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipCore.java index 9ed5e4f9..4e47c7a4 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipCore.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipCore.java @@ -1,10 +1,20 @@ package cr0s.warpdrive.block.movement; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IStarMapRegistryTileEntity; +import cr0s.warpdrive.block.TileEntityAbstractEnergy; +import cr0s.warpdrive.config.Dictionary; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.Jumpgate; +import cr0s.warpdrive.data.StarMapRegistryItem.EnumStarMapEntryType; +import cr0s.warpdrive.data.VectorI; +import cr0s.warpdrive.event.JumpSequencer; +import cr0s.warpdrive.world.SpaceTeleporter; + import java.util.List; import java.util.UUID; -import cr0s.warpdrive.api.IStarMapRegistryTileEntity; -import cr0s.warpdrive.data.StarMapRegistryItem.EnumStarMapEntryType; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -25,20 +35,10 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.WorldServer; + import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.util.ForgeDirection; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.TileEntityAbstractEnergy; -import cr0s.warpdrive.config.Dictionary; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.Jumpgate; -import cr0s.warpdrive.data.VectorI; -import cr0s.warpdrive.event.JumpSequencer; -import cr0s.warpdrive.world.SpaceTeleporter; -/** - * @author Cr0s - */ public class TileEntityShipCore extends TileEntityAbstractEnergy implements IStarMapRegistryTileEntity { public int dx, dz; @@ -355,7 +355,7 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy implements ISta continue; } - WarpDrive.addChatMessage((EntityPlayer) object, "[" + (!shipName.isEmpty() ? shipName : "ShipCore") + "] " + msg); + Commons.addChatMessage((EntityPlayer) object, "[" + (!shipName.isEmpty() ? shipName : "ShipCore") + "] " + msg); } } @@ -448,7 +448,7 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy implements ISta EntityPlayerMP entityPlayerMP = MinecraftServer.getServer().getConfigurationManager().func_152612_a(playerName); StringBuilder reason = new StringBuilder(); if (!validateShipSpatialParameters(reason)) { - WarpDrive.addChatMessage(entityPlayerMP, "[" + (!shipName.isEmpty() ? shipName : "ShipCore") + "] §c" + reason.toString()); + Commons.addChatMessage(entityPlayerMP, "[" + (!shipName.isEmpty() ? shipName : "ShipCore") + "] §c" + reason.toString()); return; } @@ -482,7 +482,7 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy implements ISta } if (WarpDriveConfig.SHIP_SUMMON_MAX_RANGE >= 0 && distance > WarpDriveConfig.SHIP_SUMMON_MAX_RANGE) { messageToAllPlayersOnShip("§c" + String.format("%1$s is too far away to be summoned (max. is %2$d m)", entityPlayer.getDisplayName(), WarpDriveConfig.SHIP_SUMMON_MAX_RANGE)); - WarpDrive.addChatMessage(entityPlayer, "§c" + String.format("You are to far away to be summoned aboard '%1$s' (max. is %2$d m)", shipName, WarpDriveConfig.SHIP_SUMMON_MAX_RANGE)); + Commons.addChatMessage(entityPlayer, "§c" + String.format("You are to far away to be summoned aboard '%1$s' (max. is %2$d m)", shipName, WarpDriveConfig.SHIP_SUMMON_MAX_RANGE)); return; } @@ -605,7 +605,9 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy implements ISta } updateShipMassAndVolume(); - if (!isUnlimited && shipMass > WarpDriveConfig.SHIP_VOLUME_MAX_ON_PLANET_SURFACE && isOnPlanet()) { + if ( !isUnlimited + && shipMass > WarpDriveConfig.SHIP_VOLUME_MAX_ON_PLANET_SURFACE + && WarpDrive.starMap.isPlanet(worldObj) ) { reason.append("Ship is too big for a planet (max is " + WarpDriveConfig.SHIP_VOLUME_MAX_ON_PLANET_SURFACE + " blocks)"); return false; } diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporter.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporter.java index 6cf8228a..a365d42f 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporter.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporter.java @@ -1,27 +1,29 @@ package cr0s.warpdrive.block.movement; -import java.util.ArrayList; -import java.util.List; - -import cr0s.warpdrive.item.ItemUpgrade; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import cpw.mods.fml.common.Optional; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; -import cr0s.warpdrive.damage.DamageTeleportation; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.TileEntityAbstractEnergy; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.UpgradeType; import cr0s.warpdrive.data.Vector3; +import cr0s.warpdrive.item.ItemUpgrade; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.StatCollector; + +import cpw.mods.fml.common.Optional; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityTransporter extends TileEntityAbstractEnergy { private double scanRange = 2; @@ -208,9 +210,9 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy { try { if (arguments.length >= 3) { unlock(); - vec.x = toDouble(arguments[0]); - vec.y = toDouble(arguments[1]); - vec.z = toDouble(arguments[2]); + vec.x = Commons.toDouble(arguments[0]); + vec.y = Commons.toDouble(arguments[1]); + vec.z = Commons.toDouble(arguments[2]); } else if (arguments.length == 1) { unlock(); if (WarpDriveConfig.TRANSPORTER_USE_RELATIVE_COORDS) { @@ -277,7 +279,7 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy { private double powerBoost(Object[] arguments) { try { if (arguments.length >= 1) { - powerBoost = clamp(1, WarpDriveConfig.TRANSPORTER_MAX_BOOST_MUL, toDouble(arguments[0])); + powerBoost = Commons.clamp(1, WarpDriveConfig.TRANSPORTER_MAX_BOOST_MUL, Commons.toDouble(arguments[0])); } } catch (NumberFormatException e) { powerBoost = 1; @@ -398,7 +400,7 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy { private double beaconScan(Vector3 s, Vector3 d) { s = absoluteVector(s); d = absoluteVector(d); - return beaconScan(toInt(s.x), toInt(s.y), toInt(s.z)) + beaconScan(toInt(d.x), toInt(d.y), toInt(d.z)); + return beaconScan(Commons.toInt(s.x), Commons.toInt(s.y), Commons.toInt(s.z)) + beaconScan(Commons.toInt(d.x), Commons.toInt(d.y), Commons.toInt(d.z)); } private Vector3 absoluteVector(Vector3 a) { @@ -419,7 +421,7 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy { private static double calculatePower(Vector3 s, Vector3 d) { double dist = s.distanceTo(d); - return clamp(0, 1, Math.pow(Math.E, -dist / 300)); + return Commons.clamp(0, 1, Math.pow(Math.E, -dist / 300)); } private static double min(double... ds) { @@ -433,7 +435,7 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy { if (isLocked) { int rangeUgrades = getUpgradeCount(ItemUpgrade.getItemStack(UpgradeType.Range)); double upgradeBoost = Math.pow(1.2, rangeUgrades); - return clamp(0, 1, baseLockStrength * lockStrengthMul * Math.pow(2, powerBoost - 1) * upgradeBoost * (1 + beaconEffect)); + return Commons.clamp(0, 1, baseLockStrength * lockStrengthMul * Math.pow(2, powerBoost - 1) * upgradeBoost * (1 + beaconEffect)); } return -1; } diff --git a/src/main/java/cr0s/warpdrive/block/passive/BlockAir.java b/src/main/java/cr0s/warpdrive/block/passive/BlockAir.java index ff5f7cce..99337b94 100644 --- a/src/main/java/cr0s/warpdrive/block/passive/BlockAir.java +++ b/src/main/java/cr0s/warpdrive/block/passive/BlockAir.java @@ -1,5 +1,9 @@ package cr0s.warpdrive.block.passive; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.render.RenderBlockStandard; + import java.util.Random; import net.minecraft.block.Block; @@ -11,9 +15,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.render.RenderBlockStandard; public class BlockAir extends Block { private final boolean TRANSPARENT_AIR = true; diff --git a/src/main/java/cr0s/warpdrive/block/passive/BlockDecorative.java b/src/main/java/cr0s/warpdrive/block/passive/BlockDecorative.java index 07494973..e3206f21 100644 --- a/src/main/java/cr0s/warpdrive/block/passive/BlockDecorative.java +++ b/src/main/java/cr0s/warpdrive/block/passive/BlockDecorative.java @@ -1,8 +1,10 @@ package cr0s.warpdrive.block.passive; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.data.EnumDecorativeType; + import java.util.List; -import cr0s.warpdrive.data.EnumDecorativeType; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -10,7 +12,6 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import cr0s.warpdrive.WarpDrive; public class BlockDecorative extends Block { private static IIcon[] icons; diff --git a/src/main/java/cr0s/warpdrive/block/passive/BlockGas.java b/src/main/java/cr0s/warpdrive/block/passive/BlockGas.java index a7afc598..eabb912a 100644 --- a/src/main/java/cr0s/warpdrive/block/passive/BlockGas.java +++ b/src/main/java/cr0s/warpdrive/block/passive/BlockGas.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.block.passive; +import cr0s.warpdrive.WarpDrive; + import java.util.Random; import net.minecraft.block.Block; @@ -10,8 +12,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; public class BlockGas extends Block { private IIcon[] iconBuffer; diff --git a/src/main/java/cr0s/warpdrive/block/passive/BlockHighlyAdvancedMachine.java b/src/main/java/cr0s/warpdrive/block/passive/BlockHighlyAdvancedMachine.java index 1523356e..a89b6a9f 100644 --- a/src/main/java/cr0s/warpdrive/block/passive/BlockHighlyAdvancedMachine.java +++ b/src/main/java/cr0s/warpdrive/block/passive/BlockHighlyAdvancedMachine.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.block.passive; +import cr0s.warpdrive.WarpDrive; + import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; -import cr0s.warpdrive.WarpDrive; public class BlockHighlyAdvancedMachine extends Block { public BlockHighlyAdvancedMachine() { diff --git a/src/main/java/cr0s/warpdrive/block/passive/BlockIridium.java b/src/main/java/cr0s/warpdrive/block/passive/BlockIridium.java index f4c2aad1..56219526 100644 --- a/src/main/java/cr0s/warpdrive/block/passive/BlockIridium.java +++ b/src/main/java/cr0s/warpdrive/block/passive/BlockIridium.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.block.passive; +import cr0s.warpdrive.WarpDrive; + import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; -import cr0s.warpdrive.WarpDrive; public class BlockIridium extends Block { public BlockIridium() { diff --git a/src/main/java/cr0s/warpdrive/block/passive/BlockTransportBeacon.java b/src/main/java/cr0s/warpdrive/block/passive/BlockTransportBeacon.java index 7be15064..d4742d3e 100644 --- a/src/main/java/cr0s/warpdrive/block/passive/BlockTransportBeacon.java +++ b/src/main/java/cr0s/warpdrive/block/passive/BlockTransportBeacon.java @@ -1,6 +1,7 @@ package cr0s.warpdrive.block.passive; import cr0s.warpdrive.WarpDrive; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; diff --git a/src/main/java/cr0s/warpdrive/block/passive/ItemBlockDecorative.java b/src/main/java/cr0s/warpdrive/block/passive/ItemBlockDecorative.java index 82ab96c2..5a118895 100644 --- a/src/main/java/cr0s/warpdrive/block/passive/ItemBlockDecorative.java +++ b/src/main/java/cr0s/warpdrive/block/passive/ItemBlockDecorative.java @@ -1,8 +1,9 @@ package cr0s.warpdrive.block.passive; +import cr0s.warpdrive.data.EnumDecorativeType; + import java.util.List; -import cr0s.warpdrive.data.EnumDecorativeType; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; diff --git a/src/main/java/cr0s/warpdrive/block/weapon/BlockLaserCamera.java b/src/main/java/cr0s/warpdrive/block/weapon/BlockLaserCamera.java index 2ae3d24e..5392aaff 100644 --- a/src/main/java/cr0s/warpdrive/block/weapon/BlockLaserCamera.java +++ b/src/main/java/cr0s/warpdrive/block/weapon/BlockLaserCamera.java @@ -1,5 +1,10 @@ package cr0s.warpdrive.block.weapon; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.block.BlockAbstractContainer; +import cr0s.warpdrive.render.ClientCameraHandler; + import java.util.Random; import net.minecraft.block.material.Material; @@ -10,9 +15,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; -import cr0s.warpdrive.render.ClientCameraHandler; public class BlockLaserCamera extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -64,9 +66,9 @@ public class BlockLaserCamera extends BlockAbstractContainer { TileEntity tileEntity = world.getTileEntity(x, y, z); if (!ClientCameraHandler.isOverlayEnabled) { if (tileEntity instanceof TileEntityLaserCamera) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaserCamera) tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityLaserCamera) tileEntity).getStatus()); } else { - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", getLocalizedName()) + StatCollector.translateToLocalFormatted("warpdrive.error.badTileEntity")); WarpDrive.logger.error("Block " + this + " with invalid tile entity " + tileEntity); } diff --git a/src/main/java/cr0s/warpdrive/block/weapon/BlockWeaponController.java b/src/main/java/cr0s/warpdrive/block/weapon/BlockWeaponController.java index da26ed9f..01fc0e20 100644 --- a/src/main/java/cr0s/warpdrive/block/weapon/BlockWeaponController.java +++ b/src/main/java/cr0s/warpdrive/block/weapon/BlockWeaponController.java @@ -1,5 +1,9 @@ package cr0s.warpdrive.block.weapon; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.block.BlockAbstractContainer; + import java.util.Random; import net.minecraft.block.material.Material; @@ -10,8 +14,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.BlockAbstractContainer; public class BlockWeaponController extends BlockAbstractContainer { private IIcon[] iconBuffer; @@ -65,9 +67,9 @@ public class BlockWeaponController extends BlockAbstractContainer { if (entityPlayer.getHeldItem() == null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityWeaponController) { - WarpDrive.addChatMessage(entityPlayer, ((TileEntityWeaponController) tileEntity).getStatus()); + Commons.addChatMessage(entityPlayer, ((TileEntityWeaponController) tileEntity).getStatus()); } else { - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", getLocalizedName()) + StatCollector.translateToLocalFormatted("warpdrive.error.badTileEntity")); WarpDrive.logger.error("Block " + this + " with invalid tile entity " + tileEntity); } diff --git a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java index 814f9083..578a52e2 100644 --- a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java +++ b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java @@ -1,15 +1,6 @@ package cr0s.warpdrive.block.weapon; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.StatCollector; -import net.minecraft.world.ChunkPosition; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IVideoChannel; import cr0s.warpdrive.block.TileEntityLaser; @@ -19,6 +10,18 @@ import cr0s.warpdrive.data.EnumCameraType; import cr0s.warpdrive.network.PacketHandler; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.peripheral.IComputerAccess; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.StatCollector; +import net.minecraft.world.ChunkPosition; + +import cpw.mods.fml.common.Optional; public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChannel { private int videoChannel = -1; @@ -169,7 +172,7 @@ public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChan if (methodName.equals("videoChannel")) { if (arguments.length == 1) { - setVideoChannel(toInt(arguments[0])); + setVideoChannel(Commons.toInt(arguments[0])); } return new Integer[] { videoChannel }; } diff --git a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityWeaponController.java b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityWeaponController.java index 634ee6be..997249d4 100644 --- a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityWeaponController.java +++ b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityWeaponController.java @@ -1,10 +1,10 @@ package cr0s.warpdrive.block.weapon; +import cr0s.warpdrive.block.TileEntityAbstractInterfaced; + import java.util.Arrays; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; -import cr0s.warpdrive.block.TileEntityAbstractInterfaced; public class TileEntityWeaponController extends TileEntityAbstractInterfaced { diff --git a/src/main/java/cr0s/warpdrive/client/ClientProxy.java b/src/main/java/cr0s/warpdrive/client/ClientProxy.java index 641e0ee4..ffe0af44 100644 --- a/src/main/java/cr0s/warpdrive/client/ClientProxy.java +++ b/src/main/java/cr0s/warpdrive/client/ClientProxy.java @@ -1,10 +1,11 @@ package cr0s.warpdrive.client; -import cpw.mods.fml.client.registry.RenderingRegistry; import cr0s.warpdrive.CommonProxy; import cr0s.warpdrive.entity.EntityParticleBunch; import cr0s.warpdrive.render.RenderEntityParticleBunch; +import cpw.mods.fml.client.registry.RenderingRegistry; + public class ClientProxy extends CommonProxy { @Override diff --git a/src/main/java/cr0s/warpdrive/client/SirenSound.java b/src/main/java/cr0s/warpdrive/client/SirenSound.java index f8b9b509..78dbd899 100644 --- a/src/main/java/cr0s/warpdrive/client/SirenSound.java +++ b/src/main/java/cr0s/warpdrive/client/SirenSound.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.client; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.MovingSound; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class SirenSound extends MovingSound { ResourceLocation resource; diff --git a/src/main/java/cr0s/warpdrive/command/CommandDebug.java b/src/main/java/cr0s/warpdrive/command/CommandDebug.java index d19ee516..60de11fb 100644 --- a/src/main/java/cr0s/warpdrive/command/CommandDebug.java +++ b/src/main/java/cr0s/warpdrive/command/CommandDebug.java @@ -1,19 +1,18 @@ package cr0s.warpdrive.command; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; -import cpw.mods.fml.common.FMLCommonHandler; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -/* - * /wdebug - */ +import cpw.mods.fml.common.FMLCommonHandler; +import net.minecraftforge.common.DimensionManager; public class CommandDebug extends CommandBase { @@ -85,7 +84,7 @@ public class CommandDebug extends CommandBase catch (Exception exception) { exception.printStackTrace(); - WarpDrive.addChatMessage(player, getCommandUsage(icommandsender)); + Commons.addChatMessage(player, getCommandUsage(icommandsender)); return; } @@ -156,7 +155,7 @@ public class CommandDebug extends CommandBase } else { - WarpDrive.addChatMessage(player, getCommandUsage(icommandsender)); + Commons.addChatMessage(player, getCommandUsage(icommandsender)); } } diff --git a/src/main/java/cr0s/warpdrive/command/CommandEntity.java b/src/main/java/cr0s/warpdrive/command/CommandEntity.java index ac2c5972..c7800256 100644 --- a/src/main/java/cr0s/warpdrive/command/CommandEntity.java +++ b/src/main/java/cr0s/warpdrive/command/CommandEntity.java @@ -1,21 +1,24 @@ package cr0s.warpdrive.command; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; + import net.minecraftforge.common.DimensionManager; -import java.util.*; -import java.util.Map.Entry; - -/* - * /wentity - */ - public class CommandEntity extends CommandBase { private static final List entitiesNoRemoval = Arrays.asList( "item.EntityItemFrame_" @@ -45,7 +48,7 @@ public class CommandEntity extends CommandBase { @Override public void processCommand(ICommandSender icommandsender, String[] params) { if (params.length > 3) { - WarpDrive.addChatMessage(icommandsender, getCommandUsage(icommandsender)); + Commons.addChatMessage(icommandsender, getCommandUsage(icommandsender)); return; } @@ -72,7 +75,7 @@ public class CommandEntity extends CommandBase { } } catch (Exception exception) { exception.printStackTrace(); - WarpDrive.addChatMessage(icommandsender, getCommandUsage(icommandsender)); + Commons.addChatMessage(icommandsender, getCommandUsage(icommandsender)); return; } @@ -86,14 +89,14 @@ public class CommandEntity extends CommandBase { } else if (radius <= 0) { world = DimensionManager.getWorld(0); } else { - WarpDrive.addChatMessage(icommandsender, getCommandUsage(icommandsender)); + Commons.addChatMessage(icommandsender, getCommandUsage(icommandsender)); return; } entities = new ArrayList<>(); entities.addAll(world.loadedEntityList); } else { if (!(icommandsender instanceof EntityPlayerMP)) { - WarpDrive.addChatMessage(icommandsender, getCommandUsage(icommandsender)); + Commons.addChatMessage(icommandsender, getCommandUsage(icommandsender)); return; } EntityPlayerMP entityPlayer = (EntityPlayerMP) icommandsender; @@ -127,7 +130,7 @@ public class CommandEntity extends CommandBase { counts.put(name, counts.get(name) + 1); } if (!filter.isEmpty()) { - WarpDrive.addChatMessage(icommandsender, "§cFound " + object); + Commons.addChatMessage(icommandsender, "§cFound " + object); } // remove entity if (kill && !((Entity) object).invulnerable) { @@ -144,14 +147,14 @@ public class CommandEntity extends CommandBase { } } if (count == 0) { - WarpDrive.addChatMessage(icommandsender, "§cNo matching entities found within " + radius + " blocks"); + Commons.addChatMessage(icommandsender, "§cNo matching entities found within " + radius + " blocks"); return; } - WarpDrive.addChatMessage(icommandsender, "§6" + count + " matching entities within " + radius + " blocks:"); + Commons.addChatMessage(icommandsender, "§6" + count + " matching entities within " + radius + " blocks:"); if (counts.size() < 10) { for (Entry entry : counts.entrySet()) { - WarpDrive.addChatMessage(icommandsender, "§f" + entry.getValue() + "§8x§d" + entry.getKey()); + Commons.addChatMessage(icommandsender, "§f" + entry.getValue() + "§8x§d" + entry.getKey()); } } else { String message = ""; @@ -161,7 +164,7 @@ public class CommandEntity extends CommandBase { } message += "§f" + entry.getValue() + "§8x§d" + entry.getKey(); } - WarpDrive.addChatMessage(icommandsender, message); + Commons.addChatMessage(icommandsender, message); } } } \ No newline at end of file diff --git a/src/main/java/cr0s/warpdrive/command/CommandGenerate.java b/src/main/java/cr0s/warpdrive/command/CommandGenerate.java index 056aa00c..43d59347 100644 --- a/src/main/java/cr0s/warpdrive/command/CommandGenerate.java +++ b/src/main/java/cr0s/warpdrive/command/CommandGenerate.java @@ -1,24 +1,21 @@ package cr0s.warpdrive.command; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.structures.AbstractStructure; +import cr0s.warpdrive.config.structures.StructureManager; +import cr0s.warpdrive.world.JumpgateGenerator; import cr0s.warpdrive.world.SpaceWorldGenerator; +import cr0s.warpdrive.world.WorldGenSmallShip; +import cr0s.warpdrive.world.WorldGenStation; + import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; -import cpw.mods.fml.common.FMLCommonHandler; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.structures.AbstractStructure; -import cr0s.warpdrive.config.structures.StructureManager; -import cr0s.warpdrive.world.JumpgateGenerator; -import cr0s.warpdrive.world.WorldGenSmallShip; -import cr0s.warpdrive.world.WorldGenStation; -/* - * /generate - * Possible structures: - * moon, ship, asteroid, astfield, gascloud, star - */ +import cpw.mods.fml.common.FMLCommonHandler; public class CommandGenerate extends CommandBase { @Override @@ -42,7 +39,7 @@ public class CommandGenerate extends CommandBase { ChunkCoordinates coordinates = commandSender.getPlayerCoordinates(); if (world == null || coordinates == null) { - WarpDrive.addChatMessage(commandSender, "* generate: unknown world or coordinates, probably an invalid command sender in action here."); + Commons.addChatMessage(commandSender, "* generate: unknown world or coordinates, probably an invalid command sender in action here."); return; } int x = coordinates.posX; @@ -50,7 +47,7 @@ public class CommandGenerate extends CommandBase { int z = coordinates.posZ; if (params.length <= 0 || params.length == 3 || params.length > 5) { - WarpDrive.addChatMessage(commandSender, getCommandUsage(commandSender)); + Commons.addChatMessage(commandSender, getCommandUsage(commandSender)); return; } @@ -64,7 +61,7 @@ public class CommandGenerate extends CommandBase { // Reject command, if player is not in space if (!WarpDrive.starMap.isInSpace(world) && (!"ship".equals(structure))) { - WarpDrive.addChatMessage(commandSender, "* generate: this structure is only allowed in space!"); + Commons.addChatMessage(commandSender, "* generate: this structure is only allowed in space!"); return; } @@ -97,7 +94,7 @@ public class CommandGenerate extends CommandBase { break; case "jumpgate": if (params.length != 2) { - WarpDrive.addChatMessage(commandSender, "Missing jumpgate name"); + Commons.addChatMessage(commandSender, "Missing jumpgate name"); } else { WarpDrive.logger.info("/generate: creating jumpgate at " + x + ", " + y + ", " + z); @@ -109,7 +106,7 @@ public class CommandGenerate extends CommandBase { } break; default: - WarpDrive.addChatMessage(commandSender, getCommandUsage(commandSender)); + Commons.addChatMessage(commandSender, getCommandUsage(commandSender)); break; } } @@ -130,7 +127,7 @@ public class CommandGenerate extends CommandBase { private void generateStructure(ICommandSender commandSender, final String group, final String name, World world, final int x, final int y, final int z) { AbstractStructure structure = StructureManager.getStructure(world.rand, group, name); if (structure == null) { - WarpDrive.addChatMessage(commandSender, "Invalid " + group + " '" + name + "', try one of the followings:\n" + StructureManager.getStructureNames(group)); + Commons.addChatMessage(commandSender, "Invalid " + group + " '" + name + "', try one of the followings:\n" + StructureManager.getStructureNames(group)); } else { WarpDrive.logger.info("/generate: Generating " + group + ":" + structure.getName() + " at " + x + " " + y + " " + z); structure.generate(world, world.rand, x, y, z); diff --git a/src/main/java/cr0s/warpdrive/command/CommandInvisible.java b/src/main/java/cr0s/warpdrive/command/CommandInvisible.java index 4a52878a..e79dfac7 100644 --- a/src/main/java/cr0s/warpdrive/command/CommandInvisible.java +++ b/src/main/java/cr0s/warpdrive/command/CommandInvisible.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.command; +import cr0s.warpdrive.WarpDrive; + import java.util.List; import net.minecraft.command.CommandBase; @@ -7,8 +9,6 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; -import cr0s.warpdrive.WarpDrive; - public class CommandInvisible extends CommandBase { @Override public int getRequiredPermissionLevel() { diff --git a/src/main/java/cr0s/warpdrive/command/CommandJumpgates.java b/src/main/java/cr0s/warpdrive/command/CommandJumpgates.java index 19205d7a..a2d27af5 100644 --- a/src/main/java/cr0s/warpdrive/command/CommandJumpgates.java +++ b/src/main/java/cr0s/warpdrive/command/CommandJumpgates.java @@ -1,9 +1,11 @@ package cr0s.warpdrive.command; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; + import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import cr0s.warpdrive.WarpDrive; public class CommandJumpgates extends CommandBase { @Override @@ -24,6 +26,6 @@ public class CommandJumpgates extends CommandBase { @Override public void processCommand(ICommandSender commandSender, String[] params) { EntityPlayerMP player = (EntityPlayerMP) commandSender; - WarpDrive.addChatMessage(player, "Jumpgates: " + WarpDrive.jumpgates.commaList()); + Commons.addChatMessage(player, "Jumpgates: " + WarpDrive.jumpgates.commaList()); } } diff --git a/src/main/java/cr0s/warpdrive/command/CommandSpace.java b/src/main/java/cr0s/warpdrive/command/CommandSpace.java index 845fd7a4..33bf902a 100644 --- a/src/main/java/cr0s/warpdrive/command/CommandSpace.java +++ b/src/main/java/cr0s/warpdrive/command/CommandSpace.java @@ -1,5 +1,12 @@ package cr0s.warpdrive.command; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.world.SpaceTeleporter; + +import java.util.List; + import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.command.PlayerSelector; @@ -8,11 +15,6 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.MathHelper; import net.minecraft.world.WorldServer; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.world.SpaceTeleporter; - -import java.util.List; public class CommandSpace extends CommandBase { @Override @@ -45,7 +47,7 @@ public class CommandSpace extends CommandBase { // nop } else if (params.length == 1) { if (params[0].equalsIgnoreCase("help") || params[0].equalsIgnoreCase("?")) { - WarpDrive.addChatMessage(sender, getCommandUsage(sender)); + Commons.addChatMessage(sender, getCommandUsage(sender)); return; } EntityPlayerMP[] entityPlayerMPs_found = getOnlinePlayerByNameOrSelector(sender, params[0]); @@ -54,7 +56,7 @@ public class CommandSpace extends CommandBase { } else if (sender instanceof EntityPlayer) { targetDimensionId = getDimensionId(params[0]); } else { - WarpDrive.addChatMessage(sender, "/space: player not found '" + params[0] + "'"); + Commons.addChatMessage(sender, "/space: player not found '" + params[0] + "'"); return; } @@ -63,19 +65,19 @@ public class CommandSpace extends CommandBase { if (entityPlayerMPs_found != null) { entityPlayerMPs = entityPlayerMPs_found; } else { - WarpDrive.addChatMessage(sender, "/space: player not found '" + params[0] + "'"); + Commons.addChatMessage(sender, "/space: player not found '" + params[0] + "'"); return; } targetDimensionId = getDimensionId(params[1]); } else { - WarpDrive.addChatMessage(sender, "/space: too many arguments " + params.length); + Commons.addChatMessage(sender, "/space: too many arguments " + params.length); return; } // check player if (entityPlayerMPs == null || entityPlayerMPs.length <= 0) { - WarpDrive.addChatMessage(sender, "/space: undefined player"); + Commons.addChatMessage(sender, "/space: undefined player"); return; } @@ -92,16 +94,16 @@ public class CommandSpace extends CommandBase { // get target world WorldServer targetWorld = server.worldServerForDimension(targetDimensionId); if (targetWorld == null) { - WarpDrive.addChatMessage(sender, "/space: undefined dimension '" + targetDimensionId + "'"); + Commons.addChatMessage(sender, "/space: undefined dimension '" + targetDimensionId + "'"); return; } // inform player String message = "Teleporting player " + entityPlayerMP.getCommandSenderName() + " to dimension " + targetDimensionId + "..."; // + ":" + targetWorld.getWorldInfo().getWorldName(); - WarpDrive.addChatMessage(sender, message); + Commons.addChatMessage(sender, message); WarpDrive.logger.info(message); if (sender != entityPlayerMP) { - WarpDrive.addChatMessage(entityPlayerMP, sender.getCommandSenderName() + " is teleporting you to dimension " + targetDimensionId); // + ":" + targetWorld.getWorldInfo().getWorldName()); + Commons.addChatMessage(entityPlayerMP, sender.getCommandSenderName() + " is teleporting you to dimension " + targetDimensionId); // + ":" + targetWorld.getWorldInfo().getWorldName()); } // find a good spot diff --git a/src/main/java/cr0s/warpdrive/compat/CompatAdvancedRepulsionSystems.java b/src/main/java/cr0s/warpdrive/compat/CompatAdvancedRepulsionSystems.java index 8d5814ff..38852dc3 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatAdvancedRepulsionSystems.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatAdvancedRepulsionSystems.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatAdvancedRepulsionSystems implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatAppliedEnergistics2.java b/src/main/java/cr0s/warpdrive/compat/CompatAppliedEnergistics2.java index b181e3c1..7293fa7c 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatAppliedEnergistics2.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatAppliedEnergistics2.java @@ -1,5 +1,9 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; @@ -12,9 +16,6 @@ import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatAppliedEnergistics2 implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatArsMagica2.java b/src/main/java/cr0s/warpdrive/compat/CompatArsMagica2.java index 6019f274..2414603b 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatArsMagica2.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatArsMagica2.java @@ -1,5 +1,12 @@ package cr0s.warpdrive.compat; +import am2.api.power.IPowerNode; +import am2.power.PowerNodeRegistry; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -8,14 +15,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants; -import am2.api.power.IPowerNode; -import am2.power.PowerNodeRegistry; + import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; +import net.minecraftforge.common.util.Constants; public class CompatArsMagica2 implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatBiblioCraft.java b/src/main/java/cr0s/warpdrive/compat/CompatBiblioCraft.java index 769be216..45eb70f3 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatBiblioCraft.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatBiblioCraft.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatBiblioCraft implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatBotania.java b/src/main/java/cr0s/warpdrive/compat/CompatBotania.java index 9b286f2b..fead5e0a 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatBotania.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatBotania.java @@ -1,13 +1,14 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatBotania implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatCarpentersBlocks.java b/src/main/java/cr0s/warpdrive/compat/CompatCarpentersBlocks.java index 984f0db3..4bb65cf6 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatCarpentersBlocks.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatCarpentersBlocks.java @@ -3,6 +3,7 @@ package cr0s.warpdrive.compat; import cr0s.warpdrive.api.IBlockTransformer; import cr0s.warpdrive.api.ITransformation; import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/main/java/cr0s/warpdrive/compat/CompatComputerCraft.java b/src/main/java/cr0s/warpdrive/compat/CompatComputerCraft.java index fc4871e5..17a5d2d1 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatComputerCraft.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatComputerCraft.java @@ -1,13 +1,14 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatComputerCraft implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatEnderIO.java b/src/main/java/cr0s/warpdrive/compat/CompatEnderIO.java index ce5d6145..d5211daa 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatEnderIO.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatEnderIO.java @@ -1,5 +1,9 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -12,9 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraftforge.common.util.Constants; public class CompatEnderIO implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatEvilCraft.java b/src/main/java/cr0s/warpdrive/compat/CompatEvilCraft.java index 038790fc..968a0154 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatEvilCraft.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatEvilCraft.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatEvilCraft implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatForgeMultipart.java b/src/main/java/cr0s/warpdrive/compat/CompatForgeMultipart.java index d5645eed..786ff95d 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatForgeMultipart.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatForgeMultipart.java @@ -1,5 +1,10 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.lang.reflect.Method; import net.minecraft.block.Block; @@ -8,10 +13,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraftforge.common.util.Constants; public class CompatForgeMultipart implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatImmersiveEngineering.java b/src/main/java/cr0s/warpdrive/compat/CompatImmersiveEngineering.java index 912bd6ee..47654839 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatImmersiveEngineering.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatImmersiveEngineering.java @@ -1,10 +1,14 @@ package cr0s.warpdrive.compat; -import java.util.Collection; - import blusunrize.immersiveengineering.api.energy.IImmersiveConnectable; import blusunrize.immersiveengineering.api.energy.ImmersiveNetHandler; import blusunrize.immersiveengineering.api.energy.ImmersiveNetHandler.Connection; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + +import java.util.Collection; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -12,10 +16,8 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; + import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatImmersiveEngineering implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatIndustrialCraft2.java b/src/main/java/cr0s/warpdrive/compat/CompatIndustrialCraft2.java index 13c328d6..7b071802 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatIndustrialCraft2.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatIndustrialCraft2.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatIndustrialCraft2 implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatJABBA.java b/src/main/java/cr0s/warpdrive/compat/CompatJABBA.java index 4fa52e30..4c88f670 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatJABBA.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatJABBA.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatJABBA implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatMekanism.java b/src/main/java/cr0s/warpdrive/compat/CompatMekanism.java index 05df7ec7..a1bd2a74 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatMekanism.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatMekanism.java @@ -3,15 +3,16 @@ package cr0s.warpdrive.compat; import cr0s.warpdrive.api.IBlockTransformer; import cr0s.warpdrive.api.ITransformation; import cr0s.warpdrive.config.WarpDriveConfig; -import net.minecraft.block.Block; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + public class CompatMekanism implements IBlockTransformer { private static Class tileEntityBasicBlock; diff --git a/src/main/java/cr0s/warpdrive/compat/CompatMetallurgy.java b/src/main/java/cr0s/warpdrive/compat/CompatMetallurgy.java index c4bfcb67..3daf2523 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatMetallurgy.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatMetallurgy.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatMetallurgy implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatNatura.java b/src/main/java/cr0s/warpdrive/compat/CompatNatura.java index f1ba2d4d..4b09f25d 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatNatura.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatNatura.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatNatura implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatOpenComputers.java b/src/main/java/cr0s/warpdrive/compat/CompatOpenComputers.java index 80205a73..d0edd800 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatOpenComputers.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatOpenComputers.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatOpenComputers implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatPneumaticCraft.java b/src/main/java/cr0s/warpdrive/compat/CompatPneumaticCraft.java index 4c2ff7f0..389f27dc 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatPneumaticCraft.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatPneumaticCraft.java @@ -4,6 +4,7 @@ import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IBlockTransformer; import cr0s.warpdrive.api.ITransformation; import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/main/java/cr0s/warpdrive/compat/CompatRedstonePaste.java b/src/main/java/cr0s/warpdrive/compat/CompatRedstonePaste.java index 74e4d4e6..eea6383a 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatRedstonePaste.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatRedstonePaste.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatRedstonePaste implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatSGCraft.java b/src/main/java/cr0s/warpdrive/compat/CompatSGCraft.java index 5442e1d7..dbab84dd 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatSGCraft.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatSGCraft.java @@ -1,5 +1,9 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -8,9 +12,6 @@ import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatSGCraft implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatStargateTech2.java b/src/main/java/cr0s/warpdrive/compat/CompatStargateTech2.java index d7e4da3f..99d5f4d5 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatStargateTech2.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatStargateTech2.java @@ -1,11 +1,15 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Set; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; @@ -13,9 +17,6 @@ import net.minecraft.nbt.NBTTagByte; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatStargateTech2 implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatTConstruct.java b/src/main/java/cr0s/warpdrive/compat/CompatTConstruct.java index 532e4e1f..b2f3f4e4 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatTConstruct.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatTConstruct.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; public class CompatTConstruct implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatThaumcraft.java b/src/main/java/cr0s/warpdrive/compat/CompatThaumcraft.java index 9cc06777..0c7e6076 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatThaumcraft.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatThaumcraft.java @@ -1,13 +1,15 @@ package cr0s.warpdrive.compat; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraftforge.common.util.Constants; public class CompatThaumcraft implements IBlockTransformer { diff --git a/src/main/java/cr0s/warpdrive/compat/CompatThermalDynamics.java b/src/main/java/cr0s/warpdrive/compat/CompatThermalDynamics.java index 4751cad6..643a7ed9 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatThermalDynamics.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatThermalDynamics.java @@ -3,15 +3,16 @@ package cr0s.warpdrive.compat; import cr0s.warpdrive.api.IBlockTransformer; import cr0s.warpdrive.api.ITransformation; import cr0s.warpdrive.config.WarpDriveConfig; -import net.minecraft.block.Block; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + public class CompatThermalDynamics implements IBlockTransformer { private static Class blockTDBase; diff --git a/src/main/java/cr0s/warpdrive/compat/CompatThermalExpansion.java b/src/main/java/cr0s/warpdrive/compat/CompatThermalExpansion.java index 74400ed1..d83a27c6 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatThermalExpansion.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatThermalExpansion.java @@ -3,12 +3,12 @@ package cr0s.warpdrive.compat; import cr0s.warpdrive.api.IBlockTransformer; import cr0s.warpdrive.api.ITransformation; import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; - public class CompatThermalExpansion implements IBlockTransformer { private static Class tileEntityTEBase; diff --git a/src/main/java/cr0s/warpdrive/compat/CompatWarpDrive.java b/src/main/java/cr0s/warpdrive/compat/CompatWarpDrive.java index 8e528593..274a7290 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatWarpDrive.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatWarpDrive.java @@ -1,9 +1,11 @@ package cr0s.warpdrive.compat; + import cr0s.warpdrive.api.IBlockTransformer; import cr0s.warpdrive.api.ITransformation; import cr0s.warpdrive.block.energy.TileEntityEnergyBank; import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/main/java/cr0s/warpdrive/config/Dictionary.java b/src/main/java/cr0s/warpdrive/config/Dictionary.java index f70dcc81..30191d44 100644 --- a/src/main/java/cr0s/warpdrive/config/Dictionary.java +++ b/src/main/java/cr0s/warpdrive/config/Dictionary.java @@ -1,20 +1,22 @@ package cr0s.warpdrive.config; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.block.hull.BlockHullGlass; +import cr0s.warpdrive.block.hull.BlockHullPlain; +import cr0s.warpdrive.block.hull.BlockHullStairs; + import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map.Entry; -import cpw.mods.fml.common.registry.GameData; -import cpw.mods.fml.common.registry.GameRegistry; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.hull.BlockHullGlass; -import cr0s.warpdrive.block.hull.BlockHullPlain; -import cr0s.warpdrive.block.hull.BlockHullStairs; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; + +import cpw.mods.fml.common.registry.GameData; +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/cr0s/warpdrive/config/IXmlRepresentable.java b/src/main/java/cr0s/warpdrive/config/IXmlRepresentable.java index 87192b2d..40c0bbef 100644 --- a/src/main/java/cr0s/warpdrive/config/IXmlRepresentable.java +++ b/src/main/java/cr0s/warpdrive/config/IXmlRepresentable.java @@ -4,10 +4,10 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; public interface IXmlRepresentable { - public String getName(); + String getName(); // Load the XML element, return true if successful - public boolean loadFromXmlElement(Element element) throws InvalidXmlException; + boolean loadFromXmlElement(Element element) throws InvalidXmlException; - public void saveToXmlElement(Element element, Document document) throws InvalidXmlException; + void saveToXmlElement(Element element, Document document) throws InvalidXmlException; } diff --git a/src/main/java/cr0s/warpdrive/config/RandomCollection.java b/src/main/java/cr0s/warpdrive/config/RandomCollection.java index aab69635..f525f730 100644 --- a/src/main/java/cr0s/warpdrive/config/RandomCollection.java +++ b/src/main/java/cr0s/warpdrive/config/RandomCollection.java @@ -1,15 +1,14 @@ package cr0s.warpdrive.config; +import cr0s.warpdrive.WarpDrive; +import org.w3c.dom.Element; + import java.util.ArrayList; import java.util.Map.Entry; import java.util.NavigableMap; import java.util.Random; import java.util.TreeMap; -import org.w3c.dom.Element; - -import cr0s.warpdrive.WarpDrive; - /** * Collection of elements with ratios and weights. Helps to select element with controlled odds. * diff --git a/src/main/java/cr0s/warpdrive/config/RecipeParticleShapedOre.java b/src/main/java/cr0s/warpdrive/config/RecipeParticleShapedOre.java index 34d7c1ed..7fa4385a 100644 --- a/src/main/java/cr0s/warpdrive/config/RecipeParticleShapedOre.java +++ b/src/main/java/cr0s/warpdrive/config/RecipeParticleShapedOre.java @@ -1,8 +1,14 @@ package cr0s.warpdrive.config; -import cpw.mods.fml.common.registry.GameRegistry; import cr0s.warpdrive.api.IParticleContainerItem; import cr0s.warpdrive.api.ParticleStack; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -10,15 +16,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.world.World; + +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - // Adds support for IParticleContainerItem ingredients // Loosely inspired from vanilla ShapedOreRecipe public class RecipeParticleShapedOre implements IRecipe { diff --git a/src/main/java/cr0s/warpdrive/config/RecipeTuningDriver.java b/src/main/java/cr0s/warpdrive/config/RecipeTuningDriver.java index f6c479bd..ac61b023 100644 --- a/src/main/java/cr0s/warpdrive/config/RecipeTuningDriver.java +++ b/src/main/java/cr0s/warpdrive/config/RecipeTuningDriver.java @@ -1,17 +1,20 @@ package cr0s.warpdrive.config; -import cpw.mods.fml.common.registry.GameRegistry; + import cr0s.warpdrive.item.ItemTuningDriver; + +import java.util.ArrayList; + import net.minecraft.init.Blocks; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; + +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapelessOreRecipe; -import java.util.ArrayList; - // Used to change tuning driver values public class RecipeTuningDriver implements IRecipe { diff --git a/src/main/java/cr0s/warpdrive/config/Recipes.java b/src/main/java/cr0s/warpdrive/config/Recipes.java index e1bcf291..8c3592bb 100644 --- a/src/main/java/cr0s/warpdrive/config/Recipes.java +++ b/src/main/java/cr0s/warpdrive/config/Recipes.java @@ -1,23 +1,29 @@ package cr0s.warpdrive.config; -import java.util.ArrayList; - -import cpw.mods.fml.common.registry.GameRegistry; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.ParticleRegistry; import cr0s.warpdrive.block.detection.BlockSiren; import cr0s.warpdrive.block.passive.BlockDecorative; -import cr0s.warpdrive.data.*; +import cr0s.warpdrive.data.EnumComponentType; +import cr0s.warpdrive.data.EnumDecorativeType; +import cr0s.warpdrive.data.EnumForceFieldShape; +import cr0s.warpdrive.data.EnumForceFieldUpgrade; +import cr0s.warpdrive.data.UpgradeType; import cr0s.warpdrive.item.ItemComponent; import cr0s.warpdrive.item.ItemElectromagneticCell; import cr0s.warpdrive.item.ItemForceFieldShape; import cr0s.warpdrive.item.ItemForceFieldUpgrade; import cr0s.warpdrive.item.ItemTuningDriver; import cr0s.warpdrive.item.ItemUpgrade; + +import java.util.ArrayList; + import net.minecraft.block.BlockColored; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; + +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; diff --git a/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java b/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java index 63d9ed48..d6d4399b 100644 --- a/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java +++ b/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java @@ -1,5 +1,46 @@ package cr0s.warpdrive.config; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.compat.CompatAdvancedRepulsionSystems; +import cr0s.warpdrive.compat.CompatAppliedEnergistics2; +import cr0s.warpdrive.compat.CompatArsMagica2; +import cr0s.warpdrive.compat.CompatBiblioCraft; +import cr0s.warpdrive.compat.CompatBotania; +import cr0s.warpdrive.compat.CompatCarpentersBlocks; +import cr0s.warpdrive.compat.CompatComputerCraft; +import cr0s.warpdrive.compat.CompatEnderIO; +import cr0s.warpdrive.compat.CompatEvilCraft; +import cr0s.warpdrive.compat.CompatForgeMultipart; +import cr0s.warpdrive.compat.CompatImmersiveEngineering; +import cr0s.warpdrive.compat.CompatIndustrialCraft2; +import cr0s.warpdrive.compat.CompatJABBA; +import cr0s.warpdrive.compat.CompatMekanism; +import cr0s.warpdrive.compat.CompatMetallurgy; +import cr0s.warpdrive.compat.CompatNatura; +import cr0s.warpdrive.compat.CompatOpenComputers; +import cr0s.warpdrive.compat.CompatPneumaticCraft; +import cr0s.warpdrive.compat.CompatRedstonePaste; +import cr0s.warpdrive.compat.CompatSGCraft; +import cr0s.warpdrive.compat.CompatStargateTech2; +import cr0s.warpdrive.compat.CompatTConstruct; +import cr0s.warpdrive.compat.CompatThaumcraft; +import cr0s.warpdrive.compat.CompatThermalDynamics; +import cr0s.warpdrive.compat.CompatThermalExpansion; +import cr0s.warpdrive.compat.CompatWarpDrive; +import cr0s.warpdrive.config.filler.FillerManager; +import cr0s.warpdrive.config.structures.StructureManager; +import cr0s.warpdrive.config.structures.StructureReference; +import cr0s.warpdrive.data.Planet; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -7,28 +48,14 @@ import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - +import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.compat.*; -import cr0s.warpdrive.config.filler.FillerManager; -import cr0s.warpdrive.config.structures.StructureManager; -import cr0s.warpdrive.config.structures.StructureReference; -import cr0s.warpdrive.data.Planet; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; @@ -303,6 +330,8 @@ public class WarpDriveConfig { // Block transformers library public static HashMap blockTransformers = null; + // Particles accelerator + public static int ACCELERATOR_MAX_PARTICLE_BUNCHES = 20; public static Block getModBlock(final String mod, final String id) { try { @@ -345,33 +374,33 @@ public class WarpDriveConfig { config.load(); // General - G_SPACE_BIOME_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_SPACE_BIOME_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "space_biome_id", G_SPACE_BIOME_ID, "Space biome ID").getInt()); - G_SPACE_PROVIDER_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_SPACE_PROVIDER_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "space_provider_id", G_SPACE_PROVIDER_ID, "Space dimension provider ID").getInt()); - G_SPACE_DIMENSION_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_SPACE_DIMENSION_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "space_dimension_id", G_SPACE_DIMENSION_ID, "Space dimension world ID").getInt()); - G_HYPERSPACE_PROVIDER_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_HYPERSPACE_PROVIDER_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "hyperspace_provider_id", G_HYPERSPACE_PROVIDER_ID, "Hyperspace dimension provider ID").getInt()); - G_HYPERSPACE_DIMENSION_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_HYPERSPACE_DIMENSION_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "hyperspace_dimension_id", G_HYPERSPACE_DIMENSION_ID, "Hyperspace dimension world ID").getInt()); - G_SPACE_WORLDBORDER_BLOCKS = clamp(0, 3000000, + G_SPACE_WORLDBORDER_BLOCKS = Commons.clamp(0, 3000000, config.get("general", "space_worldborder_blocks", G_SPACE_WORLDBORDER_BLOCKS, "World border applied to hyperspace & space, set to 0 to disable it").getInt()); - G_ENTITY_SPHERE_GENERATOR_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_ENTITY_SPHERE_GENERATOR_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "entity_sphere_generator_id", G_ENTITY_SPHERE_GENERATOR_ID, "Entity sphere generator ID").getInt()); - G_ENTITY_STAR_CORE_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_ENTITY_STAR_CORE_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "entity_star_core_id", G_ENTITY_STAR_CORE_ID, "Entity star core ID").getInt()); - G_ENTITY_CAMERA_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_ENTITY_CAMERA_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "entity_camera_id", G_ENTITY_CAMERA_ID, "Entity camera ID").getInt()); - G_ENTITY_PARTICLE_BUNCH_ID = clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, + G_ENTITY_PARTICLE_BUNCH_ID = Commons.clamp(Integer.MIN_VALUE, Integer.MAX_VALUE, config.get("general", "entity_particle_bunch_id", G_ENTITY_PARTICLE_BUNCH_ID, "Entity particle bunch ID").getInt()); - G_LUA_SCRIPTS = clamp(0, 2, + G_LUA_SCRIPTS = Commons.clamp(0, 2, config.get("general", "lua_scripts", G_LUA_SCRIPTS, "LUA scripts to load when connecting machines: 0 = none, 1 = templates in a subfolder, 2 = ready to roll (templates are still provided)").getInt()); G_SCHEMALOCATION = config.get("general", "schematic_location", G_SCHEMALOCATION, "Folder where to save ship schematics").getString(); - G_BLOCKS_PER_TICK = clamp(100, 100000, + G_BLOCKS_PER_TICK = Commons.clamp(100, 100000, config.get("general", "blocks_per_tick", G_BLOCKS_PER_TICK, "Number of blocks to move per ticks, too high will cause lag spikes on ship jumping or deployment, too low may break the ship wirings").getInt()); @@ -443,63 +472,63 @@ public class WarpDriveConfig { // FIXME: check planets aren't overlapping // We're not checking invalid dimension id, so they can be pre-allocated (see MystCraft) } - STARMAP_REGISTRY_UPDATE_INTERVAL_SECONDS = clamp(0, 300, + STARMAP_REGISTRY_UPDATE_INTERVAL_SECONDS = Commons.clamp(0, 300, config.get("starmap", "registry_update_interval", STARMAP_REGISTRY_UPDATE_INTERVAL_SECONDS, "(measured in seconds)").getInt()); // Ship - SHIP_MAX_ENERGY_STORED = clamp(0, Integer.MAX_VALUE, + SHIP_MAX_ENERGY_STORED = Commons.clamp(0, Integer.MAX_VALUE, config.get("ship", "max_energy_stored", SHIP_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); - SHIP_NORMALJUMP_ENERGY_PER_BLOCK = clamp(0, Integer.MAX_VALUE, + SHIP_NORMALJUMP_ENERGY_PER_BLOCK = Commons.clamp(0, Integer.MAX_VALUE, config.get("ship", "normaljump_energy_per_block", SHIP_NORMALJUMP_ENERGY_PER_BLOCK, "Energy cost per non-air block without warping").getInt()); - SHIP_NORMALJUMP_ENERGY_PER_DISTANCE = clamp(0, Integer.MAX_VALUE, + SHIP_NORMALJUMP_ENERGY_PER_DISTANCE = Commons.clamp(0, Integer.MAX_VALUE, config.get("ship", "normaljump_energy_per_distance", SHIP_NORMALJUMP_ENERGY_PER_DISTANCE, "Energy cost per non-air block without warping").getInt()); - SHIP_HYPERJUMP_ENERGY_PER_DISTANCE = clamp(0, Integer.MAX_VALUE, + SHIP_HYPERJUMP_ENERGY_PER_DISTANCE = Commons.clamp(0, Integer.MAX_VALUE, config.get("ship", "hyperjump_energy_per_distance", SHIP_HYPERJUMP_ENERGY_PER_DISTANCE, "Energy cost per non-air block while warping").getInt()); - SHIP_HYPERJUMP_ENERGY_PER_BLOCK = clamp(0, Integer.MAX_VALUE, + SHIP_HYPERJUMP_ENERGY_PER_BLOCK = Commons.clamp(0, Integer.MAX_VALUE, config.get("ship", "hyperjump_energy_per_block", SHIP_HYPERJUMP_ENERGY_PER_BLOCK, "Energy cost per non-air block while warping").getInt()); - SHIP_TELEPORT_ENERGY_PER_ENTITY = clamp(0, Integer.MAX_VALUE, + SHIP_TELEPORT_ENERGY_PER_ENTITY = Commons.clamp(0, Integer.MAX_VALUE, config.get("ship", "teleport_energy_per_entity", SHIP_TELEPORT_ENERGY_PER_ENTITY, "Energy cost per entity").getInt()); - SHIP_MAX_JUMP_DISTANCE = clamp(0, 30000000, + SHIP_MAX_JUMP_DISTANCE = Commons.clamp(0, 30000000, config.get("ship", "max_jump_distance", SHIP_MAX_JUMP_DISTANCE, "Maximum jump length value in blocks").getInt()); - SHIP_VOLUME_MAX_ON_PLANET_SURFACE = clamp(0, 10000000, + SHIP_VOLUME_MAX_ON_PLANET_SURFACE = Commons.clamp(0, 10000000, config.get("ship", "volume_max_on_planet_surface", SHIP_VOLUME_MAX_ON_PLANET_SURFACE, "Maximum ship mass (in blocks) to jump on a planet").getInt()); - SHIP_VOLUME_MIN_FOR_HYPERSPACE = clamp(0, 10000000, + SHIP_VOLUME_MIN_FOR_HYPERSPACE = Commons.clamp(0, 10000000, config.get("ship", "volume_min_for_hyperspace", SHIP_VOLUME_MIN_FOR_HYPERSPACE, "Minimum ship mass (in blocks) to enter or exit hyperspace without a jumpgate").getInt()); SHIP_VOLUME_UNLIMITED_PLAYERNAMES = config.get("ship", "volume_unlimited_playernames", SHIP_VOLUME_UNLIMITED_PLAYERNAMES, "List of player names which have unlimited block counts to their ship").getStringList(); - SHIP_MAX_SIDE_SIZE = clamp(0, 30000000, + SHIP_MAX_SIDE_SIZE = Commons.clamp(0, 30000000, config.get("ship", "max_side_size", SHIP_MAX_SIDE_SIZE, "Maximum ship size on each axis in blocks").getInt()); - SHIP_COLLISION_TOLERANCE_BLOCKS = clamp(0, 30000000, + SHIP_COLLISION_TOLERANCE_BLOCKS = Commons.clamp(0, 30000000, config.get("ship", "collision_tolerance_blocks", SHIP_COLLISION_TOLERANCE_BLOCKS, "Tolerance in block in case of collision before causing damages...").getInt()); - SHIP_COOLDOWN_INTERVAL_SECONDS = clamp(0, 3600, + SHIP_COOLDOWN_INTERVAL_SECONDS = Commons.clamp(0, 3600, config.get("ship", "cooldown_interval_seconds", SHIP_COOLDOWN_INTERVAL_SECONDS, "Cooldown seconds to wait after jumping").getInt()); - SHIP_SHORTJUMP_THRESHOLD_BLOCKS = clamp(0, 30000000, + SHIP_SHORTJUMP_THRESHOLD_BLOCKS = Commons.clamp(0, 30000000, config.get("ship", "shortjump_threshold_blocs", SHIP_SHORTJUMP_THRESHOLD_BLOCKS, "Short jump definition").getInt()); - SHIP_SHORTJUMP_WARMUP_SECONDS = clamp(0, 3600, + SHIP_SHORTJUMP_WARMUP_SECONDS = Commons.clamp(0, 3600, config.get("ship", "shortjump_warmup_seconds", SHIP_SHORTJUMP_WARMUP_SECONDS, "(measured in seconds)").getInt()); - SHIP_LONGJUMP_WARMUP_SECONDS = clamp(0, 3600, + SHIP_LONGJUMP_WARMUP_SECONDS = Commons.clamp(0, 3600, config.get("ship", "longjump_warmup_seconds", SHIP_LONGJUMP_WARMUP_SECONDS, "(measured in seconds)").getInt()); - SHIP_WARMUP_RANDOM_TICKS = clamp(10, 200, + SHIP_WARMUP_RANDOM_TICKS = Commons.clamp(10, 200, config.get("ship", "warmup_random_ticks", SHIP_WARMUP_RANDOM_TICKS, "Random variation added to warmup (measured in ticks)").getInt()); SHIP_WARMUP_SICKNESS = config.get("ship", "warmup_sickness", true, "Enable warp sickness during warmup").getBoolean(true); SHIP_SUMMON_MAX_RANGE = config.get("ship", "summon_max_range", SHIP_SUMMON_MAX_RANGE, "Maximum range from which players can be summoned (measured in blocks), set to -1 for unlimited range").getInt(); SHIP_SUMMON_ACROSS_DIMENSIONS = config.get("ship", "summon_across_dimensions", false, "Enable summoning players from another dimension").getBoolean(false); - SHIP_CORE_ISOLATION_UPDATE_INTERVAL_SECONDS = clamp(0, 300, + SHIP_CORE_ISOLATION_UPDATE_INTERVAL_SECONDS = Commons.clamp(0, 300, config.get("ship", "core_isolation_update_interval", SHIP_CORE_ISOLATION_UPDATE_INTERVAL_SECONDS, "(measured in seconds)").getInt()); - SHIP_CONTROLLER_UPDATE_INTERVAL_SECONDS = clamp(0, 300, + SHIP_CONTROLLER_UPDATE_INTERVAL_SECONDS = Commons.clamp(0, 300, config.get("ship", "controller_update_interval", SHIP_CONTROLLER_UPDATE_INTERVAL_SECONDS, "(measured in seconds)").getInt()); // Radar - RADAR_MAX_ENERGY_STORED = clamp(0, Integer.MAX_VALUE, + RADAR_MAX_ENERGY_STORED = Commons.clamp(0, Integer.MAX_VALUE, config.get("radar", "max_energy_stored", RADAR_MAX_ENERGY_STORED, "maximum energy stored").getInt()); - RADAR_SCAN_MIN_ENERGY_COST = clamp(0, Integer.MAX_VALUE, + RADAR_SCAN_MIN_ENERGY_COST = Commons.clamp(0, Integer.MAX_VALUE, config.get("radar", "min_energy_cost", RADAR_SCAN_MIN_ENERGY_COST, "minimum energy cost per scan (0+), independently of radius").getInt()); RADAR_SCAN_ENERGY_COST_FACTORS = config.get("radar", "factors_energy_cost", RADAR_SCAN_ENERGY_COST_FACTORS, "energy cost factors {a, b, c, d}. You need to provide exactly 4 values.\n" @@ -508,7 +537,7 @@ public class WarpDriveConfig { RADAR_SCAN_ENERGY_COST_FACTORS = new double[4]; Arrays.fill(RADAR_SCAN_ENERGY_COST_FACTORS, 1.0); } - RADAR_SCAN_MIN_DELAY_SECONDS = clamp(1, Integer.MAX_VALUE, + RADAR_SCAN_MIN_DELAY_SECONDS = Commons.clamp(1, Integer.MAX_VALUE, config.get("radar", "scan_min_delay_seconds", RADAR_SCAN_MIN_DELAY_SECONDS, "minimum scan delay per scan (1+), (measured in seconds)").getInt()); RADAR_SCAN_DELAY_FACTORS_SECONDS = config.get("radar", "scan_delay_factors_seconds", RADAR_SCAN_DELAY_FACTORS_SECONDS, "scan delay factors {a, b, c, d}. You need to provide exactly 4 values.\n" @@ -518,246 +547,246 @@ public class WarpDriveConfig { Arrays.fill(RADAR_SCAN_DELAY_FACTORS_SECONDS, 1.0); } - RADAR_MAX_ISOLATION_RANGE = clamp(2, 8, + RADAR_MAX_ISOLATION_RANGE = Commons.clamp(2, 8, config.get("radar", "max_isolation_range", RADAR_MAX_ISOLATION_RANGE, "radius around core where isolation blocks count (2 to 8), higher is lagger").getInt()); - RADAR_MIN_ISOLATION_BLOCKS = clamp(0, 20, + RADAR_MIN_ISOLATION_BLOCKS = Commons.clamp(0, 20, config.get("radar", "min_isolation_blocks", RADAR_MIN_ISOLATION_BLOCKS, "number of isolation blocks required to get some isolation (0 to 20)").getInt()); - RADAR_MAX_ISOLATION_BLOCKS = clamp(5, 94, + RADAR_MAX_ISOLATION_BLOCKS = Commons.clamp(5, 94, config.get("radar", "max_isolation_blocks", RADAR_MAX_ISOLATION_BLOCKS, "number of isolation blocks required to reach maximum effect (5 to 94)").getInt()); - RADAR_MIN_ISOLATION_EFFECT = clamp(0.01D, 0.95D, + RADAR_MIN_ISOLATION_EFFECT = Commons.clamp(0.01D, 0.95D, config.get("radar", "min_isolation_effect", RADAR_MIN_ISOLATION_EFFECT, "isolation effect achieved with min number of isolation blocks (0.01 to 0.95)").getDouble(0.12D)); - RADAR_MAX_ISOLATION_EFFECT = clamp(0.01D, 1.0D, + RADAR_MAX_ISOLATION_EFFECT = Commons.clamp(0.01D, 1.0D, config.get("radar", "max_isolation_effect", RADAR_MAX_ISOLATION_EFFECT, "isolation effect achieved with max number of isolation blocks (0.01 to 1.00)").getDouble(1.00D)); // Ship Scanner - SS_MAX_ENERGY_STORED = clamp(1, Integer.MAX_VALUE, + SS_MAX_ENERGY_STORED = Commons.clamp(1, Integer.MAX_VALUE, config.get("ship_scanner", "max_energy_stored", SS_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); SS_ENERGY_PER_BLOCK_SCAN = config.get("ship_scanner", "energy_per_block_when_scanning", SS_ENERGY_PER_BLOCK_SCAN, "Energy consumed per block when scanning a ship (use -1 to consume everything)").getInt(); if (SS_ENERGY_PER_BLOCK_SCAN != -1) { - SS_ENERGY_PER_BLOCK_SCAN = clamp(0, SS_MAX_ENERGY_STORED, SS_ENERGY_PER_BLOCK_SCAN); + SS_ENERGY_PER_BLOCK_SCAN = Commons.clamp(0, SS_MAX_ENERGY_STORED, SS_ENERGY_PER_BLOCK_SCAN); } SS_ENERGY_PER_BLOCK_DEPLOY = config.get("ship_scanner", "energy_per_block_when_deploying", SS_ENERGY_PER_BLOCK_DEPLOY, "Energy consumed per block when deploying a ship (use -1 to consume everything)").getInt(); if (SS_ENERGY_PER_BLOCK_DEPLOY != -1) { - SS_ENERGY_PER_BLOCK_DEPLOY = clamp(0, SS_MAX_ENERGY_STORED, SS_ENERGY_PER_BLOCK_DEPLOY); + SS_ENERGY_PER_BLOCK_DEPLOY = Commons.clamp(0, SS_MAX_ENERGY_STORED, SS_ENERGY_PER_BLOCK_DEPLOY); } - SS_MAX_DEPLOY_RADIUS_BLOCKS = clamp(5, 150, + SS_MAX_DEPLOY_RADIUS_BLOCKS = Commons.clamp(5, 150, config.get("ship_scanner", "max_deploy_radius_blocks", SS_MAX_DEPLOY_RADIUS_BLOCKS, "Max distance from ship scanner to ship core, measured in blocks (5-150)").getInt()); - SS_SEARCH_INTERVAL_TICKS = clamp(5, 150, + SS_SEARCH_INTERVAL_TICKS = Commons.clamp(5, 150, config.get("ship_scanner", "search_interval_ticks", SS_SEARCH_INTERVAL_TICKS, "Max distance from ship scanner to ship core, measured in blocks (5-150)").getInt()); - SS_SCAN_BLOCKS_PER_SECOND = clamp(1, 50000, + SS_SCAN_BLOCKS_PER_SECOND = Commons.clamp(1, 50000, config.get("ship_scanner", "scan_blocks_per_second", SS_SCAN_BLOCKS_PER_SECOND, "Scanning speed, measured in blocks (1-5000)").getInt()); - SS_DEPLOY_BLOCKS_PER_INTERVAL = clamp(1, 3000, + SS_DEPLOY_BLOCKS_PER_INTERVAL = Commons.clamp(1, 3000, config.get("ship_scanner", "deploy_blocks_per_interval", SS_DEPLOY_BLOCKS_PER_INTERVAL, "Deployment speed, measured in blocks (1-3000)").getInt()); - SS_DEPLOY_INTERVAL_TICKS = clamp(1, 60, + SS_DEPLOY_INTERVAL_TICKS = Commons.clamp(1, 60, config.get("ship_scanner", "deploy_interval_ticks", SS_DEPLOY_INTERVAL_TICKS, "Delay between deployment of 2 sets of blocks, measured in ticks (1-60)").getInt()); // Laser medium - LASER_MEDIUM_MAX_ENERGY_STORED = clamp(1, Integer.MAX_VALUE, + LASER_MEDIUM_MAX_ENERGY_STORED = Commons.clamp(1, Integer.MAX_VALUE, config.get("laser_medium", "max_energy_stored", LASER_MEDIUM_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); // Laser cannon - LASER_CANNON_MAX_MEDIUMS_COUNT = clamp(1, 64, + LASER_CANNON_MAX_MEDIUMS_COUNT = Commons.clamp(1, 64, config.get("laser_cannon", "max_mediums_count", LASER_CANNON_MAX_MEDIUMS_COUNT, "Maximum number of laser mediums per laser").getInt()); - LASER_CANNON_MAX_LASER_ENERGY = clamp(1, Integer.MAX_VALUE, + LASER_CANNON_MAX_LASER_ENERGY = Commons.clamp(1, Integer.MAX_VALUE, config.get("laser_cannon", "max_laser_energy", LASER_CANNON_MAX_LASER_ENERGY, "Maximum energy in beam after accounting for boosters beams").getInt()); - LASER_CANNON_EMIT_FIRE_DELAY_TICKS = clamp(1, 100, + LASER_CANNON_EMIT_FIRE_DELAY_TICKS = Commons.clamp(1, 100, config.get("laser_cannon", "emit_fire_delay_ticks", LASER_CANNON_EMIT_FIRE_DELAY_TICKS, "Delay while booster beams are accepted, before actually shooting").getInt()); - LASER_CANNON_EMIT_SCAN_DELAY_TICKS = clamp(1, 100, + LASER_CANNON_EMIT_SCAN_DELAY_TICKS = Commons.clamp(1, 100, config.get("laser_cannon", "emit_scan_delay_ticks", LASER_CANNON_EMIT_SCAN_DELAY_TICKS, "Delay while booster beams are accepted, before actually scanning").getInt()); - LASER_CANNON_BOOSTER_BEAM_ENERGY_EFFICIENCY = clamp(0.01D, 10.0D, + LASER_CANNON_BOOSTER_BEAM_ENERGY_EFFICIENCY = Commons.clamp(0.01D, 10.0D, config.get("laser_cannon", "booster_beam_energy_efficiency", LASER_CANNON_BOOSTER_BEAM_ENERGY_EFFICIENCY, "Energy factor applied from boosting to main laser").getDouble(0.6D)); - LASER_CANNON_ENERGY_ATTENUATION_PER_AIR_BLOCK = clamp(0.0D, 0.1D, + LASER_CANNON_ENERGY_ATTENUATION_PER_AIR_BLOCK = Commons.clamp(0.0D, 0.1D, config.get("laser_cannon", "energy_attenuation_per_air_block", LASER_CANNON_ENERGY_ATTENUATION_PER_AIR_BLOCK, "Energy attenuation when going through air blocks (on a planet or any gaz in space)").getDouble()); - LASER_CANNON_ENERGY_ATTENUATION_PER_VOID_BLOCK = clamp(0.0D, 0.1D, + LASER_CANNON_ENERGY_ATTENUATION_PER_VOID_BLOCK = Commons.clamp(0.0D, 0.1D, config.get("laser_cannon", "energy_attenuation_per_air_block", LASER_CANNON_ENERGY_ATTENUATION_PER_VOID_BLOCK, "Energy attenuation when going through void blocks (in space or hyperspace)").getDouble()); - LASER_CANNON_ENERGY_ATTENUATION_PER_BROKEN_BLOCK = clamp(0.0D, 1.0D, + LASER_CANNON_ENERGY_ATTENUATION_PER_BROKEN_BLOCK = Commons.clamp(0.0D, 1.0D, config.get("laser_cannon", "energy_attenuation_per_air_block", LASER_CANNON_ENERGY_ATTENUATION_PER_BROKEN_BLOCK, "Energy attenuation when going through a broken block").getDouble()); - LASER_CANNON_RANGE_MAX = clamp(64, 512, + LASER_CANNON_RANGE_MAX = Commons.clamp(64, 512, config.get("laser_cannon", "range_max", LASER_CANNON_RANGE_MAX, "Maximum distance travelled").getInt()); - LASER_CANNON_ENTITY_HIT_SET_ON_FIRE_SECONDS = clamp(0, 300, + LASER_CANNON_ENTITY_HIT_SET_ON_FIRE_SECONDS = Commons.clamp(0, 300, config.get("laser_cannon", "entity_hit_set_on_fire_seconds", LASER_CANNON_ENTITY_HIT_SET_ON_FIRE_SECONDS, "Duration of fire effect on entity hit (in seconds)").getInt()); - LASER_CANNON_ENTITY_HIT_ENERGY = clamp(0, LASER_CANNON_MAX_LASER_ENERGY, + LASER_CANNON_ENTITY_HIT_ENERGY = Commons.clamp(0, LASER_CANNON_MAX_LASER_ENERGY, config.get("laser_cannon", "entity_hit_energy", LASER_CANNON_ENTITY_HIT_ENERGY, "Base energy consumed from hitting an entity").getInt()); - LASER_CANNON_ENTITY_HIT_BASE_DAMAGE = clamp(0, LASER_CANNON_MAX_LASER_ENERGY, + LASER_CANNON_ENTITY_HIT_BASE_DAMAGE = Commons.clamp(0, LASER_CANNON_MAX_LASER_ENERGY, config.get("laser_cannon", "entity_hit_base_damage", LASER_CANNON_ENTITY_HIT_BASE_DAMAGE, "Minimum damage to entity hit (measured in half hearts)").getInt()); - LASER_CANNON_ENTITY_HIT_ENERGY_PER_DAMAGE = clamp(0, LASER_CANNON_MAX_LASER_ENERGY, + LASER_CANNON_ENTITY_HIT_ENERGY_PER_DAMAGE = Commons.clamp(0, LASER_CANNON_MAX_LASER_ENERGY, config.get("laser_cannon", "entity_hit_energy_per_damage", LASER_CANNON_ENTITY_HIT_ENERGY_PER_DAMAGE, "Energy required by additional hit point (won't be consumed)").getInt()); - LASER_CANNON_ENTITY_HIT_MAX_DAMAGE = clamp(0, Integer.MAX_VALUE, + LASER_CANNON_ENTITY_HIT_MAX_DAMAGE = Commons.clamp(0, Integer.MAX_VALUE, config.get("laser_cannon", "entity_hit_max_damage", LASER_CANNON_ENTITY_HIT_MAX_DAMAGE, "Maximum damage to entity hit, set to 0 to disable damage completely").getInt()); - LASER_CANNON_ENTITY_HIT_EXPLOSION_ENERGY_THRESHOLD = clamp(0, Integer.MAX_VALUE, + LASER_CANNON_ENTITY_HIT_EXPLOSION_ENERGY_THRESHOLD = Commons.clamp(0, Integer.MAX_VALUE, config.get("laser_cannon", "entity_hit_energy_threshold_for_explosion", LASER_CANNON_ENTITY_HIT_EXPLOSION_ENERGY_THRESHOLD, "Minimum energy to cause explosion effect").getInt()); - LASER_CANNON_ENTITY_HIT_EXPLOSION_BASE_STRENGTH = (float) clamp(0.0D, 100.0D, + LASER_CANNON_ENTITY_HIT_EXPLOSION_BASE_STRENGTH = (float) Commons.clamp(0.0D, 100.0D, config.get("laser_cannon", "entity_hit_explosion_base_strength", LASER_CANNON_ENTITY_HIT_EXPLOSION_BASE_STRENGTH, "Explosion base strength, 4 is Vanilla TNT").getDouble()); - LASER_CANNON_ENTITY_HIT_EXPLOSION_ENERGY_PER_STRENGTH = clamp(1, Integer.MAX_VALUE, + LASER_CANNON_ENTITY_HIT_EXPLOSION_ENERGY_PER_STRENGTH = Commons.clamp(1, Integer.MAX_VALUE, config.get("laser_cannon", "entity_hit_explosion_energy_per_strength", LASER_CANNON_ENTITY_HIT_EXPLOSION_ENERGY_PER_STRENGTH, "Energy per added explosion strength").getInt()); - LASER_CANNON_ENTITY_HIT_EXPLOSION_MAX_STRENGTH = (float) clamp(0.0D, 1000.0D, + LASER_CANNON_ENTITY_HIT_EXPLOSION_MAX_STRENGTH = (float) Commons.clamp(0.0D, 1000.0D, config.get("laser_cannon", "entity_hit_explosion_max_strength", LASER_CANNON_ENTITY_HIT_EXPLOSION_MAX_STRENGTH, "Maximum explosion strength, set to 0 to disable explosion completely").getDouble()); - LASER_CANNON_BLOCK_HIT_ENERGY_MIN = clamp(0, Integer.MAX_VALUE, + LASER_CANNON_BLOCK_HIT_ENERGY_MIN = Commons.clamp(0, Integer.MAX_VALUE, config.get("laser_cannon", "block_hit_energy_min", LASER_CANNON_BLOCK_HIT_ENERGY_MIN, "Minimum energy required for breaking a block").getInt()); - LASER_CANNON_BLOCK_HIT_ENERGY_PER_BLOCK_HARDNESS = clamp(0, Integer.MAX_VALUE, + LASER_CANNON_BLOCK_HIT_ENERGY_PER_BLOCK_HARDNESS = Commons.clamp(0, Integer.MAX_VALUE, config.get("laser_cannon", "block_hit_energy_per_block_hardness", LASER_CANNON_BLOCK_HIT_ENERGY_PER_BLOCK_HARDNESS, "Energy cost per block hardness for breaking a block").getInt()); - LASER_CANNON_BLOCK_HIT_ENERGY_MAX = clamp(0, Integer.MAX_VALUE, + LASER_CANNON_BLOCK_HIT_ENERGY_MAX = Commons.clamp(0, Integer.MAX_VALUE, config.get("laser_cannon", "block_hit_energy_max", LASER_CANNON_BLOCK_HIT_ENERGY_MAX, "Maximum energy required for breaking a block").getInt()); - LASER_CANNON_BLOCK_HIT_ABSORPTION_PER_BLOCK_HARDNESS = clamp(0.0D, 1.0D, + LASER_CANNON_BLOCK_HIT_ABSORPTION_PER_BLOCK_HARDNESS = Commons.clamp(0.0D, 1.0D, config.get("laser_cannon", "block_hit_absorption_per_block_hardness", LASER_CANNON_BLOCK_HIT_ABSORPTION_PER_BLOCK_HARDNESS, "Probability of energy absorption (i.e. block not breaking) per block hardness. Set to 1.0 to always break the block.").getDouble()); - LASER_CANNON_BLOCK_HIT_ABSORPTION_MAX = clamp(0.0D, 1.0D, + LASER_CANNON_BLOCK_HIT_ABSORPTION_MAX = Commons.clamp(0.0D, 1.0D, config.get("laser_cannon", "block_hit_absorption_max", LASER_CANNON_BLOCK_HIT_ABSORPTION_MAX, "Maximum probability of energy absorption (i.e. block not breaking)").getDouble()); - LASER_CANNON_BLOCK_HIT_EXPLOSION_HARDNESS_THRESHOLD = (float) clamp(0.0D, 10000.0D, + LASER_CANNON_BLOCK_HIT_EXPLOSION_HARDNESS_THRESHOLD = (float) Commons.clamp(0.0D, 10000.0D, config.get("laser_cannon", "block_hit_explosion_hardness_threshold", LASER_CANNON_BLOCK_HIT_EXPLOSION_HARDNESS_THRESHOLD, "Minimum block hardness required to cause an explosion").getDouble()); - LASER_CANNON_BLOCK_HIT_EXPLOSION_BASE_STRENGTH = (float) clamp(0.0D, 1000.0D, + LASER_CANNON_BLOCK_HIT_EXPLOSION_BASE_STRENGTH = (float) Commons.clamp(0.0D, 1000.0D, config.get("laser_cannon", "block_hit_explosion_base_strength", LASER_CANNON_BLOCK_HIT_EXPLOSION_BASE_STRENGTH, "Explosion base strength, 4 is Vanilla TNT").getDouble()); - LASER_CANNON_BLOCK_HIT_EXPLOSION_ENERGY_PER_STRENGTH = clamp(1, Integer.MAX_VALUE, + LASER_CANNON_BLOCK_HIT_EXPLOSION_ENERGY_PER_STRENGTH = Commons.clamp(1, Integer.MAX_VALUE, config.get("laser_cannon", "block_hit_explosion_energy_per_strength", LASER_CANNON_BLOCK_HIT_EXPLOSION_ENERGY_PER_STRENGTH, "Energy per added explosion strength").getInt()); - LASER_CANNON_BLOCK_HIT_EXPLOSION_MAX_STRENGTH = (float) clamp(0.0D, 1000.0D, + LASER_CANNON_BLOCK_HIT_EXPLOSION_MAX_STRENGTH = (float) Commons.clamp(0.0D, 1000.0D, config.get("laser_cannon", "block_hit_explosion_max_strength", LASER_CANNON_BLOCK_HIT_EXPLOSION_MAX_STRENGTH, "Maximum explosion strength, set to 0 to disable explosion completely").getDouble()); // Mining Laser - MINING_LASER_MAX_MEDIUMS_COUNT = clamp(1, 64, + MINING_LASER_MAX_MEDIUMS_COUNT = Commons.clamp(1, 64, config.get("mining_laser", "max_mediums_count", MINING_LASER_MAX_MEDIUMS_COUNT, "Maximum number of laser mediums").getInt()); - MINING_LASER_RADIUS_BLOCKS = clamp(1, 64, + MINING_LASER_RADIUS_BLOCKS = Commons.clamp(1, 64, config.get("mining_laser", "radius_blocks", MINING_LASER_RADIUS_BLOCKS, "Mining radius").getInt()); - MINING_LASER_WARMUP_DELAY_TICKS = clamp(1, 300, + MINING_LASER_WARMUP_DELAY_TICKS = Commons.clamp(1, 300, config.get("mining_laser", "warmup_delay_ticks", MINING_LASER_WARMUP_DELAY_TICKS, "Warmup duration (buffer on startup when energy source is weak)").getInt()); - MINING_LASER_SCAN_DELAY_TICKS = clamp(1, 300, + MINING_LASER_SCAN_DELAY_TICKS = Commons.clamp(1, 300, config.get("mining_laser", "scan_delay_ticks", MINING_LASER_SCAN_DELAY_TICKS, "Scan duration per layer").getInt()); - MINING_LASER_MINE_DELAY_TICKS = clamp(1, 300, + MINING_LASER_MINE_DELAY_TICKS = Commons.clamp(1, 300, config.get("mining_laser", "mine_delay_ticks", MINING_LASER_MINE_DELAY_TICKS, "Mining duration per scanned block").getInt()); - MINING_LASER_PLANET_ENERGY_PER_LAYER = clamp(1, Integer.MAX_VALUE, + MINING_LASER_PLANET_ENERGY_PER_LAYER = Commons.clamp(1, Integer.MAX_VALUE, config.get("mining_laser", "planet_energy_per_layer", MINING_LASER_PLANET_ENERGY_PER_LAYER, "Energy cost per layer on a planet").getInt()); - MINING_LASER_PLANET_ENERGY_PER_BLOCK = clamp(1, Integer.MAX_VALUE, + MINING_LASER_PLANET_ENERGY_PER_BLOCK = Commons.clamp(1, Integer.MAX_VALUE, config.get("mining_laser", "planet_energy_per_block", MINING_LASER_PLANET_ENERGY_PER_BLOCK, "Energy cost per block in space").getInt()); - MINING_LASER_SPACE_ENERGY_PER_LAYER = clamp(1, Integer.MAX_VALUE, + MINING_LASER_SPACE_ENERGY_PER_LAYER = Commons.clamp(1, Integer.MAX_VALUE, config.get("mining_laser", "space_energy_per_layer", MINING_LASER_SPACE_ENERGY_PER_LAYER, "Energy cost per layer on a planet").getInt()); - MINING_LASER_SPACE_ENERGY_PER_BLOCK = clamp(1, Integer.MAX_VALUE, + MINING_LASER_SPACE_ENERGY_PER_BLOCK = Commons.clamp(1, Integer.MAX_VALUE, config.get("mining_laser", "space_energy_per_block", MINING_LASER_SPACE_ENERGY_PER_BLOCK, "Energy cost per block in space").getInt()); - MINING_LASER_ORESONLY_ENERGY_FACTOR = clamp(1.5D, 1000.0D, + MINING_LASER_ORESONLY_ENERGY_FACTOR = Commons.clamp(1.5D, 1000.0D, config.get("mining_laser", "oresonly_energy_factor", MINING_LASER_ORESONLY_ENERGY_FACTOR, "Energy cost multiplier per block when mining only ores").getDouble(MINING_LASER_ORESONLY_ENERGY_FACTOR)); - MINING_LASER_SILKTOUCH_ENERGY_FACTOR = clamp(1.5D, 1000.0D, + MINING_LASER_SILKTOUCH_ENERGY_FACTOR = Commons.clamp(1.5D, 1000.0D, config.get("mining_laser", "silktouch_energy_factor", MINING_LASER_SILKTOUCH_ENERGY_FACTOR, "Energy cost multiplier per block when mining with silktouch").getDouble(MINING_LASER_SILKTOUCH_ENERGY_FACTOR)); if (unused) { - MINING_LASER_SILKTOUCH_DEUTERIUM_L = clamp(0.0D, 10.0D, + MINING_LASER_SILKTOUCH_DEUTERIUM_L = Commons.clamp(0.0D, 10.0D, config.get("mining_laser", "silktouch_deuterium_l", MINING_LASER_SILKTOUCH_DEUTERIUM_L, "Deuterium cost per block when mining with silktouch (0 to disable)").getDouble(1.0D)); if (MINING_LASER_SILKTOUCH_DEUTERIUM_L < 0.001D) { MINING_LASER_SILKTOUCH_DEUTERIUM_L = 0.0D; } - MINING_LASER_FORTUNE_ENERGY_FACTOR = clamp(0.01D, 1000.0D, + MINING_LASER_FORTUNE_ENERGY_FACTOR = Commons.clamp(0.01D, 1000.0D, config.get("mining_laser", "fortune_energy_factor", MINING_LASER_FORTUNE_ENERGY_FACTOR, "Energy cost multiplier per fortune level").getDouble(2.5D)); } // Tree Farm - TREE_FARM_MAX_MEDIUMS_COUNT = clamp(1, 10, + TREE_FARM_MAX_MEDIUMS_COUNT = Commons.clamp(1, 10, config.get("tree_farm", "max_mediums_count", TREE_FARM_MAX_MEDIUMS_COUNT, "Maximum number of laser mediums").getInt()); - TREE_FARM_MAX_SCAN_RADIUS_NO_LASER_MEDIUM = clamp(1, 30, + TREE_FARM_MAX_SCAN_RADIUS_NO_LASER_MEDIUM = Commons.clamp(1, 30, config.get("tree_farm", "max_scan_radius_no_laser_medium", TREE_FARM_MAX_SCAN_RADIUS_NO_LASER_MEDIUM, "Maximum scan radius without any laser medium, on X and Z axis, measured in blocks").getInt()); - TREE_FARM_MAX_SCAN_RADIUS_PER_LASER_MEDIUM = clamp(0, 5, + TREE_FARM_MAX_SCAN_RADIUS_PER_LASER_MEDIUM = Commons.clamp(0, 5, config.get("tree_farm", "max_scan_radius_per_laser_medium", TREE_FARM_MAX_SCAN_RADIUS_PER_LASER_MEDIUM, "Bonus to maximum scan radius per laser medium, on X and Z axis, measured in blocks").getInt()); TREE_FARM_totalMaxRadius = TREE_FARM_MAX_SCAN_RADIUS_NO_LASER_MEDIUM + TREE_FARM_MAX_MEDIUMS_COUNT * TREE_FARM_MAX_SCAN_RADIUS_PER_LASER_MEDIUM; - TREE_FARM_MAX_LOG_DISTANCE = clamp(1, 64, + TREE_FARM_MAX_LOG_DISTANCE = Commons.clamp(1, 64, config.get("tree_farm", "max_reach_distance", TREE_FARM_MAX_LOG_DISTANCE, "Maximum reach distance of the laser without any laser medium, measured in blocks").getInt()); - TREE_FARM_MAX_LOG_DISTANCE_PER_MEDIUM = clamp(0, 16, + TREE_FARM_MAX_LOG_DISTANCE_PER_MEDIUM = Commons.clamp(0, 16, config.get("tree_farm", "max_reach_distance_per_laser_medium", TREE_FARM_MAX_LOG_DISTANCE_PER_MEDIUM, "Bonus to maximum reach distance per laser medium, measured in blocks").getInt()); // Cloaking - CLOAKING_MAX_ENERGY_STORED = clamp(1, Integer.MAX_VALUE, + CLOAKING_MAX_ENERGY_STORED = Commons.clamp(1, Integer.MAX_VALUE, config.get("cloaking", "max_energy_stored", CLOAKING_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); - CLOAKING_COIL_CAPTURE_BLOCKS = clamp(0, 30, + CLOAKING_COIL_CAPTURE_BLOCKS = Commons.clamp(0, 30, config.get("cloaking", "coil_capture_blocks", CLOAKING_COIL_CAPTURE_BLOCKS, "Extra blocks covered after the outer coils").getInt()); - CLOAKING_MAX_FIELD_RADIUS = clamp(CLOAKING_COIL_CAPTURE_BLOCKS + 3, 128, + CLOAKING_MAX_FIELD_RADIUS = Commons.clamp(CLOAKING_COIL_CAPTURE_BLOCKS + 3, 128, config.get("cloaking", "max_field_radius", CLOAKING_MAX_FIELD_RADIUS, "Maximum distance between cloaking core and any cloaked side").getInt()); - CLOAKING_TIER1_ENERGY_PER_BLOCK = clamp(0, Integer.MAX_VALUE, + CLOAKING_TIER1_ENERGY_PER_BLOCK = Commons.clamp(0, Integer.MAX_VALUE, config.get("cloaking", "tier1_energy_per_block", CLOAKING_TIER1_ENERGY_PER_BLOCK, "Energy cost per non-air block in a Tier1 cloak").getInt()); - CLOAKING_TIER2_ENERGY_PER_BLOCK = clamp(CLOAKING_TIER1_ENERGY_PER_BLOCK, Integer.MAX_VALUE, + CLOAKING_TIER2_ENERGY_PER_BLOCK = Commons.clamp(CLOAKING_TIER1_ENERGY_PER_BLOCK, Integer.MAX_VALUE, config.get("cloaking", "tier2_energy_per_block", CLOAKING_TIER2_ENERGY_PER_BLOCK, "Energy cost per non-air block in a Tier2 cloak").getInt()); - CLOAKING_FIELD_REFRESH_INTERVAL_SECONDS = clamp(1, 30, + CLOAKING_FIELD_REFRESH_INTERVAL_SECONDS = Commons.clamp(1, 30, config.get("cloaking", "field_refresh_interval_seconds", CLOAKING_FIELD_REFRESH_INTERVAL_SECONDS, "Update speed of cloak simulation").getInt()); // Air generator - AIRGEN_MAX_ENERGY_STORED = clamp(1, Integer.MAX_VALUE, + AIRGEN_MAX_ENERGY_STORED = Commons.clamp(1, Integer.MAX_VALUE, config.get("air_generator", "max_energy_stored", AIRGEN_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); - AIRGEN_ENERGY_PER_CANISTER = clamp(1, AIRGEN_MAX_ENERGY_STORED, + AIRGEN_ENERGY_PER_CANISTER = Commons.clamp(1, AIRGEN_MAX_ENERGY_STORED, config.get("air_generator", "energy_per_canister", AIRGEN_ENERGY_PER_CANISTER, "Energy cost per air canister refilled").getInt()); - AIRGEN_ENERGY_PER_NEWAIRBLOCK = clamp(1, AIRGEN_MAX_ENERGY_STORED, + AIRGEN_ENERGY_PER_NEWAIRBLOCK = Commons.clamp(1, AIRGEN_MAX_ENERGY_STORED, config.get("air_generator", "energy_per_new_air_block", AIRGEN_ENERGY_PER_NEWAIRBLOCK, "Energy cost to start air distribution per open side per interval").getInt()); - AIRGEN_ENERGY_PER_EXISTINGAIRBLOCK = clamp(1, AIRGEN_MAX_ENERGY_STORED, + AIRGEN_ENERGY_PER_EXISTINGAIRBLOCK = Commons.clamp(1, AIRGEN_MAX_ENERGY_STORED, config.get("air_generator", "energy_per_existing_air_block", AIRGEN_ENERGY_PER_EXISTINGAIRBLOCK, "Energy cost to sustain air distribution per open side per interval").getInt()); - AIRGEN_AIR_GENERATION_TICKS = clamp(1, 300, + AIRGEN_AIR_GENERATION_TICKS = Commons.clamp(1, 300, config.get("air_generator", "air_generation_interval_ticks", AIRGEN_AIR_GENERATION_TICKS, "Update speed of air generation").getInt()); // IC2 Reactor monitor - IC2_REACTOR_MAX_ENERGY_STORED = clamp(1, Integer.MAX_VALUE, + IC2_REACTOR_MAX_ENERGY_STORED = Commons.clamp(1, Integer.MAX_VALUE, config.get("ic2_reactor_laser", "max_energy_stored", IC2_REACTOR_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); - IC2_REACTOR_ENERGY_PER_HEAT = clamp(2.0D, 100000.0D, + IC2_REACTOR_ENERGY_PER_HEAT = Commons.clamp(2.0D, 100000.0D, config.get("ic2_reactor_laser", "energy_per_heat", IC2_REACTOR_ENERGY_PER_HEAT, "Energy cost per heat absorbed").getDouble(2)); - IC2_REACTOR_COOLING_INTERVAL_TICKS = clamp(0, 1200, + IC2_REACTOR_COOLING_INTERVAL_TICKS = Commons.clamp(0, 1200, config.get("ic2_reactor_laser", "cooling_interval_ticks", IC2_REACTOR_COOLING_INTERVAL_TICKS, "Update speed of the check for reactors to cooldown").getInt()); // Transporter - TRANSPORTER_MAX_ENERGY_STORED = clamp(1, Integer.MAX_VALUE, + TRANSPORTER_MAX_ENERGY_STORED = Commons.clamp(1, Integer.MAX_VALUE, config.get("transporter", "max_energy_stored", TRANSPORTER_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); TRANSPORTER_USE_RELATIVE_COORDS = config.get("transporter", "use_relative_coords", TRANSPORTER_USE_RELATIVE_COORDS, "Should transporter use relative coordinates?").getBoolean(true); - TRANSPORTER_ENERGY_PER_BLOCK = clamp(1.0D, TRANSPORTER_MAX_ENERGY_STORED / 10.0D, + TRANSPORTER_ENERGY_PER_BLOCK = Commons.clamp(1.0D, TRANSPORTER_MAX_ENERGY_STORED / 10.0D, config.get("transporter", "energy_per_block", TRANSPORTER_ENERGY_PER_BLOCK, "Energy cost per block distance").getDouble(100.0D)); - TRANSPORTER_MAX_BOOST_MUL = clamp(1.0D, 1000.0D, + TRANSPORTER_MAX_BOOST_MUL = Commons.clamp(1.0D, 1000.0D, config.get("transporter", "max_boost", TRANSPORTER_MAX_BOOST_MUL, "Maximum energy boost allowed").getDouble(4.0)); // Enantiomorphic reactor - ENAN_REACTOR_MAX_ENERGY_STORED = clamp(1, Integer.MAX_VALUE, + ENAN_REACTOR_MAX_ENERGY_STORED = Commons.clamp(1, Integer.MAX_VALUE, config.get("enantiomorphic_reactor", "max_energy_stored", ENAN_REACTOR_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); - ENAN_REACTOR_UPDATE_INTERVAL_TICKS = clamp(1, 300, + ENAN_REACTOR_UPDATE_INTERVAL_TICKS = Commons.clamp(1, 300, config.get("enantiomorphic_reactor", "update_interval_ticks", ENAN_REACTOR_UPDATE_INTERVAL_TICKS, "Update speed of the reactor simulation").getInt()); - ENAN_REACTOR_MAX_LASERS_PER_SECOND = clamp(4, 80, + ENAN_REACTOR_MAX_LASERS_PER_SECOND = Commons.clamp(4, 80, config.get("enantiomorphic_reactor", "max_lasers", ENAN_REACTOR_MAX_LASERS_PER_SECOND, "Maximum number of stabilisation laser shots per seconds before loosing efficiency").getInt()); // Energy bank ENERGY_BANK_MAX_ENERGY_STORED = config.get("energy_bank", "max_energy_stored", ENERGY_BANK_MAX_ENERGY_STORED, "Maximum energy stored for each energy bank").getIntList(); assert(ENERGY_BANK_MAX_ENERGY_STORED.length == 3); - ENERGY_BANK_MAX_ENERGY_STORED[0] = clamp( 0, ENERGY_BANK_MAX_ENERGY_STORED[1], ENERGY_BANK_MAX_ENERGY_STORED[0]); - ENERGY_BANK_MAX_ENERGY_STORED[1] = clamp(ENERGY_BANK_MAX_ENERGY_STORED[0], ENERGY_BANK_MAX_ENERGY_STORED[2], ENERGY_BANK_MAX_ENERGY_STORED[1]); - ENERGY_BANK_MAX_ENERGY_STORED[2] = clamp(ENERGY_BANK_MAX_ENERGY_STORED[1], Integer.MAX_VALUE , ENERGY_BANK_MAX_ENERGY_STORED[2]); + ENERGY_BANK_MAX_ENERGY_STORED[0] = Commons.clamp( 0, ENERGY_BANK_MAX_ENERGY_STORED[1], ENERGY_BANK_MAX_ENERGY_STORED[0]); + ENERGY_BANK_MAX_ENERGY_STORED[1] = Commons.clamp(ENERGY_BANK_MAX_ENERGY_STORED[0], ENERGY_BANK_MAX_ENERGY_STORED[2], ENERGY_BANK_MAX_ENERGY_STORED[1]); + ENERGY_BANK_MAX_ENERGY_STORED[2] = Commons.clamp(ENERGY_BANK_MAX_ENERGY_STORED[1], Integer.MAX_VALUE , ENERGY_BANK_MAX_ENERGY_STORED[2]); ENERGY_BANK_IC2_TIER = config.get("energy_bank", "ic2_tier", ENERGY_BANK_IC2_TIER, "IC2 energy tier for each energy bank (0 is BatBox, etc.)").getIntList(); assert(ENERGY_BANK_IC2_TIER.length == 3); - ENERGY_BANK_IC2_TIER[0] = clamp( 0, ENERGY_BANK_IC2_TIER[1], ENERGY_BANK_IC2_TIER[0]); - ENERGY_BANK_IC2_TIER[1] = clamp(ENERGY_BANK_IC2_TIER[0], ENERGY_BANK_IC2_TIER[2], ENERGY_BANK_IC2_TIER[1]); - ENERGY_BANK_IC2_TIER[2] = clamp(ENERGY_BANK_IC2_TIER[1], Integer.MAX_VALUE , ENERGY_BANK_IC2_TIER[2]); + ENERGY_BANK_IC2_TIER[0] = Commons.clamp( 0, ENERGY_BANK_IC2_TIER[1], ENERGY_BANK_IC2_TIER[0]); + ENERGY_BANK_IC2_TIER[1] = Commons.clamp(ENERGY_BANK_IC2_TIER[0], ENERGY_BANK_IC2_TIER[2], ENERGY_BANK_IC2_TIER[1]); + ENERGY_BANK_IC2_TIER[2] = Commons.clamp(ENERGY_BANK_IC2_TIER[1], Integer.MAX_VALUE , ENERGY_BANK_IC2_TIER[2]); ENERGY_BANK_TRANSFER_PER_TICK = config.get("energy_bank", "transfer_per_tick", ENERGY_BANK_TRANSFER_PER_TICK, "Internal energy transferred per tick for each energy bank").getIntList(); assert(ENERGY_BANK_TRANSFER_PER_TICK.length == 3); - ENERGY_BANK_TRANSFER_PER_TICK[0] = clamp( 0, ENERGY_BANK_TRANSFER_PER_TICK[1], ENERGY_BANK_TRANSFER_PER_TICK[0]); - ENERGY_BANK_TRANSFER_PER_TICK[1] = clamp(ENERGY_BANK_TRANSFER_PER_TICK[0], ENERGY_BANK_TRANSFER_PER_TICK[2], ENERGY_BANK_TRANSFER_PER_TICK[1]); - ENERGY_BANK_TRANSFER_PER_TICK[2] = clamp(ENERGY_BANK_TRANSFER_PER_TICK[1], Integer.MAX_VALUE , ENERGY_BANK_TRANSFER_PER_TICK[2]); + ENERGY_BANK_TRANSFER_PER_TICK[0] = Commons.clamp( 0, ENERGY_BANK_TRANSFER_PER_TICK[1], ENERGY_BANK_TRANSFER_PER_TICK[0]); + ENERGY_BANK_TRANSFER_PER_TICK[1] = Commons.clamp(ENERGY_BANK_TRANSFER_PER_TICK[0], ENERGY_BANK_TRANSFER_PER_TICK[2], ENERGY_BANK_TRANSFER_PER_TICK[1]); + ENERGY_BANK_TRANSFER_PER_TICK[2] = Commons.clamp(ENERGY_BANK_TRANSFER_PER_TICK[1], Integer.MAX_VALUE , ENERGY_BANK_TRANSFER_PER_TICK[2]); ENERGY_BANK_EFFICIENCY_PER_UPGRADE = config.get("energy_bank", "efficiency_per_upgrade", ENERGY_BANK_EFFICIENCY_PER_UPGRADE, "Energy transfer efficiency for each upgrade apply, first value is without upgrades (0.8 means 20% loss)").getDoubleList(); assert(ENERGY_BANK_EFFICIENCY_PER_UPGRADE.length >= 1); - ENERGY_BANK_EFFICIENCY_PER_UPGRADE[0] = Math.min(1.0D, clamp( 0.5D, ENERGY_BANK_EFFICIENCY_PER_UPGRADE[1], ENERGY_BANK_EFFICIENCY_PER_UPGRADE[0])); - ENERGY_BANK_EFFICIENCY_PER_UPGRADE[1] = Math.min(1.0D, clamp(ENERGY_BANK_EFFICIENCY_PER_UPGRADE[0], ENERGY_BANK_EFFICIENCY_PER_UPGRADE[2], ENERGY_BANK_EFFICIENCY_PER_UPGRADE[1])); - ENERGY_BANK_EFFICIENCY_PER_UPGRADE[2] = Math.min(1.0D, clamp(ENERGY_BANK_EFFICIENCY_PER_UPGRADE[1], Integer.MAX_VALUE , ENERGY_BANK_EFFICIENCY_PER_UPGRADE[2])); + ENERGY_BANK_EFFICIENCY_PER_UPGRADE[0] = Math.min(1.0D, Commons.clamp( 0.5D, ENERGY_BANK_EFFICIENCY_PER_UPGRADE[1], ENERGY_BANK_EFFICIENCY_PER_UPGRADE[0])); + ENERGY_BANK_EFFICIENCY_PER_UPGRADE[1] = Math.min(1.0D, Commons.clamp(ENERGY_BANK_EFFICIENCY_PER_UPGRADE[0], ENERGY_BANK_EFFICIENCY_PER_UPGRADE[2], ENERGY_BANK_EFFICIENCY_PER_UPGRADE[1])); + ENERGY_BANK_EFFICIENCY_PER_UPGRADE[2] = Math.min(1.0D, Commons.clamp(ENERGY_BANK_EFFICIENCY_PER_UPGRADE[1], Integer.MAX_VALUE , ENERGY_BANK_EFFICIENCY_PER_UPGRADE[2])); // Lift - LIFT_MAX_ENERGY_STORED = clamp(1, Integer.MAX_VALUE, + LIFT_MAX_ENERGY_STORED = Commons.clamp(1, Integer.MAX_VALUE, config.get("lift", "max_energy_stored", LIFT_MAX_ENERGY_STORED, "Maximum energy stored").getInt()); - LIFT_ENERGY_PER_ENTITY = clamp(1, Integer.MAX_VALUE, + LIFT_ENERGY_PER_ENTITY = Commons.clamp(1, Integer.MAX_VALUE, config.get("lift", "energy_per_entity", LIFT_ENERGY_PER_ENTITY, "Energy consumed per entity moved").getInt()); - LIFT_UPDATE_INTERVAL_TICKS = clamp(1, 60, + LIFT_UPDATE_INTERVAL_TICKS = Commons.clamp(1, 60, config.get("lift", "update_interval_ticks", LIFT_UPDATE_INTERVAL_TICKS, "Update speed of the check for entities").getInt()); // Dictionary @@ -766,6 +795,10 @@ public class WarpDriveConfig { // Block transformers library blockTransformers = new HashMap<>(); + // Particles accelerator + ACCELERATOR_MAX_PARTICLE_BUNCHES = Commons.clamp(2, 100, + config.get("accelerator", "max_particle_bunches", ACCELERATOR_MAX_PARTICLE_BUNCHES, "Maximum number of particle bunches per accelerator controller").getInt()); + config.save(); } @@ -774,14 +807,6 @@ public class WarpDriveConfig { WarpDrive.logger.info(modId + " blockTransformer registered"); } - public static int clamp(final int min, final int max, final int value) { - return Math.min(max, Math.max(value, min)); - } - - public static double clamp(final double min, final double max, final double value) { - return Math.min(max, Math.max(value, min)); - } - public static void onFMLInitialization() { CompatWarpDrive.register(); diff --git a/src/main/java/cr0s/warpdrive/config/XmlPreprocessor.java b/src/main/java/cr0s/warpdrive/config/XmlPreprocessor.java index b126428a..e28fb83e 100644 --- a/src/main/java/cr0s/warpdrive/config/XmlPreprocessor.java +++ b/src/main/java/cr0s/warpdrive/config/XmlPreprocessor.java @@ -1,27 +1,26 @@ package cr0s.warpdrive.config; -import java.io.File; -import java.util.ArrayList; -import java.util.Map.Entry; -import java.util.TreeMap; - -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamResult; +import cr0s.warpdrive.WarpDrive; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import cpw.mods.fml.common.Loader; -import cr0s.warpdrive.WarpDrive; - +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import java.io.File; +import java.util.ArrayList; +import java.util.Map.Entry; +import java.util.TreeMap; + +import cpw.mods.fml.common.Loader; public class XmlPreprocessor { static final boolean enableOutput = false; diff --git a/src/main/java/cr0s/warpdrive/config/filler/Filler.java b/src/main/java/cr0s/warpdrive/config/filler/Filler.java index 62da95ec..e76f1759 100644 --- a/src/main/java/cr0s/warpdrive/config/filler/Filler.java +++ b/src/main/java/cr0s/warpdrive/config/filler/Filler.java @@ -1,12 +1,12 @@ package cr0s.warpdrive.config.filler; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.IXmlRepresentable; +import cr0s.warpdrive.config.InvalidXmlException; +import cr0s.warpdrive.data.JumpBlock; import org.w3c.dom.Document; import org.w3c.dom.Element; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.InvalidXmlException; -import cr0s.warpdrive.config.IXmlRepresentable; -import cr0s.warpdrive.data.JumpBlock; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; diff --git a/src/main/java/cr0s/warpdrive/config/filler/FillerManager.java b/src/main/java/cr0s/warpdrive/config/filler/FillerManager.java index 5aef4fa0..3f97cb59 100644 --- a/src/main/java/cr0s/warpdrive/config/filler/FillerManager.java +++ b/src/main/java/cr0s/warpdrive/config/filler/FillerManager.java @@ -1,5 +1,15 @@ package cr0s.warpdrive.config.filler; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.InvalidXmlException; +import cr0s.warpdrive.config.RandomCollection; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.config.XmlPreprocessor; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + import java.io.File; import java.io.FilenameFilter; import java.io.IOException; @@ -8,17 +18,6 @@ import java.util.HashMap; import java.util.Map.Entry; import java.util.Random; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.InvalidXmlException; -import cr0s.warpdrive.config.RandomCollection; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.config.XmlPreprocessor; - public class FillerManager { // all fillerSets private static HashMap> fillerSetsByGroup; diff --git a/src/main/java/cr0s/warpdrive/config/filler/FillerSet.java b/src/main/java/cr0s/warpdrive/config/filler/FillerSet.java index 0d67f326..652bfd1a 100644 --- a/src/main/java/cr0s/warpdrive/config/filler/FillerSet.java +++ b/src/main/java/cr0s/warpdrive/config/filler/FillerSet.java @@ -1,20 +1,19 @@ package cr0s.warpdrive.config.filler; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.IXmlRepresentable; +import cr0s.warpdrive.config.InvalidXmlException; +import cr0s.warpdrive.config.RandomCollection; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + import java.util.ArrayList; import java.util.Collection; import java.util.Random; import net.minecraft.init.Blocks; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.InvalidXmlException; -import cr0s.warpdrive.config.RandomCollection; -import cr0s.warpdrive.config.IXmlRepresentable; - /** * Represents a set of fillers. **/ diff --git a/src/main/java/cr0s/warpdrive/config/structures/AbstractInstance.java b/src/main/java/cr0s/warpdrive/config/structures/AbstractInstance.java index e658dfc7..4b4a99bd 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/AbstractInstance.java +++ b/src/main/java/cr0s/warpdrive/config/structures/AbstractInstance.java @@ -1,6 +1,3 @@ -/** - * - */ package cr0s.warpdrive.config.structures; import java.util.HashMap; diff --git a/src/main/java/cr0s/warpdrive/config/structures/AbstractStructure.java b/src/main/java/cr0s/warpdrive/config/structures/AbstractStructure.java index 0139e58e..0a73dfde 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/AbstractStructure.java +++ b/src/main/java/cr0s/warpdrive/config/structures/AbstractStructure.java @@ -1,17 +1,14 @@ -/** - * - */ package cr0s.warpdrive.config.structures; -import java.util.HashMap; -import java.util.Random; - +import cr0s.warpdrive.config.IXmlRepresentable; +import cr0s.warpdrive.config.InvalidXmlException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; -import cr0s.warpdrive.config.InvalidXmlException; -import cr0s.warpdrive.config.IXmlRepresentable; +import java.util.HashMap; +import java.util.Random; + import net.minecraft.world.gen.feature.WorldGenerator; /** diff --git a/src/main/java/cr0s/warpdrive/config/structures/MetaOrb.java b/src/main/java/cr0s/warpdrive/config/structures/MetaOrb.java index 1b79fac2..c6a411d6 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/MetaOrb.java +++ b/src/main/java/cr0s/warpdrive/config/structures/MetaOrb.java @@ -1,15 +1,15 @@ package cr0s.warpdrive.config.structures; -import java.util.Random; - +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.IXmlRepresentable; +import cr0s.warpdrive.config.InvalidXmlException; +import cr0s.warpdrive.config.WarpDriveConfig; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.InvalidXmlException; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.config.IXmlRepresentable; +import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.world.World; diff --git a/src/main/java/cr0s/warpdrive/config/structures/MetaOrbInstance.java b/src/main/java/cr0s/warpdrive/config/structures/MetaOrbInstance.java index 07d6ebcd..687ab281 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/MetaOrbInstance.java +++ b/src/main/java/cr0s/warpdrive/config/structures/MetaOrbInstance.java @@ -1,17 +1,18 @@ package cr0s.warpdrive.config.structures; +import cr0s.warpdrive.LocalProfiler; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.config.filler.Filler; +import cr0s.warpdrive.config.structures.Orb.OrbShell; +import cr0s.warpdrive.data.VectorI; + import java.util.ArrayList; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; -import cr0s.warpdrive.LocalProfiler; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.config.filler.Filler; -import cr0s.warpdrive.config.structures.Orb.OrbShell; -import cr0s.warpdrive.data.VectorI; public class MetaOrbInstance extends OrbInstance { private static final int CORE_MAX_TRIES = 10; diff --git a/src/main/java/cr0s/warpdrive/config/structures/Orb.java b/src/main/java/cr0s/warpdrive/config/structures/Orb.java index d2ba0d54..6a8433b3 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/Orb.java +++ b/src/main/java/cr0s/warpdrive/config/structures/Orb.java @@ -1,17 +1,16 @@ package cr0s.warpdrive.config.structures; -import java.util.Random; - -import net.minecraft.world.World; - -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.InvalidXmlException; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.config.filler.FillerManager; import cr0s.warpdrive.config.filler.FillerSet; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import java.util.Random; + +import net.minecraft.world.World; public class Orb extends AbstractStructure { diff --git a/src/main/java/cr0s/warpdrive/config/structures/OrbInstance.java b/src/main/java/cr0s/warpdrive/config/structures/OrbInstance.java index d83b06a9..45e1919b 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/OrbInstance.java +++ b/src/main/java/cr0s/warpdrive/config/structures/OrbInstance.java @@ -1,15 +1,16 @@ package cr0s.warpdrive.config.structures; -import java.util.Random; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.config.structures.Orb.OrbShell; import cr0s.warpdrive.world.EntitySphereGen; import cr0s.warpdrive.world.EntityStarCore; import cr0s.warpdrive.world.WorldGenSmallShip; +import java.util.Random; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + public class OrbInstance extends AbstractInstance { protected OrbShell[] orbShells; protected int[] orbShellThicknesses; diff --git a/src/main/java/cr0s/warpdrive/config/structures/StructureManager.java b/src/main/java/cr0s/warpdrive/config/structures/StructureManager.java index 6e95fed1..a981e02a 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/StructureManager.java +++ b/src/main/java/cr0s/warpdrive/config/structures/StructureManager.java @@ -1,23 +1,21 @@ package cr0s.warpdrive.config.structures; -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.util.HashMap; -import java.util.Random; - -import org.apache.commons.lang3.StringUtils; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.InvalidXmlException; import cr0s.warpdrive.config.RandomCollection; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.config.XmlPreprocessor; +import org.apache.commons.lang3.StringUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Random; public class StructureManager { public static final String GROUP_STARS = "star"; @@ -64,7 +62,7 @@ public class StructureManager { WarpDrive.logger.info("Loading structure data files done"); } - private static void loadXmlStructureFile(File file) throws InvalidXmlException, SAXException, IOException { + private static void loadXmlStructureFile(File file) throws InvalidXmlException, SAXException, IOException { WarpDrive.logger.info("Loading structure data file " + file.getName()); Document document = WarpDriveConfig.getXmlDocumentBuilder().parse(file); diff --git a/src/main/java/cr0s/warpdrive/config/structures/StructureReference.java b/src/main/java/cr0s/warpdrive/config/structures/StructureReference.java index 8c754d8f..f364620c 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/StructureReference.java +++ b/src/main/java/cr0s/warpdrive/config/structures/StructureReference.java @@ -1,13 +1,12 @@ package cr0s.warpdrive.config.structures; +import cr0s.warpdrive.config.InvalidXmlException; +import org.w3c.dom.Element; + import java.util.Random; import net.minecraft.world.World; -import org.w3c.dom.Element; - -import cr0s.warpdrive.config.InvalidXmlException; - public class StructureReference extends AbstractStructure { public StructureReference(final String group, final String name) { diff --git a/src/main/java/cr0s/warpdrive/core/ClassTransformer.java b/src/main/java/cr0s/warpdrive/core/ClassTransformer.java index 8c8b84e8..7f00e4dc 100644 --- a/src/main/java/cr0s/warpdrive/core/ClassTransformer.java +++ b/src/main/java/cr0s/warpdrive/core/ClassTransformer.java @@ -1,8 +1,5 @@ package cr0s.warpdrive.core; -import java.util.HashMap; -import java.util.Iterator; - import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; @@ -17,6 +14,9 @@ import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.VarInsnNode; +import java.util.HashMap; +import java.util.Iterator; + public class ClassTransformer implements net.minecraft.launchwrapper.IClassTransformer { private HashMap nodeMap = new HashMap<>(); diff --git a/src/main/java/cr0s/warpdrive/core/FMLLoadingPlugin.java b/src/main/java/cr0s/warpdrive/core/FMLLoadingPlugin.java index b0f53a57..ab02980c 100644 --- a/src/main/java/cr0s/warpdrive/core/FMLLoadingPlugin.java +++ b/src/main/java/cr0s/warpdrive/core/FMLLoadingPlugin.java @@ -1,12 +1,12 @@ package cr0s.warpdrive.core; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import java.io.File; import java.util.Map; import java.util.Map.Entry; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import cpw.mods.fml.relauncher.IFMLCallHook; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; diff --git a/src/main/java/cr0s/warpdrive/core/MyDummyModContainer.java b/src/main/java/cr0s/warpdrive/core/MyDummyModContainer.java index cbe5a76d..ebe1a9fb 100644 --- a/src/main/java/cr0s/warpdrive/core/MyDummyModContainer.java +++ b/src/main/java/cr0s/warpdrive/core/MyDummyModContainer.java @@ -1,10 +1,10 @@ package cr0s.warpdrive.core; -import java.util.Arrays; - import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; +import java.util.Arrays; + import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.LoadController; import cpw.mods.fml.common.ModMetadata; diff --git a/src/main/java/cr0s/warpdrive/data/CameraRegistryItem.java b/src/main/java/cr0s/warpdrive/data/CameraRegistryItem.java index 3f58d313..74902bde 100644 --- a/src/main/java/cr0s/warpdrive/data/CameraRegistryItem.java +++ b/src/main/java/cr0s/warpdrive/data/CameraRegistryItem.java @@ -1,6 +1,7 @@ package cr0s.warpdrive.data; import cr0s.warpdrive.api.IVideoChannel; + import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; diff --git a/src/main/java/cr0s/warpdrive/data/CamerasRegistry.java b/src/main/java/cr0s/warpdrive/data/CamerasRegistry.java index a2e9061c..833d4333 100644 --- a/src/main/java/cr0s/warpdrive/data/CamerasRegistry.java +++ b/src/main/java/cr0s/warpdrive/data/CamerasRegistry.java @@ -1,13 +1,14 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.util.Iterator; import java.util.LinkedList; import net.minecraft.block.Block; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; public class CamerasRegistry { private LinkedList registry; diff --git a/src/main/java/cr0s/warpdrive/data/CloakManager.java b/src/main/java/cr0s/warpdrive/data/CloakManager.java index d6d26ad4..2267180d 100644 --- a/src/main/java/cr0s/warpdrive/data/CloakManager.java +++ b/src/main/java/cr0s/warpdrive/data/CloakManager.java @@ -1,10 +1,11 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.network.PacketHandler; + import java.util.concurrent.CopyOnWriteArraySet; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; @@ -12,17 +13,16 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.network.PacketHandler; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; /** * Cloak manager stores cloaking devices covered areas * * @author Cr0s - * */ - public class CloakManager { private static CopyOnWriteArraySet cloaks = new CopyOnWriteArraySet<>(); diff --git a/src/main/java/cr0s/warpdrive/data/CloakedArea.java b/src/main/java/cr0s/warpdrive/data/CloakedArea.java index 9f89d425..97c6870a 100644 --- a/src/main/java/cr0s/warpdrive/data/CloakedArea.java +++ b/src/main/java/cr0s/warpdrive/data/CloakedArea.java @@ -1,11 +1,13 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.network.PacketHandler; +import cr0s.warpdrive.render.EntityFXBeam; + import java.util.LinkedList; import java.util.List; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; @@ -19,12 +21,11 @@ import net.minecraft.network.Packet; import net.minecraft.server.MinecraftServer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.network.PacketHandler; -import cr0s.warpdrive.render.EntityFXBeam; -@SuppressWarnings("Convert2Diamond") +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class CloakedArea { public int dimensionId = -666; public int coreX, coreY, coreZ; diff --git a/src/main/java/cr0s/warpdrive/data/EnumCameraType.java b/src/main/java/cr0s/warpdrive/data/EnumCameraType.java index 961e66b9..832cc8ab 100644 --- a/src/main/java/cr0s/warpdrive/data/EnumCameraType.java +++ b/src/main/java/cr0s/warpdrive/data/EnumCameraType.java @@ -1,10 +1,10 @@ package cr0s.warpdrive.data; -import java.util.HashMap; - import cr0s.warpdrive.block.TileEntityLaser; import cr0s.warpdrive.block.detection.TileEntityCamera; +import java.util.HashMap; + public enum EnumCameraType { SIMPLE_CAMERA (TileEntityCamera.class), LASER_CAMERA (TileEntityLaser.class); @@ -22,7 +22,7 @@ public enum EnumCameraType { } } - private EnumCameraType(Class clazz) { + EnumCameraType(Class clazz) { this.clazz = clazz; } diff --git a/src/main/java/cr0s/warpdrive/data/EnumForceFieldShape.java b/src/main/java/cr0s/warpdrive/data/EnumForceFieldShape.java index 1386a006..4284bc98 100644 --- a/src/main/java/cr0s/warpdrive/data/EnumForceFieldShape.java +++ b/src/main/java/cr0s/warpdrive/data/EnumForceFieldShape.java @@ -1,5 +1,6 @@ package cr0s.warpdrive.data; + import cr0s.warpdrive.api.IForceFieldShape; import java.util.HashMap; diff --git a/src/main/java/cr0s/warpdrive/data/EnumForceFieldUpgrade.java b/src/main/java/cr0s/warpdrive/data/EnumForceFieldUpgrade.java index fd41714e..1d14fe56 100644 --- a/src/main/java/cr0s/warpdrive/data/EnumForceFieldUpgrade.java +++ b/src/main/java/cr0s/warpdrive/data/EnumForceFieldUpgrade.java @@ -4,9 +4,20 @@ import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IForceFieldUpgrade; import cr0s.warpdrive.api.IForceFieldUpgradeEffector; import cr0s.warpdrive.network.PacketHandler; + +import javax.annotation.Nonnull; + +import java.util.HashMap; + import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.*; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.monster.EntityGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; @@ -15,9 +26,6 @@ import net.minecraft.entity.projectile.EntityFireball; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import java.util.HashMap; - public enum EnumForceFieldUpgrade implements IForceFieldUpgrade, IForceFieldUpgradeEffector { // Upgrade - Compatibility - ----- Value ----- -- Scan speed -- -- Place speed -- --------- Energy costs --------- comment // name projector relay incr. cap minimum maximum minimum maximum startup scan place entity diff --git a/src/main/java/cr0s/warpdrive/data/ForceFieldRegistry.java b/src/main/java/cr0s/warpdrive/data/ForceFieldRegistry.java index e945254e..64ebcd12 100644 --- a/src/main/java/cr0s/warpdrive/data/ForceFieldRegistry.java +++ b/src/main/java/cr0s/warpdrive/data/ForceFieldRegistry.java @@ -4,17 +4,17 @@ import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IBeamFrequency; import cr0s.warpdrive.block.forcefield.TileEntityForceFieldRelay; import cr0s.warpdrive.config.WarpDriveConfig; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.WorldServer; - -import java.util.Iterator; -import java.util.Map; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.WorldServer; + /** * Registry of all known forcefield in the loaded worlds, grouped by frequency * diff --git a/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java b/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java index f7b91379..84451fef 100644 --- a/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java +++ b/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java @@ -1,13 +1,24 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IForceFieldUpgrade; import cr0s.warpdrive.api.IForceFieldShape; +import cr0s.warpdrive.api.IForceFieldUpgrade; import cr0s.warpdrive.api.IForceFieldUpgradeEffector; -import cr0s.warpdrive.block.TileEntityAbstractBase; import cr0s.warpdrive.block.forcefield.TileEntityForceFieldProjector; import cr0s.warpdrive.config.Dictionary; import cr0s.warpdrive.config.WarpDriveConfig; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -17,16 +28,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - public class ForceFieldSetup extends GlobalPosition { private static final float FORCEFIELD_BASE_SCAN_SPEED_BLOCKS_PER_SECOND = 100; private static final float FORCEFIELD_BASE_PLACE_SPEED_BLOCKS_PER_SECOND = 20; @@ -206,7 +207,7 @@ public class ForceFieldSetup extends GlobalPosition { // container identification if (upgradeEffector == EnumForceFieldUpgrade.ITEM_PORT) { - inventories.addAll(TileEntityAbstractBase.getConnectedInventories(tileEntity)); + inventories.addAll(Commons.getConnectedInventories(tileEntity)); } } } diff --git a/src/main/java/cr0s/warpdrive/data/GlobalPosition.java b/src/main/java/cr0s/warpdrive/data/GlobalPosition.java index e51fe637..f97bafce 100644 --- a/src/main/java/cr0s/warpdrive/data/GlobalPosition.java +++ b/src/main/java/cr0s/warpdrive/data/GlobalPosition.java @@ -2,10 +2,12 @@ package cr0s.warpdrive.data; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.WorldServer; import net.minecraft.world.gen.ChunkProviderServer; + import net.minecraftforge.common.DimensionManager; public class GlobalPosition { diff --git a/src/main/java/cr0s/warpdrive/data/JumpBlock.java b/src/main/java/cr0s/warpdrive/data/JumpBlock.java index 7723311a..77a61cc5 100644 --- a/src/main/java/cr0s/warpdrive/data/JumpBlock.java +++ b/src/main/java/cr0s/warpdrive/data/JumpBlock.java @@ -1,11 +1,49 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.block.detection.BlockMonitor; +import cr0s.warpdrive.compat.CompatForgeMultipart; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.config.filler.Filler; + import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; -import net.minecraft.block.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAnvil; +import net.minecraft.block.BlockBed; +import net.minecraft.block.BlockButton; +import net.minecraft.block.BlockChest; +import net.minecraft.block.BlockCocoa; +import net.minecraft.block.BlockDispenser; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.BlockEndPortalFrame; +import net.minecraft.block.BlockEnderChest; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockFurnace; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockHugeMushroom; +import net.minecraft.block.BlockLadder; +import net.minecraft.block.BlockLever; +import net.minecraft.block.BlockLog; +import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.BlockPistonExtension; +import net.minecraft.block.BlockPistonMoving; +import net.minecraft.block.BlockPortal; +import net.minecraft.block.BlockPumpkin; +import net.minecraft.block.BlockRailBase; +import net.minecraft.block.BlockRedstoneDiode; +import net.minecraft.block.BlockSign; +import net.minecraft.block.BlockSkull; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.BlockTorch; +import net.minecraft.block.BlockTrapDoor; +import net.minecraft.block.BlockTripWireHook; +import net.minecraft.block.BlockVine; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -14,13 +52,6 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.storage.ExtendedBlockStorage; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.block.detection.BlockMonitor; -import cr0s.warpdrive.compat.CompatForgeMultipart; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.config.filler.Filler; public class JumpBlock { public Block block; diff --git a/src/main/java/cr0s/warpdrive/data/JumpShip.java b/src/main/java/cr0s/warpdrive/data/JumpShip.java index 3e39f659..1a431a74 100644 --- a/src/main/java/cr0s/warpdrive/data/JumpShip.java +++ b/src/main/java/cr0s/warpdrive/data/JumpShip.java @@ -1,5 +1,12 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.block.movement.TileEntityShipCore; +import cr0s.warpdrive.config.Dictionary; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; @@ -15,11 +22,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.block.movement.TileEntityShipCore; -import cr0s.warpdrive.config.Dictionary; -import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraftforge.common.util.Constants; public class JumpShip { @@ -50,7 +53,7 @@ public class JumpShip { WarpDrive.logger.info(this + " messageToAllPlayersOnShip: " + message); for (MovingEntity me : entitiesOnShip) { if (me.entity instanceof EntityPlayer) { - WarpDrive.addChatMessage((EntityPlayer) me.entity, "[" + Commons.addChatMessage((EntityPlayer) me.entity, "[" + ((shipCore != null && !shipCore.shipName.isEmpty()) ? shipCore.shipName : "WarpCore") + "] " + message); } } diff --git a/src/main/java/cr0s/warpdrive/data/Jumpgate.java b/src/main/java/cr0s/warpdrive/data/Jumpgate.java index 4728fa59..73c84497 100644 --- a/src/main/java/cr0s/warpdrive/data/Jumpgate.java +++ b/src/main/java/cr0s/warpdrive/data/Jumpgate.java @@ -1,8 +1,9 @@ package cr0s.warpdrive.data; -import net.minecraft.util.AxisAlignedBB; import cr0s.warpdrive.world.JumpgateGenerator; +import net.minecraft.util.AxisAlignedBB; + public class Jumpgate { public String name; public int xCoord, yCoord, zCoord; diff --git a/src/main/java/cr0s/warpdrive/data/JumpgatesRegistry.java b/src/main/java/cr0s/warpdrive/data/JumpgatesRegistry.java index 4b8e0423..a00c960a 100644 --- a/src/main/java/cr0s/warpdrive/data/JumpgatesRegistry.java +++ b/src/main/java/cr0s/warpdrive/data/JumpgatesRegistry.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.WarpDrive; + import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -10,8 +12,6 @@ import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; -import cr0s.warpdrive.WarpDrive; - public final class JumpgatesRegistry { private File file; private ArrayList gates = new ArrayList<>(); diff --git a/src/main/java/cr0s/warpdrive/data/MovingEntity.java b/src/main/java/cr0s/warpdrive/data/MovingEntity.java index 9131de6d..d2169044 100644 --- a/src/main/java/cr0s/warpdrive/data/MovingEntity.java +++ b/src/main/java/cr0s/warpdrive/data/MovingEntity.java @@ -1,7 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package cr0s.warpdrive.data; import net.minecraft.entity.Entity; diff --git a/src/main/java/cr0s/warpdrive/data/StarMapRegistry.java b/src/main/java/cr0s/warpdrive/data/StarMapRegistry.java index 3f8c16d3..bbafaa60 100644 --- a/src/main/java/cr0s/warpdrive/data/StarMapRegistry.java +++ b/src/main/java/cr0s/warpdrive/data/StarMapRegistry.java @@ -1,12 +1,19 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.LocalProfiler; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IStarMapRegistryTileEntity; +import cr0s.warpdrive.block.movement.TileEntityShipCore; +import cr0s.warpdrive.block.movement.TileEntityShipCore.EnumShipCoreMode; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.StarMapRegistryItem.EnumStarMapEntryType; + import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; -import cr0s.warpdrive.api.IStarMapRegistryTileEntity; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; @@ -14,13 +21,8 @@ import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.gen.ChunkProviderServer; + import net.minecraftforge.common.DimensionManager; -import cr0s.warpdrive.LocalProfiler; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.block.movement.TileEntityShipCore; -import cr0s.warpdrive.block.movement.TileEntityShipCore.EnumShipCoreMode; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.StarMapRegistryItem.EnumStarMapEntryType; /** * Registry of all known ships, jumpgates, etc. in the world diff --git a/src/main/java/cr0s/warpdrive/data/StarMapRegistryItem.java b/src/main/java/cr0s/warpdrive/data/StarMapRegistryItem.java index 6e71b2aa..9c8460b0 100644 --- a/src/main/java/cr0s/warpdrive/data/StarMapRegistryItem.java +++ b/src/main/java/cr0s/warpdrive/data/StarMapRegistryItem.java @@ -1,10 +1,11 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IStarMapRegistryTileEntity; + import java.util.HashMap; import java.util.UUID; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IStarMapRegistryTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; diff --git a/src/main/java/cr0s/warpdrive/data/Transformation.java b/src/main/java/cr0s/warpdrive/data/Transformation.java index 202301ad..e42e8dcd 100644 --- a/src/main/java/cr0s/warpdrive/data/Transformation.java +++ b/src/main/java/cr0s/warpdrive/data/Transformation.java @@ -1,11 +1,12 @@ package cr0s.warpdrive.data; +import cr0s.warpdrive.api.ITransformation; + import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cr0s.warpdrive.api.ITransformation; public class Transformation implements ITransformation { private final VectorI sourceCore; diff --git a/src/main/java/cr0s/warpdrive/data/Vector3.java b/src/main/java/cr0s/warpdrive/data/Vector3.java index b08a21e1..142bd4c0 100644 --- a/src/main/java/cr0s/warpdrive/data/Vector3.java +++ b/src/main/java/cr0s/warpdrive/data/Vector3.java @@ -12,6 +12,7 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.common.util.ForgeDirection; /** diff --git a/src/main/java/cr0s/warpdrive/data/VectorI.java b/src/main/java/cr0s/warpdrive/data/VectorI.java index e8194b2b..58c0b8ef 100644 --- a/src/main/java/cr0s/warpdrive/data/VectorI.java +++ b/src/main/java/cr0s/warpdrive/data/VectorI.java @@ -1,5 +1,6 @@ package cr0s.warpdrive.data; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; @@ -12,8 +13,8 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.ChunkProviderServer; -import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; /** * Generic 3D vector for efficient block manipulation. diff --git a/src/main/java/cr0s/warpdrive/event/ClientHandler.java b/src/main/java/cr0s/warpdrive/event/ClientHandler.java index fa7758df..de2fa39c 100644 --- a/src/main/java/cr0s/warpdrive/event/ClientHandler.java +++ b/src/main/java/cr0s/warpdrive/event/ClientHandler.java @@ -1,14 +1,17 @@ package cr0s.warpdrive.event; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.Dictionary; import cr0s.warpdrive.config.WarpDriveConfig; + import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.StatCollector; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; + import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cr0s.warpdrive.WarpDrive; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; public class ClientHandler { @@ -18,13 +21,13 @@ public class ClientHandler { return; } if (Dictionary.ITEMS_BREATHING_HELMET.contains(event.itemStack.getItem()) && WarpDriveConfig.isIndustrialCraft2Loaded) { - WarpDrive.addTooltip(event.toolTip, StatCollector.translateToLocalFormatted("warpdrive.tooltip.itemTag.breathingHelmet")); + Commons.addTooltip(event.toolTip, StatCollector.translateToLocalFormatted("warpdrive.tooltip.itemTag.breathingHelmet")); } if (Dictionary.ITEMS_FLYINSPACE.contains(event.itemStack.getItem())) { - WarpDrive.addTooltip(event.toolTip, StatCollector.translateToLocalFormatted("warpdrive.tooltip.itemTag.flyInSpace")); + Commons.addTooltip(event.toolTip, StatCollector.translateToLocalFormatted("warpdrive.tooltip.itemTag.flyInSpace")); } if (Dictionary.ITEMS_NOFALLDAMAGE.contains(event.itemStack.getItem())) { - WarpDrive.addTooltip(event.toolTip, StatCollector.translateToLocalFormatted("warpdrive.tooltip.itemTag.noFallDamage")); + Commons.addTooltip(event.toolTip, StatCollector.translateToLocalFormatted("warpdrive.tooltip.itemTag.noFallDamage")); } if (WarpDrive.isDev && event.entityPlayer.capabilities.isCreativeMode) {// disabled in production Block block = Block.getBlockFromItem(event.itemStack.getItem()); @@ -32,7 +35,7 @@ public class ClientHandler { try { String uniqueName = Block.blockRegistry.getNameForObject(block); if (uniqueName != null) { - WarpDrive.addTooltip(event.toolTip, "" + uniqueName + ""); + Commons.addTooltip(event.toolTip, "" + uniqueName + ""); } } catch(Exception exception) { // no operation @@ -41,20 +44,20 @@ public class ClientHandler { try { String harvestTool = block.getHarvestTool(event.itemStack.getItemDamage()); if (harvestTool != null) { - WarpDrive.addTooltip(event.toolTip, "Harvest with " + harvestTool + " (" + block.getHarvestLevel(event.itemStack.getItemDamage()) + ")"); + Commons.addTooltip(event.toolTip, "Harvest with " + harvestTool + " (" + block.getHarvestLevel(event.itemStack.getItemDamage()) + ")"); } } catch(Exception exception) { // no operation } - WarpDrive.addTooltip(event.toolTip, "Light opacity is " + block.getLightOpacity()); + Commons.addTooltip(event.toolTip, "Light opacity is " + block.getLightOpacity()); try { - WarpDrive.addTooltip(event.toolTip, "Hardness is " + (float)WarpDrive.fieldBlockHardness.get(block)); + Commons.addTooltip(event.toolTip, "Hardness is " + (float)WarpDrive.fieldBlockHardness.get(block)); } catch(Exception exception) { // no operation } - WarpDrive.addTooltip(event.toolTip, "Explosion resistance is " + block.getExplosionResistance(null)); + Commons.addTooltip(event.toolTip, "Explosion resistance is " + block.getExplosionResistance(null)); } } } diff --git a/src/main/java/cr0s/warpdrive/event/JumpSequencer.java b/src/main/java/cr0s/warpdrive/event/JumpSequencer.java index f4f3b2bd..edb18bc4 100644 --- a/src/main/java/cr0s/warpdrive/event/JumpSequencer.java +++ b/src/main/java/cr0s/warpdrive/event/JumpSequencer.java @@ -1,10 +1,32 @@ package cr0s.warpdrive.event; +import cr0s.warpdrive.LocalProfiler; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBlockTransformer; +import cr0s.warpdrive.api.ITransformation; +import cr0s.warpdrive.block.movement.TileEntityShipCore; +import cr0s.warpdrive.config.Dictionary; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.JumpBlock; +import cr0s.warpdrive.data.JumpShip; +import cr0s.warpdrive.data.MovingEntity; +import cr0s.warpdrive.data.Planet; +import cr0s.warpdrive.data.Transformation; +import cr0s.warpdrive.data.Vector3; +import cr0s.warpdrive.data.VectorI; +import cr0s.warpdrive.world.SpaceTeleporter; + import java.io.File; import java.io.FileOutputStream; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeSet; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -22,24 +44,10 @@ import net.minecraft.util.Vec3; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Type; -import cr0s.warpdrive.LocalProfiler; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBlockTransformer; -import cr0s.warpdrive.api.ITransformation; -import cr0s.warpdrive.block.movement.TileEntityShipCore; -import cr0s.warpdrive.config.Dictionary; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.JumpBlock; -import cr0s.warpdrive.data.JumpShip; -import cr0s.warpdrive.data.MovingEntity; -import cr0s.warpdrive.data.Planet; -import cr0s.warpdrive.data.Transformation; -import cr0s.warpdrive.data.Vector3; -import cr0s.warpdrive.data.VectorI; -import cr0s.warpdrive.world.SpaceTeleporter; public class JumpSequencer extends AbstractSequencer { // Jump vector @@ -86,8 +94,8 @@ public class JumpSequencer extends AbstractSequencer { private int ticks = 0; public JumpSequencer(TileEntityShipCore shipCore, boolean isHyperspaceJump, - final int moveX, final int moveY, final int moveZ, final byte rotationSteps, - boolean isCoordJump, int destX, int destY, int destZ) { + final int moveX, final int moveY, final int moveZ, final byte rotationSteps, + boolean isCoordJump, int destX, int destY, int destZ) { this.sourceWorld = shipCore.getWorldObj(); this.ship = new JumpShip(); this.ship.worldObj = sourceWorld; diff --git a/src/main/java/cr0s/warpdrive/event/LivingHandler.java b/src/main/java/cr0s/warpdrive/event/LivingHandler.java index 54402977..5797f1de 100644 --- a/src/main/java/cr0s/warpdrive/event/LivingHandler.java +++ b/src/main/java/cr0s/warpdrive/event/LivingHandler.java @@ -1,11 +1,16 @@ package cr0s.warpdrive.event; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IAirCanister; +import cr0s.warpdrive.api.IBreathingHelmet; +import cr0s.warpdrive.config.Dictionary; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.VectorI; +import cr0s.warpdrive.item.ItemEnergyWrapper; +import cr0s.warpdrive.world.SpaceTeleporter; + import java.util.HashMap; -import cr0s.warpdrive.api.IAirCanister; -import cr0s.warpdrive.api.IBreathingHelmet; -import cr0s.warpdrive.data.VectorI; -import cr0s.warpdrive.item.ItemEnergyWrapper; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -18,14 +23,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingFallEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.Dictionary; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.world.SpaceTeleporter; public class LivingHandler { private final HashMap entity_airBlock; diff --git a/src/main/java/cr0s/warpdrive/event/WorldHandler.java b/src/main/java/cr0s/warpdrive/event/WorldHandler.java index 9e619ccc..0a517b05 100644 --- a/src/main/java/cr0s/warpdrive/event/WorldHandler.java +++ b/src/main/java/cr0s/warpdrive/event/WorldHandler.java @@ -1,5 +1,11 @@ package cr0s.warpdrive.event; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.ChunkCoordIntPair; + import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; @@ -7,10 +13,6 @@ import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; import cpw.mods.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.ChunkCoordIntPair; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.ChunkWatchEvent; diff --git a/src/main/java/cr0s/warpdrive/item/ItemAirCanisterFull.java b/src/main/java/cr0s/warpdrive/item/ItemAirCanisterFull.java index 051da10a..0b7b4034 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemAirCanisterFull.java +++ b/src/main/java/cr0s/warpdrive/item/ItemAirCanisterFull.java @@ -1,12 +1,13 @@ package cr0s.warpdrive.item; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IAirCanister; +import cr0s.warpdrive.data.EnumComponentType; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IAirCanister; -import cr0s.warpdrive.data.EnumComponentType; public class ItemAirCanisterFull extends Item implements IAirCanister { diff --git a/src/main/java/cr0s/warpdrive/item/ItemComponent.java b/src/main/java/cr0s/warpdrive/item/ItemComponent.java index a3944394..55fac2e7 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemComponent.java +++ b/src/main/java/cr0s/warpdrive/item/ItemComponent.java @@ -1,9 +1,13 @@ package cr0s.warpdrive.item; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IAirCanister; +import cr0s.warpdrive.block.energy.BlockEnergyBank; +import cr0s.warpdrive.data.EnumComponentType; + import java.util.List; -import cr0s.warpdrive.block.energy.BlockEnergyBank; -import cr0s.warpdrive.data.EnumComponentType; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -12,8 +16,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IAirCanister; import net.minecraft.world.World; public class ItemComponent extends Item implements IAirCanister { @@ -122,6 +124,6 @@ public class ItemComponent extends Item implements IAirCanister { break; } - WarpDrive.addTooltip(list, tooltip); + Commons.addTooltip(list, tooltip); } } \ No newline at end of file diff --git a/src/main/java/cr0s/warpdrive/item/ItemCrystalToken.java b/src/main/java/cr0s/warpdrive/item/ItemCrystalToken.java index 36fc3f4d..fcf1d77c 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemCrystalToken.java +++ b/src/main/java/cr0s/warpdrive/item/ItemCrystalToken.java @@ -1,6 +1,10 @@ package cr0s.warpdrive.item; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; + +import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -10,8 +14,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import java.util.List; - public class ItemCrystalToken extends Item { private final IIcon[] icons; private static ItemStack[] itemStackCache; @@ -90,12 +92,12 @@ public class ItemCrystalToken extends Item { String tooltipName1 = getUnlocalizedName(itemStack) + ".tooltip"; if (StatCollector.canTranslate(tooltipName1)) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1, getSchematicName(itemStack))); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1, getSchematicName(itemStack))); } String tooltipName2 = getUnlocalizedName() + ".tooltip"; if ((!tooltipName1.equals(tooltipName2)) && StatCollector.canTranslate(tooltipName2)) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2, getSchematicName(itemStack))); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2, getSchematicName(itemStack))); } } } \ No newline at end of file diff --git a/src/main/java/cr0s/warpdrive/item/ItemElectromagneticCell.java b/src/main/java/cr0s/warpdrive/item/ItemElectromagneticCell.java index 8e1c73e0..6b6ef2ef 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemElectromagneticCell.java +++ b/src/main/java/cr0s/warpdrive/item/ItemElectromagneticCell.java @@ -1,12 +1,15 @@ package cr0s.warpdrive.item; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.api.IParticleContainerItem; import cr0s.warpdrive.api.Particle; import cr0s.warpdrive.api.ParticleRegistry; import cr0s.warpdrive.api.ParticleStack; + +import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -17,7 +20,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class ItemElectromagneticCell extends Item implements IParticleContainerItem { private static final String AMOUNT_TO_CONSUME_TAG = "amountToConsume"; @@ -216,18 +220,18 @@ public class ItemElectromagneticCell extends Item implements IParticleContainerI String tooltip; if (particleStack == null || particleStack.getParticle() == null) { tooltip = StatCollector.translateToLocalFormatted("item.warpdrive.atomic.electromagnetic_cell.tooltip.empty"); - WarpDrive.addTooltip(list, tooltip); + Commons.addTooltip(list, tooltip); } else { final Particle particle = particleStack.getParticle(); tooltip = StatCollector.translateToLocalFormatted("item.warpdrive.atomic.electromagnetic_cell.tooltip.filled", particleStack.getAmount(), particle.getLocalizedName()); - WarpDrive.addTooltip(list, tooltip); + Commons.addTooltip(list, tooltip); String particleTooltip = particle.getLocalizedTooltip(); if (!particleTooltip.isEmpty()) { - WarpDrive.addTooltip(list, particleTooltip); + Commons.addTooltip(list, particleTooltip); } } } diff --git a/src/main/java/cr0s/warpdrive/item/ItemEnergyWrapper.java b/src/main/java/cr0s/warpdrive/item/ItemEnergyWrapper.java index 3293de94..cfbcc594 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemEnergyWrapper.java +++ b/src/main/java/cr0s/warpdrive/item/ItemEnergyWrapper.java @@ -1,17 +1,19 @@ package cr0s.warpdrive.item; import cofh.api.energy.IEnergyContainerItem; -import cpw.mods.fml.common.Optional; -import cr0s.warpdrive.block.TileEntityAbstractBase; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.block.TileEntityAbstractEnergy; import cr0s.warpdrive.config.WarpDriveConfig; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItemManager; import ic2.api.item.ISpecialElectricItem; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.Optional; + public class ItemEnergyWrapper { // WarpDrive methods @@ -57,13 +59,13 @@ public class ItemEnergyWrapper { public static int getEnergyStored(ItemStack itemStack) { // IndustrialCraft2 if (WarpDriveConfig.isIndustrialCraft2Loaded && IC2_isContainer(itemStack)) { - double amount_EU = TileEntityAbstractBase.clamp(0, IC2_getMaxEnergyStorage(itemStack), IC2_getEnergyStored(itemStack)); + double amount_EU = Commons.clamp(0, IC2_getMaxEnergyStorage(itemStack), IC2_getEnergyStored(itemStack)); return TileEntityAbstractEnergy.convertEUtoInternal_floor(amount_EU); } // Thermal Expansion if (WarpDriveConfig.isCoFHCoreLoaded && CoFH_isContainer(itemStack)) { - int amount_RF = TileEntityAbstractBase.clamp(0, CoFH_getMaxEnergyStorage(itemStack), CoFH_getEnergyStored(itemStack)); + int amount_RF = Commons.clamp(0, CoFH_getMaxEnergyStorage(itemStack), CoFH_getEnergyStored(itemStack)); return TileEntityAbstractEnergy.convertRFtoInternal_floor(amount_RF); } return 0; diff --git a/src/main/java/cr0s/warpdrive/item/ItemForceFieldShape.java b/src/main/java/cr0s/warpdrive/item/ItemForceFieldShape.java index 9fcb2a79..4c662a06 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemForceFieldShape.java +++ b/src/main/java/cr0s/warpdrive/item/ItemForceFieldShape.java @@ -1,9 +1,13 @@ package cr0s.warpdrive.item; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.forcefield.BlockForceFieldProjector; import cr0s.warpdrive.block.forcefield.BlockForceFieldRelay; import cr0s.warpdrive.data.EnumForceFieldShape; + +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -14,8 +18,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.*; - public class ItemForceFieldShape extends Item { private final IIcon[] icons; private static ItemStack[] itemStackCache; @@ -90,16 +92,16 @@ public class ItemForceFieldShape extends Item { String tooltipName1 = getUnlocalizedName(itemStack) + ".tooltip"; if (StatCollector.canTranslate(tooltipName1)) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1)); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1)); } String tooltipName2 = getUnlocalizedName() + ".tooltip"; if ((!tooltipName1.equals(tooltipName2)) && StatCollector.canTranslate(tooltipName2)) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2)); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2)); } - WarpDrive.addTooltip(list, "\n"); + Commons.addTooltip(list, "\n"); - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.shape.tooltip.usage")); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.shape.tooltip.usage")); } } \ No newline at end of file diff --git a/src/main/java/cr0s/warpdrive/item/ItemForceFieldUpgrade.java b/src/main/java/cr0s/warpdrive/item/ItemForceFieldUpgrade.java index e0065ac6..d5dc1fcf 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemForceFieldUpgrade.java +++ b/src/main/java/cr0s/warpdrive/item/ItemForceFieldUpgrade.java @@ -1,9 +1,13 @@ package cr0s.warpdrive.item; +import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.forcefield.BlockForceFieldProjector; import cr0s.warpdrive.block.forcefield.BlockForceFieldRelay; import cr0s.warpdrive.data.EnumForceFieldUpgrade; + +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -14,8 +18,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - public class ItemForceFieldUpgrade extends Item { private final IIcon[] icons; private static ItemStack[] itemStackCache; @@ -90,23 +92,23 @@ public class ItemForceFieldUpgrade extends Item { String tooltipName1 = getUnlocalizedName(itemStack) + ".tooltip"; if (StatCollector.canTranslate(tooltipName1)) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1)); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName1)); } String tooltipName2 = getUnlocalizedName() + ".tooltip"; if ((!tooltipName1.equals(tooltipName2)) && StatCollector.canTranslate(tooltipName2)) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2)); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted(tooltipName2)); } - WarpDrive.addTooltip(list, "\n"); + Commons.addTooltip(list, "\n"); EnumForceFieldUpgrade enumForceFieldUpgrade = EnumForceFieldUpgrade.get(itemStack.getItemDamage()); if (enumForceFieldUpgrade.maxCountOnProjector > 0) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.projector")); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.projector")); } if (enumForceFieldUpgrade.maxCountOnRelay > 0) { - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.relay")); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.relay")); } - WarpDrive.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.dismount")); + Commons.addTooltip(list, StatCollector.translateToLocalFormatted("item.warpdrive.forcefield.upgrade.tooltip.usage.dismount")); } } diff --git a/src/main/java/cr0s/warpdrive/item/ItemIC2reactorLaserFocus.java b/src/main/java/cr0s/warpdrive/item/ItemIC2reactorLaserFocus.java index cada1ce6..b5565693 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemIC2reactorLaserFocus.java +++ b/src/main/java/cr0s/warpdrive/item/ItemIC2reactorLaserFocus.java @@ -1,13 +1,15 @@ package cr0s.warpdrive.item; -import cpw.mods.fml.common.Optional; +import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.WarpDriveConfig; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import cr0s.warpdrive.WarpDrive; + +import cpw.mods.fml.common.Optional; @Optional.InterfaceList({ @Optional.Interface(iface = "ic2.api.reactor.IReactorComponent", modid = "IC2") diff --git a/src/main/java/cr0s/warpdrive/item/ItemTuningDriver.java b/src/main/java/cr0s/warpdrive/item/ItemTuningDriver.java index f32b5678..d8c8a7c0 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemTuningDriver.java +++ b/src/main/java/cr0s/warpdrive/item/ItemTuningDriver.java @@ -1,10 +1,16 @@ package cr0s.warpdrive.item; + +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBeamFrequency; +import cr0s.warpdrive.api.IControlChannel; +import cr0s.warpdrive.api.IVideoChannel; +import cr0s.warpdrive.api.IWarpTool; +import cr0s.warpdrive.block.energy.BlockEnergyBank; + import java.util.List; -import cr0s.warpdrive.api.IControlChannel; -import cr0s.warpdrive.api.IWarpTool; -import cr0s.warpdrive.block.energy.BlockEnergyBank; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -19,9 +25,6 @@ import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBeamFrequency; -import cr0s.warpdrive.api.IVideoChannel; public class ItemTuningDriver extends Item implements IWarpTool { public static final int MODE_VIDEO_CHANNEL = 0; @@ -181,21 +184,21 @@ public class ItemTuningDriver extends Item implements IWarpTool { switch (itemStack.getItemDamage()) { case MODE_VIDEO_CHANNEL: setVideoChannel(itemStack, world.rand.nextInt(IVideoChannel.VIDEO_CHANNEL_MAX)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.video_channel.get", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.video_channel.get", entityPlayer.getCommandSenderName(), getVideoChannel(itemStack))); return itemStack; case MODE_BEAM_FREQUENCY: setBeamFrequency(itemStack, world.rand.nextInt(IBeamFrequency.BEAM_FREQUENCY_MAX)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.beam_frequency.get", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.beam_frequency.get", entityPlayer.getCommandSenderName(), getBeamFrequency(itemStack))); return itemStack; case MODE_CONTROL_CHANNEL: setControlChannel(itemStack, world.rand.nextInt(IControlChannel.CONTROL_CHANNEL_MAX)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.control_channel.get", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.control_channel.get", entityPlayer.getCommandSenderName(), getControlChannel(itemStack))); return itemStack; @@ -245,12 +248,12 @@ public class ItemTuningDriver extends Item implements IWarpTool { if (tileEntity instanceof IVideoChannel) { if (entityPlayer.isSneaking()) { setVideoChannel(itemStack, ((IVideoChannel) tileEntity).getVideoChannel()); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.video_channel.get", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.video_channel.get", tileEntity.getBlockType().getLocalizedName(), getVideoChannel(itemStack))); } else { ((IVideoChannel) tileEntity).setVideoChannel(getVideoChannel(itemStack)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.video_channel.set", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.video_channel.set", tileEntity.getBlockType().getLocalizedName(), getVideoChannel(itemStack))); } @@ -262,12 +265,12 @@ public class ItemTuningDriver extends Item implements IWarpTool { if (tileEntity instanceof IBeamFrequency) { if (entityPlayer.isSneaking()) { setBeamFrequency(itemStack, ((IBeamFrequency) tileEntity).getBeamFrequency()); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.beam_frequency.get", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.beam_frequency.get", tileEntity.getBlockType().getLocalizedName(), getBeamFrequency(itemStack))); } else { ((IBeamFrequency) tileEntity).setBeamFrequency(getBeamFrequency(itemStack)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.beam_frequency.set", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.beam_frequency.set", tileEntity.getBlockType().getLocalizedName(), getBeamFrequency(itemStack))); } @@ -279,12 +282,12 @@ public class ItemTuningDriver extends Item implements IWarpTool { if (tileEntity instanceof IControlChannel) { if (entityPlayer.isSneaking()) { setControlChannel(itemStack, ((IControlChannel) tileEntity).getControlChannel()); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.control_channel.get", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.control_channel.get", tileEntity.getBlockType().getLocalizedName(), getControlChannel(itemStack))); } else { ((IControlChannel) tileEntity).setControlChannel(getControlChannel(itemStack)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.control_channel.set", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.control_channel.set", tileEntity.getBlockType().getLocalizedName(), getControlChannel(itemStack))); } @@ -325,6 +328,6 @@ public class ItemTuningDriver extends Item implements IWarpTool { tooltip += "\n" + StatCollector.translateToLocal("item.warpdrive.tool.tuning_driver.tooltip.usage"); - WarpDrive.addTooltip(list, tooltip); + Commons.addTooltip(list, tooltip); } } diff --git a/src/main/java/cr0s/warpdrive/item/ItemTuningFork.java b/src/main/java/cr0s/warpdrive/item/ItemTuningFork.java index b396289d..2b1f5ee1 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemTuningFork.java +++ b/src/main/java/cr0s/warpdrive/item/ItemTuningFork.java @@ -1,10 +1,15 @@ package cr0s.warpdrive.item; +import cr0s.warpdrive.Commons; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IBeamFrequency; +import cr0s.warpdrive.api.IControlChannel; +import cr0s.warpdrive.api.IVideoChannel; +import cr0s.warpdrive.api.IWarpTool; +import cr0s.warpdrive.block.energy.BlockEnergyBank; + import java.util.List; -import cr0s.warpdrive.api.IControlChannel; -import cr0s.warpdrive.api.IWarpTool; -import cr0s.warpdrive.block.energy.BlockEnergyBank; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -17,9 +22,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IBeamFrequency; -import cr0s.warpdrive.api.IVideoChannel; public class ItemTuningFork extends Item implements IWarpTool { private IIcon icons[]; @@ -110,27 +112,27 @@ public class ItemTuningFork extends Item implements IWarpTool { } if (hasVideoChannel && !(entityPlayer.isSneaking() && hasBeamFrequency)) { ((IVideoChannel)tileEntity).setVideoChannel(getVideoChannel(itemStack)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.video_channel.set", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.video_channel.set", tileEntity.getBlockType().getLocalizedName(), getVideoChannel(itemStack))); world.playSoundAtEntity(entityPlayer, "WarpDrive:ding", 0.1F, 1F); } else if (hasControlChannel && !(entityPlayer.isSneaking() && hasBeamFrequency)) { ((IControlChannel)tileEntity).setControlChannel(getControlChannel(itemStack)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.control_channel.set", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.control_channel.set", tileEntity.getBlockType().getLocalizedName(), getControlChannel(itemStack))); world.playSoundAtEntity(entityPlayer, "WarpDrive:ding", 0.1F, 1F); } else if (hasBeamFrequency) { ((IBeamFrequency)tileEntity).setBeamFrequency(getBeamFrequency(itemStack)); - WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.beam_frequency.set", + Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.beam_frequency.set", tileEntity.getBlockType().getLocalizedName(), getBeamFrequency(itemStack))); world.playSoundAtEntity(entityPlayer, "WarpDrive:ding", 0.1F, 1F); } else { - WarpDrive.addChatMessage(entityPlayer, "Error: invalid state, please contact the mod authors" + Commons.addChatMessage(entityPlayer, "Error: invalid state, please contact the mod authors" + "\nof " + itemStack + "\nand " + tileEntity); } @@ -154,6 +156,6 @@ public class ItemTuningFork extends Item implements IWarpTool { tooltip += "\n\n" + StatCollector.translateToLocal("item.warpdrive.tool.tuning_fork.tooltip.usage"); - WarpDrive.addTooltip(list, tooltip); + Commons.addTooltip(list, tooltip); } } diff --git a/src/main/java/cr0s/warpdrive/item/ItemUpgrade.java b/src/main/java/cr0s/warpdrive/item/ItemUpgrade.java index 2703af4f..afd328cf 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemUpgrade.java +++ b/src/main/java/cr0s/warpdrive/item/ItemUpgrade.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.item; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.data.UpgradeType; + import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; @@ -8,8 +11,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.data.UpgradeType; public class ItemUpgrade extends Item { private static ItemStack[] isCache = new ItemStack[UpgradeType.values().length]; diff --git a/src/main/java/cr0s/warpdrive/item/ItemWarpArmor.java b/src/main/java/cr0s/warpdrive/item/ItemWarpArmor.java index 4ecfe09b..00f9ebaf 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemWarpArmor.java +++ b/src/main/java/cr0s/warpdrive/item/ItemWarpArmor.java @@ -1,9 +1,10 @@ package cr0s.warpdrive.item; +import cr0s.warpdrive.WarpDrive; + import net.minecraft.entity.Entity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; -import cr0s.warpdrive.WarpDrive; public class ItemWarpArmor extends ItemArmor { public static final String[] suffixes = { "helmet", "chestplate", "leggings", "boots" }; diff --git a/src/main/java/cr0s/warpdrive/network/MessageBeamEffect.java b/src/main/java/cr0s/warpdrive/network/MessageBeamEffect.java index f1c75010..a4f60095 100644 --- a/src/main/java/cr0s/warpdrive/network/MessageBeamEffect.java +++ b/src/main/java/cr0s/warpdrive/network/MessageBeamEffect.java @@ -1,19 +1,20 @@ package cr0s.warpdrive.network; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.Vector3; +import cr0s.warpdrive.render.EntityFXBeam; +import io.netty.buffer.ByteBuf; + import net.minecraft.client.Minecraft; import net.minecraft.world.World; -import io.netty.buffer.ByteBuf; + import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.Vector3; -import cr0s.warpdrive.render.EntityFXBeam; - public class MessageBeamEffect implements IMessage, IMessageHandler { diff --git a/src/main/java/cr0s/warpdrive/network/MessageCloak.java b/src/main/java/cr0s/warpdrive/network/MessageCloak.java index d03b393d..23ad2b92 100644 --- a/src/main/java/cr0s/warpdrive/network/MessageCloak.java +++ b/src/main/java/cr0s/warpdrive/network/MessageCloak.java @@ -1,17 +1,19 @@ package cr0s.warpdrive.network; + +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.CloakedArea; +import io.netty.buffer.ByteBuf; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; -import io.netty.buffer.ByteBuf; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.CloakedArea; - public class MessageCloak implements IMessage, IMessageHandler { private int coreX; diff --git a/src/main/java/cr0s/warpdrive/network/MessageSpawnParticle.java b/src/main/java/cr0s/warpdrive/network/MessageSpawnParticle.java index 2d7e1bdb..b1250267 100644 --- a/src/main/java/cr0s/warpdrive/network/MessageSpawnParticle.java +++ b/src/main/java/cr0s/warpdrive/network/MessageSpawnParticle.java @@ -1,22 +1,29 @@ package cr0s.warpdrive.network; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.Vector3; +import io.netty.buffer.ByteBuf; + import java.nio.charset.StandardCharsets; import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.*; +import net.minecraft.client.particle.EntityBreakingFX; +import net.minecraft.client.particle.EntityExplodeFX; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.EntityFireworkSparkFX; +import net.minecraft.client.particle.EntityFlameFX; +import net.minecraft.client.particle.EntitySnowShovelFX; +import net.minecraft.client.particle.EntitySpellParticleFX; import net.minecraft.init.Items; import net.minecraft.world.World; -import io.netty.buffer.ByteBuf; + import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.Vector3; - public class MessageSpawnParticle implements IMessage, IMessageHandler { diff --git a/src/main/java/cr0s/warpdrive/network/MessageTargeting.java b/src/main/java/cr0s/warpdrive/network/MessageTargeting.java index 28aed367..f6f6ac4c 100644 --- a/src/main/java/cr0s/warpdrive/network/MessageTargeting.java +++ b/src/main/java/cr0s/warpdrive/network/MessageTargeting.java @@ -1,15 +1,16 @@ package cr0s.warpdrive.network; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import io.netty.buffer.ByteBuf; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.TileEntityLaser; import cr0s.warpdrive.config.WarpDriveConfig; +import io.netty.buffer.ByteBuf; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; public class MessageTargeting implements IMessage, IMessageHandler { private int x; diff --git a/src/main/java/cr0s/warpdrive/network/MessageVideoChannel.java b/src/main/java/cr0s/warpdrive/network/MessageVideoChannel.java index 4739dd30..b19b8f41 100644 --- a/src/main/java/cr0s/warpdrive/network/MessageVideoChannel.java +++ b/src/main/java/cr0s/warpdrive/network/MessageVideoChannel.java @@ -1,18 +1,19 @@ package cr0s.warpdrive.network; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IVideoChannel; +import cr0s.warpdrive.config.WarpDriveConfig; +import io.netty.buffer.ByteBuf; + import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import io.netty.buffer.ByteBuf; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.api.IVideoChannel; -import cr0s.warpdrive.config.WarpDriveConfig; - public class MessageVideoChannel implements IMessage, IMessageHandler { private int x; diff --git a/src/main/java/cr0s/warpdrive/network/PacketHandler.java b/src/main/java/cr0s/warpdrive/network/PacketHandler.java index 7e310c54..b6c3e2e0 100644 --- a/src/main/java/cr0s/warpdrive/network/PacketHandler.java +++ b/src/main/java/cr0s/warpdrive/network/PacketHandler.java @@ -1,5 +1,10 @@ package cr0s.warpdrive.network; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.CloakedArea; +import cr0s.warpdrive.data.Vector3; + import java.lang.reflect.Method; import java.util.List; @@ -9,17 +14,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; + import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.CloakedArea; -import cr0s.warpdrive.data.Vector3; public class PacketHandler { private static final SimpleNetworkWrapper simpleNetworkManager = NetworkRegistry.INSTANCE.newSimpleChannel(WarpDrive.MODID); diff --git a/src/main/java/cr0s/warpdrive/render/ClientCameraHandler.java b/src/main/java/cr0s/warpdrive/render/ClientCameraHandler.java index 400a16ce..f50aa326 100644 --- a/src/main/java/cr0s/warpdrive/render/ClientCameraHandler.java +++ b/src/main/java/cr0s/warpdrive/render/ClientCameraHandler.java @@ -1,17 +1,17 @@ package cr0s.warpdrive.render; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.EnumCameraType; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; - import org.lwjgl.input.Keyboard; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.FMLNetworkEvent.ClientDisconnectionFromServerEvent; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.EnumCameraType; public class ClientCameraHandler { public static boolean isOverlayEnabled = false; diff --git a/src/main/java/cr0s/warpdrive/render/EntityCamera.java b/src/main/java/cr0s/warpdrive/render/EntityCamera.java index 2d1260bd..6aa91a0e 100644 --- a/src/main/java/cr0s/warpdrive/render/EntityCamera.java +++ b/src/main/java/cr0s/warpdrive/render/EntityCamera.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.render; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.network.PacketHandler; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.GameSettings; @@ -9,13 +12,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; - import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.network.PacketHandler; - public final class EntityCamera extends EntityLivingBase { // entity coordinates (x, y, z) are dynamically changed by player diff --git a/src/main/java/cr0s/warpdrive/render/EntityFXBeam.java b/src/main/java/cr0s/warpdrive/render/EntityFXBeam.java index 1943f24e..e679b86a 100644 --- a/src/main/java/cr0s/warpdrive/render/EntityFXBeam.java +++ b/src/main/java/cr0s/warpdrive/render/EntityFXBeam.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.render; +import cr0s.warpdrive.data.Vector3; + import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; @@ -13,7 +15,6 @@ import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.data.Vector3; @SideOnly(Side.CLIENT) public class EntityFXBeam extends EntityFX diff --git a/src/main/java/cr0s/warpdrive/render/RenderBlank.java b/src/main/java/cr0s/warpdrive/render/RenderBlank.java index 8cce900f..bd477b27 100644 --- a/src/main/java/cr0s/warpdrive/render/RenderBlank.java +++ b/src/main/java/cr0s/warpdrive/render/RenderBlank.java @@ -2,9 +2,10 @@ package cr0s.warpdrive.render; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; -import net.minecraftforge.client.IRenderHandler; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraftforge.client.IRenderHandler; public class RenderBlank extends IRenderHandler { private static RenderBlank INSTANCE = null; diff --git a/src/main/java/cr0s/warpdrive/render/RenderBlockForceField.java b/src/main/java/cr0s/warpdrive/render/RenderBlockForceField.java index fe8876ad..72ffa295 100644 --- a/src/main/java/cr0s/warpdrive/render/RenderBlockForceField.java +++ b/src/main/java/cr0s/warpdrive/render/RenderBlockForceField.java @@ -1,14 +1,35 @@ package cr0s.warpdrive.render; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.block.forcefield.TileEntityForceField; import cr0s.warpdrive.config.Dictionary; -import net.minecraft.block.*; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockAnvil; +import net.minecraft.block.BlockBeacon; +import net.minecraft.block.BlockBrewingStand; +import net.minecraft.block.BlockCauldron; +import net.minecraft.block.BlockCocoa; +import net.minecraft.block.BlockDragonEgg; +import net.minecraft.block.BlockEndPortalFrame; +import net.minecraft.block.BlockFence; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockFire; +import net.minecraft.block.BlockFlowerPot; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockPane; +import net.minecraft.block.BlockRailBase; +import net.minecraft.block.BlockRedstoneComparator; +import net.minecraft.block.BlockRedstoneDiode; +import net.minecraft.block.BlockRedstoneRepeater; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.BlockWall; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; + // wrapper to native classes to renderId is non-zero so we don't render faces when player camera is inside the block public class RenderBlockForceField implements ISimpleBlockRenderingHandler { public static int renderId = 0; diff --git a/src/main/java/cr0s/warpdrive/render/RenderBlockStandard.java b/src/main/java/cr0s/warpdrive/render/RenderBlockStandard.java index 13c8a741..7293239a 100644 --- a/src/main/java/cr0s/warpdrive/render/RenderBlockStandard.java +++ b/src/main/java/cr0s/warpdrive/render/RenderBlockStandard.java @@ -3,6 +3,7 @@ package cr0s.warpdrive.render; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; + import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; // wrapper to native classes to renderId is non-zero so we don't render faces when player camera is inside the block diff --git a/src/main/java/cr0s/warpdrive/render/RenderEntityParticleBunch.java b/src/main/java/cr0s/warpdrive/render/RenderEntityParticleBunch.java index 90be2dd5..df36e401 100644 --- a/src/main/java/cr0s/warpdrive/render/RenderEntityParticleBunch.java +++ b/src/main/java/cr0s/warpdrive/render/RenderEntityParticleBunch.java @@ -1,16 +1,18 @@ package cr0s.warpdrive.render; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import cr0s.warpdrive.entity.EntityParticleBunch; +import org.lwjgl.opengl.GL11; + +import java.util.Random; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderEntity; import net.minecraft.entity.Entity; -import org.lwjgl.opengl.GL11; -import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderEntityParticleBunch extends RenderEntity { diff --git a/src/main/java/cr0s/warpdrive/render/RenderOverlayCamera.java b/src/main/java/cr0s/warpdrive/render/RenderOverlayCamera.java index 6681d198..95734fa0 100644 --- a/src/main/java/cr0s/warpdrive/render/RenderOverlayCamera.java +++ b/src/main/java/cr0s/warpdrive/render/RenderOverlayCamera.java @@ -1,16 +1,16 @@ package cr0s.warpdrive.render; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.EnumCameraType; +import org.lwjgl.opengl.GL11; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; - -import org.lwjgl.opengl.GL11; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.data.EnumCameraType; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; public class RenderOverlayCamera { private Minecraft mc; diff --git a/src/main/java/cr0s/warpdrive/render/RenderSpaceSky.java b/src/main/java/cr0s/warpdrive/render/RenderSpaceSky.java index f7aef535..95ece1fd 100644 --- a/src/main/java/cr0s/warpdrive/render/RenderSpaceSky.java +++ b/src/main/java/cr0s/warpdrive/render/RenderSpaceSky.java @@ -1,10 +1,11 @@ package cr0s.warpdrive.render; -import java.util.Random; - import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.data.Planet; + +import java.util.Random; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.GLAllocation; @@ -12,11 +13,11 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; -import net.minecraftforge.client.IRenderHandler; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; +import net.minecraftforge.client.IRenderHandler; public class RenderSpaceSky extends IRenderHandler { private static RenderSpaceSky INSTANCE = null; diff --git a/src/main/java/cr0s/warpdrive/world/EntitySphereGen.java b/src/main/java/cr0s/warpdrive/world/EntitySphereGen.java index fb62336b..25c6d953 100644 --- a/src/main/java/cr0s/warpdrive/world/EntitySphereGen.java +++ b/src/main/java/cr0s/warpdrive/world/EntitySphereGen.java @@ -1,16 +1,17 @@ package cr0s.warpdrive.world; +import cr0s.warpdrive.LocalProfiler; +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.structures.Orb.OrbShell; +import cr0s.warpdrive.config.structures.OrbInstance; +import cr0s.warpdrive.data.JumpBlock; + import java.util.ArrayList; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import cr0s.warpdrive.LocalProfiler; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.structures.Orb.OrbShell; -import cr0s.warpdrive.config.structures.OrbInstance; -import cr0s.warpdrive.data.JumpBlock; /* 2014-06-07 21:41:45 [Infos] [STDOUT] Generating star (class 0) at -579 257 1162 diff --git a/src/main/java/cr0s/warpdrive/world/EntityStarCore.java b/src/main/java/cr0s/warpdrive/world/EntityStarCore.java index 9838f062..e8c1c1c1 100644 --- a/src/main/java/cr0s/warpdrive/world/EntityStarCore.java +++ b/src/main/java/cr0s/warpdrive/world/EntityStarCore.java @@ -1,5 +1,7 @@ package cr0s.warpdrive.world; +import cr0s.warpdrive.WarpDrive; + import java.util.List; import net.minecraft.entity.Entity; @@ -9,7 +11,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; + public final class EntityStarCore extends Entity { public int xCoord; diff --git a/src/main/java/cr0s/warpdrive/world/HyperSpaceGenerator.java b/src/main/java/cr0s/warpdrive/world/HyperSpaceGenerator.java index 2d66c5fd..fa1a190b 100644 --- a/src/main/java/cr0s/warpdrive/world/HyperSpaceGenerator.java +++ b/src/main/java/cr0s/warpdrive/world/HyperSpaceGenerator.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.world; + +import cr0s.warpdrive.WarpDrive; + import java.util.List; import java.util.Random; @@ -11,7 +14,6 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderGenerate; -import cr0s.warpdrive.WarpDrive; public class HyperSpaceGenerator extends ChunkProviderGenerate { private World worldObj; diff --git a/src/main/java/cr0s/warpdrive/world/HyperSpaceWorldGenerator.java b/src/main/java/cr0s/warpdrive/world/HyperSpaceWorldGenerator.java index 6e305c74..bd8bde7c 100644 --- a/src/main/java/cr0s/warpdrive/world/HyperSpaceWorldGenerator.java +++ b/src/main/java/cr0s/warpdrive/world/HyperSpaceWorldGenerator.java @@ -1,15 +1,15 @@ package cr0s.warpdrive.world; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.util.Random; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; -import cpw.mods.fml.common.IWorldGenerator; -import cr0s.warpdrive.config.WarpDriveConfig; -/** - * @author Cr0s - */ +import cpw.mods.fml.common.IWorldGenerator; + + public class HyperSpaceWorldGenerator implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { diff --git a/src/main/java/cr0s/warpdrive/world/HyperSpaceWorldProvider.java b/src/main/java/cr0s/warpdrive/world/HyperSpaceWorldProvider.java index ee1f061b..894ff1d5 100644 --- a/src/main/java/cr0s/warpdrive/world/HyperSpaceWorldProvider.java +++ b/src/main/java/cr0s/warpdrive/world/HyperSpaceWorldProvider.java @@ -1,6 +1,11 @@ package cr0s.warpdrive.world; + +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.render.RenderBlank; import cr0s.warpdrive.render.RenderSpaceSky; + import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; @@ -11,12 +16,9 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManagerHell; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; -import cr0s.warpdrive.render.RenderBlank; -import net.minecraftforge.client.IRenderHandler; public class HyperSpaceWorldProvider extends WorldProvider { diff --git a/src/main/java/cr0s/warpdrive/world/SpaceGenerator.java b/src/main/java/cr0s/warpdrive/world/SpaceGenerator.java index b1590f7f..c1937a4a 100644 --- a/src/main/java/cr0s/warpdrive/world/SpaceGenerator.java +++ b/src/main/java/cr0s/warpdrive/world/SpaceGenerator.java @@ -1,5 +1,8 @@ package cr0s.warpdrive.world; + +import cr0s.warpdrive.WarpDrive; + import java.util.List; import java.util.Random; @@ -11,7 +14,6 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderGenerate; -import cr0s.warpdrive.WarpDrive; public class SpaceGenerator extends ChunkProviderGenerate { private World worldObj; diff --git a/src/main/java/cr0s/warpdrive/world/SpaceWorldGenerator.java b/src/main/java/cr0s/warpdrive/world/SpaceWorldGenerator.java index feb65813..013995f8 100644 --- a/src/main/java/cr0s/warpdrive/world/SpaceWorldGenerator.java +++ b/src/main/java/cr0s/warpdrive/world/SpaceWorldGenerator.java @@ -1,10 +1,5 @@ package cr0s.warpdrive.world; -import java.util.Random; - -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; -import cpw.mods.fml.common.IWorldGenerator; import cr0s.warpdrive.LocalProfiler; import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.WarpDriveConfig; @@ -14,9 +9,13 @@ import cr0s.warpdrive.config.structures.Orb.OrbShell; import cr0s.warpdrive.config.structures.OrbInstance; import cr0s.warpdrive.config.structures.StructureManager; -/** - * @author Cr0s - */ +import java.util.Random; + +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +import cpw.mods.fml.common.IWorldGenerator; + public class SpaceWorldGenerator implements IWorldGenerator { @Override @@ -202,7 +201,7 @@ public class SpaceWorldGenerator implements IWorldGenerator { **/ @Deprecated public static void generateSphereDirect( - OrbInstance orbInstance, World world, int xCoord, int yCoord, int zCoord) { + OrbInstance orbInstance, World world, int xCoord, int yCoord, int zCoord) { double radiusC = orbInstance.getTotalThickness() + 0.5D; // Radius from center of block double radiusSq = radiusC * radiusC; // Optimization to avoid square roots... // sphere diff --git a/src/main/java/cr0s/warpdrive/world/SpaceWorldProvider.java b/src/main/java/cr0s/warpdrive/world/SpaceWorldProvider.java index 26305097..827beb1b 100644 --- a/src/main/java/cr0s/warpdrive/world/SpaceWorldProvider.java +++ b/src/main/java/cr0s/warpdrive/world/SpaceWorldProvider.java @@ -1,6 +1,10 @@ package cr0s.warpdrive.world; + +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.render.RenderBlank; import cr0s.warpdrive.render.RenderSpaceSky; + import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChunkCoordinates; @@ -10,10 +14,9 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManagerHell; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.render.RenderBlank; public class SpaceWorldProvider extends WorldProvider { diff --git a/src/main/java/cr0s/warpdrive/world/WorldGenSmallShip.java b/src/main/java/cr0s/warpdrive/world/WorldGenSmallShip.java index c96e2756..cd349e35 100644 --- a/src/main/java/cr0s/warpdrive/world/WorldGenSmallShip.java +++ b/src/main/java/cr0s/warpdrive/world/WorldGenSmallShip.java @@ -1,5 +1,9 @@ package cr0s.warpdrive.world; + +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.util.Random; import net.minecraft.entity.monster.EntityZombie; @@ -11,9 +15,6 @@ import net.minecraft.tileentity.TileEntityChest; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; - public class WorldGenSmallShip extends WorldGenerator { private final boolean corrupted; diff --git a/src/main/java/cr0s/warpdrive/world/WorldGenStation.java b/src/main/java/cr0s/warpdrive/world/WorldGenStation.java index 7dfa6fce..3e657df2 100644 --- a/src/main/java/cr0s/warpdrive/world/WorldGenStation.java +++ b/src/main/java/cr0s/warpdrive/world/WorldGenStation.java @@ -1,19 +1,12 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package cr0s.warpdrive.world; + import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -/** - * - * @author user - */ public class WorldGenStation extends WorldGenerator { private final boolean corrupted; diff --git a/src/main/java/cr0s/warpdrive/world/WorldGenStructure.java b/src/main/java/cr0s/warpdrive/world/WorldGenStructure.java index 20550dcc..3cd679f8 100644 --- a/src/main/java/cr0s/warpdrive/world/WorldGenStructure.java +++ b/src/main/java/cr0s/warpdrive/world/WorldGenStructure.java @@ -1,14 +1,15 @@ package cr0s.warpdrive.world; + +import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.config.WarpDriveConfig; + import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; -import cr0s.warpdrive.WarpDrive; -import cr0s.warpdrive.config.WarpDriveConfig; - public class WorldGenStructure { private Block hullPlain_block; private int hullPlain_metadata;