From 95d0765ccb03ba9b1f9d81bcdb0d472ab221d603 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 23 Feb 2023 19:52:51 -0600 Subject: [PATCH] convert several files to Java 8 There may be additional files that require changing --- .../common/wrappers/McObjectConverter.java | 51 +++++++++++++------ .../lod/common/wrappers/WrapperFactory.java | 6 ++- coreSubProjects | 2 +- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/McObjectConverter.java b/common/src/main/java/com/seibel/lod/common/wrappers/McObjectConverter.java index d8869feb0..9c23ea218 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/McObjectConverter.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/McObjectConverter.java @@ -59,22 +59,41 @@ public class McObjectConverter ELodDirection[] lodDirs = ELodDirection.values(); directions = new Direction[lodDirs.length]; lodDirections = new ELodDirection[lodDirs.length]; - for (ELodDirection lodDir : lodDirs) { - Direction dir = switch (lodDir.name().toUpperCase()) { - case "DOWN" -> Direction.DOWN; - case "UP" -> Direction.UP; - case "NORTH" -> Direction.NORTH; - case "SOUTH" -> Direction.SOUTH; - case "WEST" -> Direction.WEST; - case "EAST" -> Direction.EAST; - default -> null; - }; - if (dir == null) { - throw new IllegalArgumentException("Invalid direction on init mapping: " + lodDir); - } - directions[lodDir.ordinal()] = dir; - lodDirections[dir.ordinal()] = lodDir; - } + for (ELodDirection lodDir : lodDirs) + { + Direction dir; + switch (lodDir.name().toUpperCase()) + { + case "DOWN": + dir = Direction.DOWN; + break; + case "UP": + dir = Direction.UP; + break; + case "NORTH": + dir = Direction.NORTH; + break; + case "SOUTH": + dir = Direction.SOUTH; + break; + case "WEST": + dir = Direction.WEST; + break; + case "EAST": + dir = Direction.EAST; + break; + default: + dir = null; + break; + } + + if (dir == null) + { + throw new IllegalArgumentException("Invalid direction on init mapping: " + lodDir); + } + directions[lodDir.ordinal()] = dir; + lodDirections[dir.ordinal()] = lodDir; + } } public static BlockPos Convert(DhBlockPos wrappedPos) { diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/WrapperFactory.java b/common/src/main/java/com/seibel/lod/common/wrappers/WrapperFactory.java index d407cd5ba..e773bc4b3 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/WrapperFactory.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/WrapperFactory.java @@ -97,16 +97,18 @@ public class WrapperFactory implements IWrapperFactory else if (objectArray.length == 2) { // chunk - if (!(objectArray[0] instanceof ChunkAccess chunk)) + if (!(objectArray[0] instanceof ChunkAccess)) { throw new ClassCastException(createChunkWrapperErrorMessage(objectArray)); } + ChunkAccess chunk = (ChunkAccess) objectArray[0]; // light source - if (!(objectArray[1] instanceof LevelReader lightSource)) + if (!(objectArray[1] instanceof LevelReader)) { throw new ClassCastException(createChunkWrapperErrorMessage(objectArray)); } + LevelReader lightSource = (LevelReader) objectArray[1]; return new ChunkWrapper(chunk, lightSource, /*A DH wrapped level isn't necessary*/null); diff --git a/coreSubProjects b/coreSubProjects index 924465a78..5174c7136 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 924465a788f94bfb4f162aa4884ff45b520fd02b +Subproject commit 5174c713639c2e71abe5f0a641149c0f6f4bc258