diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java index 115243c1d..ad4ead178 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java @@ -55,9 +55,6 @@ import java.util.HashSet; /** * This handles creating abstract wrapper objects. - * - * @author James Seibel - * @version 2022-12-5 */ public class WrapperFactory implements IWrapperFactory { @@ -82,6 +79,27 @@ public class WrapperFactory implements IWrapperFactory } } + @Override + public IDhApiBiomeWrapper getBiomeWrapper(String resourceLocationString, IDhApiLevelWrapper levelWrapper) throws IOException, ClassCastException + { + if (!(levelWrapper instanceof ILevelWrapper)) + { + throw new ClassCastException("levelWrapper must be returned by DH and of type ["+ILevelWrapper.class.getName()+"]."); + } + + return BiomeWrapper.deserialize(resourceLocationString, (ILevelWrapper)levelWrapper); + } + @Override + public IDhApiBlockStateWrapper getDefaultBlockStateWrapper(String resourceLocationString, IDhApiLevelWrapper levelWrapper) throws IOException, ClassCastException + { + if (!(levelWrapper instanceof ILevelWrapper)) + { + throw new ClassCastException("Invalid ["+IDhApiLevelWrapper.class.getSimpleName()+"] value given. Level wrapper object must be one given by the DH API (it can't be a custom implementation), specifically of type ["+ILevelWrapper.class.getName()+"]."); + } + + return BlockStateWrapper.deserialize(resourceLocationString, (ILevelWrapper)levelWrapper); + } + @Override public IBiomeWrapper deserializeBiomeWrapper(String str, ILevelWrapper levelWrapper) throws IOException { return BiomeWrapper.deserialize(str, levelWrapper); } @Override @@ -222,7 +240,7 @@ public class WrapperFactory implements IWrapperFactory // confirm the API level wrapper is also a Core wrapper if (!(levelWrapper instanceof ILevelWrapper)) { - throw new ClassCastException("Unable to cast... only DH provided IDhApiLevelWrapper's can be used."); // TODO + throw new ClassCastException("Invalid ["+IDhApiLevelWrapper.class.getSimpleName()+"] value given. Level wrapper object must be one given by the DH API (it can't be a custom implementation), specifically of type ["+ILevelWrapper.class.getName()+"]."); } ILevelWrapper coreLevelWrapper = (ILevelWrapper) levelWrapper; @@ -281,7 +299,7 @@ public class WrapperFactory implements IWrapperFactory // confirm the API level wrapper is also a Core wrapper if (!(levelWrapper instanceof ILevelWrapper)) { - throw new ClassCastException("Unable to cast... only DH provided IDhApiLevelWrapper's can be used."); // TODO + throw new ClassCastException("Invalid ["+IDhApiLevelWrapper.class.getSimpleName()+"] value given. Level wrapper object must be one given by the DH API (it can't be a custom implementation), specifically of type ["+ILevelWrapper.class.getName()+"]."); } ILevelWrapper coreLevelWrapper = (ILevelWrapper) levelWrapper; diff --git a/coreSubProjects b/coreSubProjects index 99dc644ad..4d4eeacbd 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 99dc644adfd9725ac2e4d1091545d19806f579bd +Subproject commit 4d4eeacbddd58b22c8e69da9f81f34e4a3ec3342