Cleaned up a lot of different inspections
This commit is contained in:
parent
0dd0854bd9
commit
70d98455b7
207 changed files with 603 additions and 731 deletions
|
@ -11,7 +11,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
public class CorruptionHandler {
|
||||
public static Map<Pair<Block, Integer>, Map<EnumDemonWillType, IBlockState>> corruptBlockMap = new HashMap<Pair<Block, Integer>, Map<EnumDemonWillType, IBlockState>>();
|
||||
public static Map<Pair<Block, Integer>, Map<EnumDemonWillType, IBlockState>> corruptBlockMap = new HashMap<>();
|
||||
|
||||
public static void registerBlockCorruption(EnumDemonWillType type, Block block, int meta, IBlockState corruptedState) {
|
||||
Pair<Block, Integer> pair = Pair.of(block, meta);
|
||||
|
@ -19,7 +19,7 @@ public class CorruptionHandler {
|
|||
Map<EnumDemonWillType, IBlockState> stateMap = corruptBlockMap.get(pair);
|
||||
stateMap.put(type, corruptedState);
|
||||
} else {
|
||||
Map<EnumDemonWillType, IBlockState> stateMap = new HashMap<EnumDemonWillType, IBlockState>();
|
||||
Map<EnumDemonWillType, IBlockState> stateMap = new HashMap<>();
|
||||
stateMap.put(type, corruptedState);
|
||||
corruptBlockMap.put(pair, stateMap);
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import java.util.*;
|
|||
|
||||
public class InversionPillarHandler {
|
||||
public static final double farthestDistanceSquared = 16 * 16;
|
||||
public static Map<Integer, Map<EnumDemonWillType, List<BlockPos>>> pillarMap = new HashMap<Integer, Map<EnumDemonWillType, List<BlockPos>>>();
|
||||
public static Map<Integer, Map<EnumDemonWillType, Map<BlockPos, List<BlockPos>>>> nearPillarMap = new HashMap<Integer, Map<EnumDemonWillType, Map<BlockPos, List<BlockPos>>>>();
|
||||
public static Map<Integer, Map<EnumDemonWillType, List<BlockPos>>> pillarMap = new HashMap<>();
|
||||
public static Map<Integer, Map<EnumDemonWillType, Map<BlockPos, List<BlockPos>>>> nearPillarMap = new HashMap<>();
|
||||
|
||||
public static boolean addPillarToMap(World world, EnumDemonWillType type, BlockPos pos) {
|
||||
int dim = world.provider.getDimension();
|
||||
|
@ -25,15 +25,15 @@ public class InversionPillarHandler {
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
List<BlockPos> posList = new ArrayList<BlockPos>();
|
||||
List<BlockPos> posList = new ArrayList<>();
|
||||
posList.add(pos);
|
||||
willMap.put(type, posList);
|
||||
onPillarAdded(world, type, pos);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Map<EnumDemonWillType, List<BlockPos>> willMap = new HashMap<EnumDemonWillType, List<BlockPos>>();
|
||||
List<BlockPos> posList = new ArrayList<BlockPos>();
|
||||
Map<EnumDemonWillType, List<BlockPos>> willMap = new HashMap<>();
|
||||
List<BlockPos> posList = new ArrayList<>();
|
||||
posList.add(pos);
|
||||
|
||||
willMap.put(type, posList);
|
||||
|
@ -65,7 +65,7 @@ public class InversionPillarHandler {
|
|||
//Assume that it has been added already.
|
||||
private static void onPillarAdded(World world, EnumDemonWillType type, BlockPos pos) {
|
||||
BMLog.DEBUG.info("Adding...");
|
||||
List<BlockPos> closePosList = new ArrayList<BlockPos>();
|
||||
List<BlockPos> closePosList = new ArrayList<>();
|
||||
|
||||
int dim = world.provider.getDimension();
|
||||
if (pillarMap.containsKey(dim)) {
|
||||
|
@ -91,7 +91,7 @@ public class InversionPillarHandler {
|
|||
if (posList != null && !posList.contains(pos)) {
|
||||
posList.add(pos);
|
||||
} else {
|
||||
posList = new ArrayList<BlockPos>();
|
||||
posList = new ArrayList<>();
|
||||
posList.add(pos);
|
||||
posMap.put(closePos, posList);
|
||||
}
|
||||
|
@ -99,14 +99,14 @@ public class InversionPillarHandler {
|
|||
|
||||
posMap.put(pos, closePosList);
|
||||
} else {
|
||||
Map<BlockPos, List<BlockPos>> posMap = new HashMap<BlockPos, List<BlockPos>>();
|
||||
Map<BlockPos, List<BlockPos>> posMap = new HashMap<>();
|
||||
|
||||
posMap.put(pos, closePosList);
|
||||
willMap.put(type, posMap);
|
||||
}
|
||||
} else {
|
||||
Map<EnumDemonWillType, Map<BlockPos, List<BlockPos>>> willMap = new HashMap<EnumDemonWillType, Map<BlockPos, List<BlockPos>>>();
|
||||
Map<BlockPos, List<BlockPos>> posMap = new HashMap<BlockPos, List<BlockPos>>();
|
||||
Map<EnumDemonWillType, Map<BlockPos, List<BlockPos>>> willMap = new HashMap<>();
|
||||
Map<BlockPos, List<BlockPos>> posMap = new HashMap<>();
|
||||
|
||||
posMap.put(pos, closePosList);
|
||||
willMap.put(type, posMap);
|
||||
|
@ -123,9 +123,7 @@ public class InversionPillarHandler {
|
|||
Map<BlockPos, List<BlockPos>> posMap = willMap.get(type);
|
||||
List<BlockPos> posList = posMap.get(pos);
|
||||
if (posList != null) {
|
||||
Iterator<BlockPos> itr = posList.iterator();
|
||||
while (itr.hasNext()) {
|
||||
BlockPos checkPos = itr.next();
|
||||
for (BlockPos checkPos : posList) {
|
||||
List<BlockPos> checkPosList = posMap.get(checkPos);
|
||||
if (checkPosList != null) {
|
||||
checkPosList.remove(pos);
|
||||
|
@ -152,12 +150,12 @@ public class InversionPillarHandler {
|
|||
}
|
||||
}
|
||||
|
||||
return new ArrayList<BlockPos>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public static List<BlockPos> getAllConnectedPillars(World world, EnumDemonWillType type, BlockPos pos) {
|
||||
List<BlockPos> checkedPosList = new ArrayList<BlockPos>();
|
||||
List<BlockPos> uncheckedPosList = new ArrayList<BlockPos>(); //Positions where we did not check their connections.
|
||||
List<BlockPos> checkedPosList = new ArrayList<>();
|
||||
List<BlockPos> uncheckedPosList = new ArrayList<>(); //Positions where we did not check their connections.
|
||||
|
||||
uncheckedPosList.add(pos);
|
||||
|
||||
|
@ -170,7 +168,7 @@ public class InversionPillarHandler {
|
|||
|
||||
while (!uncheckedPosList.isEmpty()) {
|
||||
//Positions that are new this iteration and need to be dumped into uncheckedPosList next iteration.
|
||||
List<BlockPos> newPosList = new ArrayList<BlockPos>();
|
||||
List<BlockPos> newPosList = new ArrayList<>();
|
||||
|
||||
for (BlockPos checkPos : uncheckedPosList) {
|
||||
List<BlockPos> posList = posMap.get(checkPos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue