Cleaned up a lot of different inspections

This commit is contained in:
Nicholas Ignoffo 2018-03-01 19:27:38 -08:00
parent 0dd0854bd9
commit 70d98455b7
207 changed files with 603 additions and 731 deletions

View file

@ -17,9 +17,9 @@ public class Dungeon {
public static boolean placeStructureAtPosition(Random rand, WorldServer world, BlockPos pos) {
long startTime = System.nanoTime();
Map<EnumFacing, List<BlockPos>> availableDoorMap = new HashMap<EnumFacing, List<BlockPos>>(); //Map of doors. The EnumFacing indicates what way this door faces.
List<AreaDescriptor> descriptorList = new ArrayList<AreaDescriptor>();
Map<BlockPos, Pair<DungeonRoom, PlacementSettings>> roomMap = new HashMap<BlockPos, Pair<DungeonRoom, PlacementSettings>>(); // Placement positions in terms of actual positions
Map<EnumFacing, List<BlockPos>> availableDoorMap = new HashMap<>(); //Map of doors. The EnumFacing indicates what way this door faces.
List<AreaDescriptor> descriptorList = new ArrayList<>();
Map<BlockPos, Pair<DungeonRoom, PlacementSettings>> roomMap = new HashMap<>(); // Placement positions in terms of actual positions
PlacementSettings settings = new PlacementSettings();
Mirror mir = Mirror.NONE;
@ -49,7 +49,7 @@ public class Dungeon {
//Initial AreaDescriptors and door positions are initialized. Time for fun!
for (int i = 0; i < 100; i++) {
List<EnumFacing> facingList = new ArrayList<EnumFacing>();
List<EnumFacing> facingList = new ArrayList<>();
for (Entry<EnumFacing, List<BlockPos>> entry : availableDoorMap.entrySet()) {
if (entry.getValue() != null && !entry.getValue().isEmpty()) {
facingList.add(entry.getKey());
@ -62,7 +62,6 @@ public class Dungeon {
Pair<EnumFacing, BlockPos> removedDoor2 = null;
BlockPos roomLocation = null;
roomPlacement:
for (EnumFacing doorFacing : facingList) {
EnumFacing oppositeDoorFacing = doorFacing.getOpposite();
List<BlockPos> availableDoorList = availableDoorMap.get(doorFacing); //May need to copy here
@ -97,8 +96,9 @@ public class Dungeon {
room = testingRoom;
break roomPlacement;
}
break;
}
// Collections.shuffle(otherDoorList);

View file

@ -13,10 +13,10 @@ import java.util.Map.Entry;
public class DungeonRoom {
public int dungeonWeight = 1;
public Map<String, BlockPos> structureMap = new HashMap<String, BlockPos>();
public Map<String, BlockPos> structureMap = new HashMap<>();
public Map<EnumFacing, List<BlockPos>> doorMap = new HashMap<EnumFacing, List<BlockPos>>(); //Map of doors. The EnumFacing indicates what way this door faces.
public List<AreaDescriptor.Rectangle> descriptorList = new ArrayList<AreaDescriptor.Rectangle>();
public Map<EnumFacing, List<BlockPos>> doorMap = new HashMap<>(); //Map of doors. The EnumFacing indicates what way this door faces.
public List<AreaDescriptor.Rectangle> descriptorList = new ArrayList<>();
public DungeonRoom(Map<String, BlockPos> structureMap, Map<EnumFacing, List<BlockPos>> doorMap, List<AreaDescriptor.Rectangle> descriptorList) {
this.structureMap = structureMap;
@ -25,7 +25,7 @@ public class DungeonRoom {
}
public List<AreaDescriptor> getAreaDescriptors(PlacementSettings settings, BlockPos offset) {
List<AreaDescriptor> newList = new ArrayList<AreaDescriptor>();
List<AreaDescriptor> newList = new ArrayList<>();
for (AreaDescriptor desc : descriptorList) {
newList.add(desc.rotateDescriptor(settings).offset(offset));
@ -35,7 +35,7 @@ public class DungeonRoom {
}
public List<BlockPos> getDoorOffsetsForFacing(PlacementSettings settings, EnumFacing facing, BlockPos offset) {
List<BlockPos> offsetList = new ArrayList<BlockPos>();
List<BlockPos> offsetList = new ArrayList<>();
EnumFacing originalFacing = DungeonUtil.reverseRotate(settings.getMirror(), settings.getRotation(), facing);
if (doorMap.containsKey(originalFacing)) {

View file

@ -6,7 +6,7 @@ import java.util.Map.Entry;
import java.util.Random;
public class DungeonRoomRegistry {
public static Map<DungeonRoom, Integer> dungeonWeightMap = new HashMap<DungeonRoom, Integer>();
public static Map<DungeonRoom, Integer> dungeonWeightMap = new HashMap<>();
private static int totalWeight = 0;
public static void registerDungeonRoom(DungeonRoom room, int weight) {

View file

@ -38,7 +38,7 @@ public class DungeonUtil {
if (doorMap.containsKey(facing)) {
doorMap.get(facing).add(offsetPos);
} else {
List<BlockPos> doorList = new ArrayList<BlockPos>();
List<BlockPos> doorList = new ArrayList<>();
doorList.add(offsetPos);
doorMap.put(facing, doorList);
}