My life is a living hell, and this will make it significantly less horrible.

This commit is contained in:
BallOfEnergy 2025-11-09 22:45:00 -06:00
parent bc1073f734
commit 252659bdf0
No known key found for this signature in database
GPG Key ID: EE45037B81C2D117
4 changed files with 22 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package com.hbm.handler.radiation;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.hbm.interfaces.Untested;
@ -20,6 +21,7 @@ import net.minecraftforge.event.world.WorldEvent;
public class ChunkRadiationHandler3D extends ChunkRadiationHandler {
private HashMap<World, ThreeDimRadiationPerWorld> perWorld = new HashMap();
private Map<World, ThreeDimRadiationPerWorld> perWorld = new HashMap<>();
@Override @Untested
public float getRadiation(World world, int x, int y, int z) {
@ -75,6 +77,8 @@ public class ChunkRadiationHandler3D extends ChunkRadiationHandler {
HashMap<ChunkCoordIntPair, Float[]> radiation = entry.getValue().radiation;
HashMap<ChunkCoordIntPair, Float[]> buff = new HashMap(radiation);
Map<ChunkCoordIntPair, Float[]> radiation = entry.getValue().radiation;
Map<ChunkCoordIntPair, Float[]> buff = new HashMap<>(radiation);
radiation.clear();
for(Entry<ChunkCoordIntPair, Float[]> chunk : buff.entrySet()) {
@ -182,7 +186,7 @@ public class ChunkRadiationHandler3D extends ChunkRadiationHandler {
}
public static class ThreeDimRadiationPerWorld {
public HashMap<ChunkCoordIntPair, Float[]> radiation = new HashMap();
public Map<ChunkCoordIntPair, Float[]> radiation = new HashMap<>();
}
}

View File

@ -37,6 +37,7 @@ public class ChunkRadiationHandlerNT extends ChunkRadiationHandler {
/* once i have to start debugging this, even my nightmares will start shitting themselves */
private static HashMap<World, WorldRadiationData> worldMap = new HashMap();
private static Map<World, WorldRadiationData> worldMap = new HashMap<>();
@Override
public void clearSystem(World world) {
@ -729,11 +730,15 @@ public class ChunkRadiationHandlerNT extends ChunkRadiationHandler {
public World world;
private Set<BlockPos> dirtyChunks = new HashSet();
private Set<BlockPos> dirtyChunks2 = new HashSet();
private Set<BlockPos> dirtyChunks = new HashSet<>();
private Set<BlockPos> dirtyChunks2 = new HashSet<>();
private boolean iteratingDirty = false;
public Set<RadPocket> activePockets = new HashSet();
public HashMap<ChunkCoordIntPair, ChunkRadiationStorage> data = new HashMap();
public Set<RadPocket> activePockets = new HashSet<>();
public Map<ChunkCoordIntPair, ChunkRadiationStorage> data = new HashMap<>();
public WorldRadiationData(World world) {
this.world = world;
}

View File

@ -2,6 +2,7 @@ package com.hbm.handler.radiation;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
@ -46,6 +47,7 @@ import net.minecraftforge.event.world.WorldEvent;
public class ChunkRadiationHandlerPRISM extends ChunkRadiationHandler {
public ConcurrentHashMap<World, RadPerWorld> perWorld = new ConcurrentHashMap();
public Map<World, RadPerWorld> perWorld = new ConcurrentHashMap<>();
public static int cycles = 0;
public static final float MAX_RADIATION = 1_000_000;
@ -173,6 +175,7 @@ public class ChunkRadiationHandlerPRISM extends ChunkRadiationHandler {
}
public static final HashMap<ChunkCoordIntPair, SubChunk[]> newAdditions = new HashMap();
public static final Map<ChunkCoordIntPair, SubChunk[]> newAdditions = new HashMap<>();
@Override
public void updateSystem() {
@ -260,8 +263,8 @@ public class ChunkRadiationHandlerPRISM extends ChunkRadiationHandler {
}
/** Returns the amount of radiation spread */
private static float spreadRadiation(World world, SubChunk source, int y, ChunkCoordIntPair origin, SubChunk[] chunk, ConcurrentHashMap<ChunkCoordIntPair, SubChunk[]> map, ForgeDirection dir) {
private static float spreadRadiation(World world, SubChunk source, int y, ChunkCoordIntPair origin, SubChunk[] chunk, Map<ChunkCoordIntPair, SubChunk[]> map, ForgeDirection dir) {
float spread = 0.1F;
float amount = source.prevRadiation * spread;
@ -305,7 +308,7 @@ public class ChunkRadiationHandlerPRISM extends ChunkRadiationHandler {
}
public static class RadPerWorld {
public ConcurrentHashMap<ChunkCoordIntPair, SubChunk[]> radiation = new ConcurrentHashMap();
public Map<ChunkCoordIntPair, SubChunk[]> radiation = new ConcurrentHashMap<>();
}
public static class SubChunk {

View File

@ -1,6 +1,7 @@
package com.hbm.handler.radiation;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.hbm.blocks.ModBlocks;
@ -25,7 +26,7 @@ import net.minecraftforge.event.world.WorldEvent;
*/
public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler {
private HashMap<World, SimpleRadiationPerWorld> perWorld = new HashMap();
private Map<World, SimpleRadiationPerWorld> perWorld = new HashMap<>();
private static final float maxRad = 100_000F;
@Override
@ -71,8 +72,8 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler {
for(Entry<World, SimpleRadiationPerWorld> entry : perWorld.entrySet()) {
HashMap<ChunkCoordIntPair, Float> radiation = entry.getValue().radiation;
HashMap<ChunkCoordIntPair, Float> buff = new HashMap(radiation);
Map<ChunkCoordIntPair, Float> radiation = entry.getValue().radiation;
Map<ChunkCoordIntPair, Float> buff = new HashMap<>(radiation);
radiation.clear();
World world = entry.getKey();
@ -183,7 +184,7 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler {
public static class SimpleRadiationPerWorld {
public HashMap<ChunkCoordIntPair, Float> radiation = new HashMap();
public Map<ChunkCoordIntPair, Float> radiation = new HashMap<>();
}
@Override