From 9d7ec4af567e4e5d0366e546dc94ab8139f922fd Mon Sep 17 00:00:00 2001 From: aurilisdev Date: Thu, 26 Mar 2020 17:16:34 +0100 Subject: [PATCH] Probably final Tracked commit - Add option for quantum assembler dupe tick time - Fix fission reactor meltdown logic ( math ) - Dont send any empty packets --- build.gradle | 1 - src/api/physica/api/core/tile/ITileBase.java | 5 ++- .../library/location/GridLocation.java | 8 +++++ .../configuration/ConfigNuclearPhysics.java | 32 +++++++++-------- .../common/tile/TileFissionReactor.java | 35 +++++++++---------- .../common/tile/TileQuantumAssembler.java | 2 +- 6 files changed, 47 insertions(+), 36 deletions(-) diff --git a/build.gradle b/build.gradle index 079aae557..593fa627e 100644 --- a/build.gradle +++ b/build.gradle @@ -137,6 +137,5 @@ task releaseJars(type: Copy) { from coreJar from nuclearJar from forcefieldJar - from missilesJar destinationDir= new File('/releaseJarsOnly/') } \ No newline at end of file diff --git a/src/api/physica/api/core/tile/ITileBase.java b/src/api/physica/api/core/tile/ITileBase.java index 9afebedda..395efdce1 100644 --- a/src/api/physica/api/core/tile/ITileBase.java +++ b/src/api/physica/api/core/tile/ITileBase.java @@ -160,7 +160,10 @@ default void sendDescPacket() List list = new ArrayList<>(); writeSynchronizationPacket(list, null); packetTile.addData(list); - + if (list.isEmpty()) + { + return; + } PacketSystem.INSTANCE.sendToAllAround(packetTile, This()); } } diff --git a/src/api/physica/library/location/GridLocation.java b/src/api/physica/library/location/GridLocation.java index 7cc6eb38e..dac7b037b 100644 --- a/src/api/physica/library/location/GridLocation.java +++ b/src/api/physica/library/location/GridLocation.java @@ -88,6 +88,14 @@ public float getDistance(double x2, double y2, double z2) return MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); } + public double getDistanceSquared(double x2, double y2, double z2) + { + double d3 = xCoord - x2; + double d4 = yCoord - y2; + double d5 = zCoord - z2; + return d3 * d3 + d4 * d4 + d5 * d5; + } + public float getDistance(VectorLocation vector) { double d3 = xCoord - vector.x; diff --git a/src/nuclear/physica/nuclear/common/configuration/ConfigNuclearPhysics.java b/src/nuclear/physica/nuclear/common/configuration/ConfigNuclearPhysics.java index 6a8d4bf07..b86769ebc 100644 --- a/src/nuclear/physica/nuclear/common/configuration/ConfigNuclearPhysics.java +++ b/src/nuclear/physica/nuclear/common/configuration/ConfigNuclearPhysics.java @@ -13,25 +13,26 @@ public class ConfigNuclearPhysics implements IContent { - public static String CATEGORY = "NUCLEAR_PHYSICS"; + public static String CATEGORY = "NUCLEAR_PHYSICS"; - public static float ANTIMATTER_CREATION_SPEED = 1f; - public static boolean ENABLE_PARTICLE_COLLISION = true; - public static boolean ENABLE_PARTICLE_CHUNKLOADING = true; - public static float TURBINE_STEAM_TO_RF_RATIO = 2f; + public static float ANTIMATTER_CREATION_SPEED = 1f; + public static boolean ENABLE_PARTICLE_COLLISION = true; + public static boolean ENABLE_PARTICLE_CHUNKLOADING = true; + public static float TURBINE_STEAM_TO_RF_RATIO = 2f; - public static HashSet PROTECTED_WORLDS = new HashSet<>(Arrays.asList("spawn", "creative")); - public static HashSet QUANTUM_ASSEMBLER_BLACKLIST = new HashSet<>(); - public static boolean FLIP_BLACKLIST_TO_WHITELIST = false; + public static HashSet PROTECTED_WORLDS = new HashSet<>(Arrays.asList("spawn", "creative")); + public static HashSet QUANTUM_ASSEMBLER_BLACKLIST = new HashSet<>(); + public static int QUANTUM_ASSEMBLER_TICKS_REQUIRED = 120; + public static boolean FLIP_BLACKLIST_TO_WHITELIST = false; - public static int URANIUM_ORE_MIN_Y = 10; - public static int URANIUM_ORE_MAX_Y = 40; - public static int URANIUM_ORE_COUNT = 20; - public static int URANIUM_ORE_BRANCH_SIZE = 3; - public static int URANIUM_ORE_HARVEST_LEVEL = 3; + public static int URANIUM_ORE_MIN_Y = 10; + public static int URANIUM_ORE_MAX_Y = 40; + public static int URANIUM_ORE_COUNT = 20; + public static int URANIUM_ORE_BRANCH_SIZE = 3; + public static int URANIUM_ORE_HARVEST_LEVEL = 3; - public static int PLASMA_STRENGTH = 8; - public static int DARK_MATTER_USES = 8; + public static int PLASMA_STRENGTH = 8; + public static int DARK_MATTER_USES = 8; @Override public void register(LoadPhase phase) @@ -58,6 +59,7 @@ public void register(LoadPhase phase) QUANTUM_ASSEMBLER_BLACKLIST = new HashSet<>( Arrays.asList(configuration.getStringList("quantum_assembler_blacklist", CATEGORY, QUANTUM_ASSEMBLER_BLACKLIST.toArray(new String[0]), "Items which are blacklisted from use in the quantum assembler"))); + QUANTUM_ASSEMBLER_TICKS_REQUIRED = configuration.getInt("quantum_assembler_ticks_required", CATEGORY, QUANTUM_ASSEMBLER_TICKS_REQUIRED, 0, 100000, "How meny ticks that are required to dupe one item in the assembler"); FLIP_BLACKLIST_TO_WHITELIST = configuration.getBoolean("flip_blacklist_to_whitelist", CATEGORY, FLIP_BLACKLIST_TO_WHITELIST, "True to turn the blacklist into a whitelist; False to ignore"); TURBINE_STEAM_TO_RF_RATIO = configuration.getFloat("turbineSteamToRfRatio", CATEGORY, TURBINE_STEAM_TO_RF_RATIO, 0.01f, 100f, "Ratio for turbines to convert one ml of steam into rf."); diff --git a/src/nuclear/physica/nuclear/common/tile/TileFissionReactor.java b/src/nuclear/physica/nuclear/common/tile/TileFissionReactor.java index ceaea7226..d93b0492d 100644 --- a/src/nuclear/physica/nuclear/common/tile/TileFissionReactor.java +++ b/src/nuclear/physica/nuclear/common/tile/TileFissionReactor.java @@ -271,25 +271,24 @@ public void performMeltdown() World().setBlockToAir(loc.xCoord, loc.yCoord, loc.zCoord); return; } - int power = (int) (temperature / 125.0f); setInventorySlotContents(SLOT_INPUT, null); - GridLocation location = new GridLocation(loc.xCoord, loc.yCoord, loc.zCoord); - for (int i = -power; i <= power; i++) - { - for (int j = -power; j <= power; j++) - { - for (int k = -power; k <= power; k++) - { - location.set(loc.xCoord + i, loc.yCoord + j, loc.zCoord + k); - Block block = location.getBlock(World()); - if (block == Blocks.water || block == Blocks.flowing_water) - { - location.setBlockAirNonUpdate(World()); - } - } - } - } - World().createExplosion(null, loc.xCoord, loc.yCoord, loc.zCoord, 8, true); + GridLocation currentLocation = new GridLocation(loc.xCoord, loc.yCoord, loc.zCoord); + final int size = 10; + for (int i = -size; i <= size; i++) { + for (int j = -size; j <= size; j++) { + for (int k = -size; k <= size; k++) { + if (loc.getDistanceSquared(loc.xCoord + i, loc.yCoord + j, loc.zCoord + k) >= size * size) { + continue; + } + currentLocation.set(loc.xCoord + i, loc.yCoord + j, loc.zCoord + k); + Block block = currentLocation.getBlock(World()); + if (block == Blocks.water || block == Blocks.flowing_water) { + currentLocation.setBlockAirNonUpdate(World()); + } + } + } + } + World().createExplosion(null, loc.xCoord, loc.yCoord, loc.zCoord, size, true); World().setBlock(loc.xCoord, loc.yCoord, loc.zCoord, NuclearBlockRegister.blockMeltedReactor); } diff --git a/src/nuclear/physica/nuclear/common/tile/TileQuantumAssembler.java b/src/nuclear/physica/nuclear/common/tile/TileQuantumAssembler.java index 9e63440b0..9aef4a2b2 100644 --- a/src/nuclear/physica/nuclear/common/tile/TileQuantumAssembler.java +++ b/src/nuclear/physica/nuclear/common/tile/TileQuantumAssembler.java @@ -22,7 +22,7 @@ public class TileQuantumAssembler extends TileBasePoweredContainer implements IGuiInterface { - public static final int TICKS_REQUIRED = 120; + public static final int TICKS_REQUIRED = ConfigNuclearPhysics.QUANTUM_ASSEMBLER_TICKS_REQUIRED; public static final int SLOT_INPUT = 6; public static final int SLOT_OUTPUT = 7; public static final int POWER_USAGE = ElectricityUtilities.convertEnergy(71000, Unit.WATT, Unit.RF);