diff --git a/buildSrc/src/main/groovy/dh-loader.gradle b/buildSrc/src/main/groovy/dh-loader.gradle index 1e15021c3..82f62b6a0 100644 --- a/buildSrc/src/main/groovy/dh-loader.gradle +++ b/buildSrc/src/main/groovy/dh-loader.gradle @@ -566,6 +566,7 @@ if (isNotCommonProject) { outputs.file(output) doLast { output.withWriter("UTF-8") { writer -> + writer.writeLine("#PARSE_ESCAPES") new JsonSlurper() .parse(input) .each { key, value -> diff --git a/cleanroom/build.gradle b/cleanroom/build.gradle index 3124a395b..3f021d12b 100644 --- a/cleanroom/build.gradle +++ b/cleanroom/build.gradle @@ -43,4 +43,6 @@ sourcesJar { def commonSources = project(":common").sourcesJar dependsOn commonSources from commonSources.archiveFile.map { zipTree(it) } -} \ No newline at end of file +} + + diff --git a/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/CleanroomClientProxy.java b/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/CleanroomClientProxy.java index a86188d6d..f8fa56352 100644 --- a/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/CleanroomClientProxy.java +++ b/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/CleanroomClientProxy.java @@ -59,13 +59,6 @@ import org.lwjgl.opengl.GL32; import java.util.concurrent.AbstractExecutorService; -/** - * This handles all events sent to the client, - * and is the starting point for most of the mod. - * - * @author James_Seibel - * @version 2023-7-27 - */ public class CleanroomClientProxy implements AbstractModInitializer.IEventProxy { private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); @@ -124,6 +117,7 @@ public class CleanroomClientProxy implements AbstractModInitializer.IEventProxy //==============// // chunk events // //==============// + //region @SubscribeEvent public void rightClickBlockEvent(PlayerInteractEvent.RightClickBlock event) @@ -185,11 +179,14 @@ public class CleanroomClientProxy implements AbstractModInitializer.IEventProxy } } + //endregion + //==============// // key bindings // //==============// + //region @SubscribeEvent public void registerKeyBindings(InputEvent.KeyInputEvent event) @@ -206,10 +203,14 @@ public class CleanroomClientProxy implements AbstractModInitializer.IEventProxy ClientApi.INSTANCE.keyPressedEvent(event.getKey());*/ } + //endregion + + //===========// // rendering // //===========// + //region @SubscribeEvent public void afterLevelRenderEvent(TickEvent.RenderTickEvent event) @@ -231,11 +232,20 @@ public class CleanroomClientProxy implements AbstractModInitializer.IEventProxy } @SubscribeEvent - public void onRenderOverlay(RenderGameOverlayEvent.Text event) { + public void onRenderOverlay(RenderGameOverlayEvent.Text event) + { Minecraft mc = Minecraft.getMinecraft(); - if (event.isCanceled() || !mc.gameSettings.showDebugInfo) return; + if (event.isCanceled() + || !mc.gameSettings.showDebugInfo) + { + return; + } F3Screen.addStringToDisplay(event.getRight()); } + //endregion + + + } diff --git a/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/CleanroomServerProxy.java b/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/CleanroomServerProxy.java index 12f5f23db..2d88eaebe 100644 --- a/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/CleanroomServerProxy.java +++ b/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/CleanroomServerProxy.java @@ -82,15 +82,18 @@ public class CleanroomServerProxy implements AbstractModInitializer.IEventProxy //=============// // constructor // //=============// + //region public CleanroomServerProxy(boolean isDedicated) { this.isDedicated = isDedicated; } + //endregion + //========// // events // //========// - + //region // ServerLevelLoadEvent @SubscribeEvent @@ -132,9 +135,11 @@ public class CleanroomServerProxy implements AbstractModInitializer.IEventProxy @SubscribeEvent public void playerLoggedInEvent(PlayerEvent.PlayerLoggedInEvent event) { this.serverApi.serverPlayerJoinEvent(getServerPlayerWrapper(event)); } + @SubscribeEvent public void playerLoggedOutEvent(PlayerEvent.PlayerLoggedOutEvent event) { this.serverApi.serverPlayerDisconnectEvent(getServerPlayerWrapper(event)); } + @SubscribeEvent public void playerChangedDimensionEvent(PlayerEvent.PlayerChangedDimensionEvent event) { @@ -145,15 +150,17 @@ public class CleanroomServerProxy implements AbstractModInitializer.IEventProxy ); } + //endregion + //================// // helper methods // //================// + //region private static ServerLevelWrapper getServerLevelWrapper(WorldServer level) { return ServerLevelWrapper.getWrapper(level); } - private static ServerLevelWrapper getServerLevelWrapper(int dimensionId, PlayerEvent event) { MinecraftServer server = event.player.getServer(); @@ -166,8 +173,9 @@ public class CleanroomServerProxy implements AbstractModInitializer.IEventProxy } private static ServerPlayerWrapper getServerPlayerWrapper(PlayerEvent event) - { - return ServerPlayerWrapper.getWrapper((EntityPlayerMP) event.player); - } + { return ServerPlayerWrapper.getWrapper((EntityPlayerMP) event.player); } + + //endregion + } diff --git a/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/mixins/server/MixinEntityPlayerMP.java b/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/mixins/server/MixinEntityPlayerMP.java index 7f4c9f15c..300cb53f5 100644 --- a/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/mixins/server/MixinEntityPlayerMP.java +++ b/cleanroom/src/main/java/com/seibel/distanthorizons/cleanroom/mixins/server/MixinEntityPlayerMP.java @@ -46,23 +46,21 @@ public abstract class MixinEntityPlayerMP implements IMixinServerPlayer @Nullable private volatile WorldServer distantHorizons$dimensionChangeDestination; + + @Override @Nullable public WorldServer distantHorizons$getDimensionChangeDestination() - { - return this.distantHorizons$dimensionChangeDestination; - } + { return this.distantHorizons$dimensionChangeDestination; } @Inject(at = @At("HEAD"), method = "changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;") public void setDimensionChangeDestination(int destinationDimensionID, ITeleporter teleporter, CallbackInfoReturnable cir) - { - this.distantHorizons$dimensionChangeDestination = this.server.getWorld(destinationDimensionID); - } + { this.distantHorizons$dimensionChangeDestination = this.server.getWorld(destinationDimensionID); } @Inject(at = @At("RETURN"), method = "clearInvulnerableDimensionChange") public void clearDimensionChangeDestination(CallbackInfo ci) - { - this.distantHorizons$dimensionChangeDestination = null; - } + { this.distantHorizons$dimensionChangeDestination = null; } + + } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/commands/AbstractCommand.java b/common/src/main/java/com/seibel/distanthorizons/common/commands/AbstractCommand.java index 43da2ede3..4e8d38eb0 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/commands/AbstractCommand.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/commands/AbstractCommand.java @@ -1,6 +1,9 @@ package com.seibel.distanthorizons.common.commands; -#if MC_VER > MC_1_12_2 +#if MC_VER <= MC_1_12_2 +public abstract class AbstractCommand {} + +#else import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.seibel.distanthorizons.common.wrappers.misc.ServerPlayerWrapper; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/commands/CommandInitializer.java b/common/src/main/java/com/seibel/distanthorizons/common/commands/CommandInitializer.java index 42a1739b5..ba0456a32 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/commands/CommandInitializer.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/commands/CommandInitializer.java @@ -38,6 +38,8 @@ public class CommandInitializer private static final PermissionCheck COMMAND_PERMISSION_CHECK = new PermissionCheck.Require(Permissions.COMMANDS_OWNER); #endif + + #if MC_VER <= MC_1_12_2 public static ICommand initCommands() { @@ -98,7 +100,9 @@ public class CommandInitializer }; } + #else + /** * A received command dispatcher, which is held until the server is ready to initialize the commands. */ diff --git a/common/src/main/java/com/seibel/distanthorizons/common/commands/ConfigCommand.java b/common/src/main/java/com/seibel/distanthorizons/common/commands/ConfigCommand.java index a5057c27e..018d52078 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/commands/ConfigCommand.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/commands/ConfigCommand.java @@ -33,7 +33,7 @@ import java.util.function.ToIntBiFunction; /** * Command for managing config. */ -public class ConfigCommand #if MC_VER > MC_1_12_2 extends AbstractCommand #endif +public class ConfigCommand extends AbstractCommand { #if MC_VER <= MC_1_12_2 @SuppressWarnings({"unchecked", "rawtypes"}) @@ -94,7 +94,9 @@ public class ConfigCommand #if MC_VER > MC_1_12_2 extends AbstractCommand #endif } } } + #else + private static final List> commandArguments = Arrays.asList( new CommandArgumentData<>(Integer.class, configEntry -> integer(configEntry.getMin(), configEntry.getMax()), IntegerArgumentType::getInteger), new CommandArgumentData<>(Double.class, configEntry -> doubleArg(configEntry.getMin(), configEntry.getMax()), DoubleArgumentType::getDouble), diff --git a/common/src/main/java/com/seibel/distanthorizons/common/commands/CrashCommand.java b/common/src/main/java/com/seibel/distanthorizons/common/commands/CrashCommand.java index 4c064aca6..5b9fd17d2 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/commands/CrashCommand.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/commands/CrashCommand.java @@ -17,7 +17,7 @@ import static net.minecraft.commands.Commands.literal; #endif -public class CrashCommand #if MC_VER > MC_1_12_2 extends AbstractCommand #endif +public class CrashCommand extends AbstractCommand { #if MC_VER <= MC_1_12_2 public void execute(ICommandSender sender, String[] args) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/commands/DebugCommand.java b/common/src/main/java/com/seibel/distanthorizons/common/commands/DebugCommand.java index 7752dd066..77a21d783 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/commands/DebugCommand.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/commands/DebugCommand.java @@ -16,7 +16,7 @@ import java.util.ArrayList; import java.util.List; -public class DebugCommand #if MC_VER > MC_1_12_2 extends AbstractCommand #endif +public class DebugCommand extends AbstractCommand { private static String getDebugString() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/commands/PregenCommand.java b/common/src/main/java/com/seibel/distanthorizons/common/commands/PregenCommand.java index 8aa68bdb7..367b9d1be 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/commands/PregenCommand.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/commands/PregenCommand.java @@ -32,7 +32,7 @@ import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; -public class PregenCommand #if MC_VER > MC_1_12_2 extends AbstractCommand #endif +public class PregenCommand extends AbstractCommand { private PregenManager getPregenManager() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/commonMixins/MixinChunkMapCommon.java b/common/src/main/java/com/seibel/distanthorizons/common/commonMixins/MixinChunkMapCommon.java index 3cbed11c8..b72886fb4 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/commonMixins/MixinChunkMapCommon.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/commonMixins/MixinChunkMapCommon.java @@ -18,8 +18,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public class MixinChunkMapCommon { - - public static void onChunkSave(#if MC_VER <= MC_1_12_2 WorldServer #else ServerLevel #endif level, #if MC_VER <= MC_1_12_2 Chunk #else ChunkAccess #endif chunk #if MC_VER > MC_1_12_2, CallbackInfoReturnable ci #endif) + #if MC_VER <= MC_1_12_2 + public static void onChunkSave(WorldServer level, Chunk chunk) + #else + public static void onChunkSave(ServerLevel level, ChunkAccess chunk, CallbackInfoReturnable ci) + #endif { IServerLevelWrapper levelWrapper = ServerLevelWrapper.getWrapper(level); @@ -77,8 +80,13 @@ public class MixinChunkMapCommon // biome validation // // some chunks may be missing their biomes, which cause issues when attempting to save them - #if MC_VER <= MC_1_17_1 - if (chunk.#if MC_VER <= MC_1_12_2 getBiomeArray() #else getBiomes() #endif == null) + #if MC_VER <= MC_1_12_2 + if (chunk. getBiomeArray() == null) + { + return; + } + #elif MC_VER <= MC_1_17_1 + if (chunk.getBiomes() == null) { return; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/render/openGl/glObject/GLState.java b/common/src/main/java/com/seibel/distanthorizons/common/render/openGl/glObject/GLState.java index b66c410b7..b5f9bb355 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/render/openGl/glObject/GLState.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/render/openGl/glObject/GLState.java @@ -182,13 +182,20 @@ public class GLState implements AutoCloseable if (frameBufferSet) { if (GL32.glIsTexture(this.frameBufferTexture0)) + { GL32.glFramebufferTexture2D(GL32.GL_FRAMEBUFFER, GL32.GL_COLOR_ATTACHMENT0, GL32.GL_TEXTURE_2D, this.frameBufferTexture0, 0); + } if (this.frameBufferTexture1 != 0 && GL32.glIsTexture(this.frameBufferTexture1)) + { GL32.glFramebufferTexture2D(GL32.GL_FRAMEBUFFER, GL32.GL_COLOR_ATTACHMENT1, GL32.GL_TEXTURE_2D, this.frameBufferTexture1, 0); + } if (GL32.glIsTexture(this.frameBufferDepthTexture)) + { GL32.glFramebufferTexture2D(GL32.GL_FRAMEBUFFER, GL32.GL_DEPTH_ATTACHMENT, GL32.GL_TEXTURE_2D, this.frameBufferDepthTexture, 0); + } + } GL32.glBindVertexArray(GL32.glIsVertexArray(this.vao) ? this.vao : 0); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/util/ProxyUtil.java b/common/src/main/java/com/seibel/distanthorizons/common/util/ProxyUtil.java index 336ed4e8d..5af15153f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/util/ProxyUtil.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/util/ProxyUtil.java @@ -34,16 +34,22 @@ import net.minecraft.world.level.LevelAccessor; public class ProxyUtil { - public static ILevelWrapper getLevelWrapper(#if MC_VER <= MC_1_12_2 World #else LevelAccessor #endif level) + public static ILevelWrapper getLevelWrapper( + #if MC_VER <= MC_1_12_2 World #else LevelAccessor #endif level + ) { ILevelWrapper levelWrapper; if (level instanceof #if MC_VER <= MC_1_12_2 WorldServer #else ServerLevel #endif) { - levelWrapper = ServerLevelWrapper.getWrapper(#if MC_VER <= MC_1_12_2 (WorldServer) #else (ServerLevel) #endif level); + levelWrapper = ServerLevelWrapper.getWrapper( + #if MC_VER <= MC_1_12_2 (WorldServer) #else (ServerLevel) #endif level + ); } else { - levelWrapper = ClientLevelWrapper.getWrapper(#if MC_VER <= MC_1_12_2 (WorldClient) #else (ClientLevel) #endif level); + levelWrapper = ClientLevelWrapper.getWrapper( + #if MC_VER <= MC_1_12_2 (WorldClient) #else (ClientLevel) #endif level + ); } return levelWrapper; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/AbstractDhTintGetter.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/AbstractDhTintGetter.java index d25b3e4f7..e6361fb32 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/AbstractDhTintGetter.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/AbstractDhTintGetter.java @@ -49,8 +49,6 @@ public abstract class AbstractDhTintGetter implements BlockAndTintGetter #endif private static final ConcurrentHashMap COLOR_BY_BLOCK_BIOME_PAIR = new ConcurrentHashMap<>(); - /** returned if the color cache is incomplete */ - public static final int INVALID_COLOR = -1; protected BiomeWrapper biomeWrapper; @@ -102,7 +100,7 @@ public abstract class AbstractDhTintGetter implements BlockAndTintGetter * Can be called by DH directly, skipping some of MC's logic * to speed up tint getting slightly. * - * @return {@link AbstractDhTintGetter#INVALID_COLOR} if any of the biomes needed for this position + * @return {@link ClientBlockStateColorCache#INVALID_COLOR} if any of the biomes needed for this position * were not cached. In that case calling {@link AbstractDhTintGetter#getBlockTint(BlockPos, ColorResolver)} * will need to be called by MC's ColorResolver so we can * populate the color cache. @@ -163,9 +161,9 @@ public abstract class AbstractDhTintGetter implements BlockAndTintGetter int id = FullDataPointUtil.getId(dataPoint); BiomeWrapper biomeWrapper = (BiomeWrapper) this.fullDataSource.mapping.getBiomeWrapper(id); int color = this.tryGetClientBiomeColor(colorResolver, biomeWrapper); - if (color == INVALID_COLOR) + if (color == ClientBlockStateColorCache.INVALID_COLOR) { - return INVALID_COLOR; + return ClientBlockStateColorCache.INVALID_COLOR; } @@ -214,7 +212,7 @@ public abstract class AbstractDhTintGetter implements BlockAndTintGetter // no color resolver is present, // the cache needs to be populated before // we can use the fast path - return INVALID_COLOR; + return ClientBlockStateColorCache.INVALID_COLOR; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java index 5106c5e37..593717c16 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java @@ -342,7 +342,9 @@ public class BiomeWrapper implements IBiomeWrapper } } - public static BiomeDeserializeResult deserializeBiome(String resourceLocationString #if MC_VER > MC_1_12_2, net.minecraft.core.RegistryAccess registryAccess #endif) throws IOException + public static BiomeDeserializeResult deserializeBiome(String resourceLocationString + #if MC_VER > MC_1_12_2, net.minecraft.core.RegistryAccess registryAccess #endif + ) throws IOException { // parse the resource location int separatorIndex = resourceLocationString.indexOf(":"); @@ -373,10 +375,10 @@ public class BiomeWrapper implements IBiomeWrapper boolean success; - #if MC_VER == MC_1_12_2 + #if MC_VER <= MC_1_12_2 Biome biome = Biome.REGISTRY.getObject(resourceLocation); success = (biome != null); - #elif MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 + #elif MC_VER <= MC_1_17_1 Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); success = (biome != null); #elif MC_VER <= MC_1_19_2 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 9518a969d..59c1428ee 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -153,33 +153,58 @@ public class BlockStateWrapper implements IBlockStateWrapper // constructors // //==============// //region - #if MC_VER <= MC_1_12_2 /** - * Can be faster than {@link BlockStateWrapper#fromBlockState(IBlockState, ILevelWrapper)} + * Can be faster than BlockStateWrapper#fromBlockState(BlockState, ILevelWrapper) * in cases where the same block state is expected to be referenced multiple times. */ - #else - /** - * Can be faster than {@link BlockStateWrapper#fromBlockState(BlockState, ILevelWrapper)} - * in cases where the same block state is expected to be referenced multiple times. - */ - #endif - public static BlockStateWrapper fromBlockState(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, ILevelWrapper levelWrapper, IBlockStateWrapper guess) + public static BlockStateWrapper fromBlockState( + #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, + ILevelWrapper levelWrapper, IBlockStateWrapper guess) { - #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif guessBlockState = (guess == null || guess.isAir()) ? null : (#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif) guess.getWrappedMcObject(); - #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif inputBlockState = (blockState == null || #if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.AIR #else blockState.isAir() #endif) ? null : blockState; - - if (guess instanceof BlockStateWrapper - && guessBlockState == inputBlockState) - { - return (BlockStateWrapper) guess; - } - else + if (guess == null) { return fromBlockState(blockState, levelWrapper); } + + + // guess block state + BlockStateWrapper wrapperGuess = (BlockStateWrapper) guess; + #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif guessBlockState; + if(isAir(wrapperGuess.blockState)) + { + guessBlockState = null; + } + else + { + #if MC_VER <= MC_1_12_2 + guessBlockState = (IBlockState) guess.getWrappedMcObject(); + #else + guessBlockState = (BlockState) guess.getWrappedMcObject(); + #endif + } + + // input block state + #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif inputBlockState; + if (isAir(blockState)) + { + inputBlockState = null; + } + else + { + inputBlockState = blockState; + } + + + if (guessBlockState == inputBlockState) + { + return (BlockStateWrapper) guess; + } + + return fromBlockState(blockState, levelWrapper); } - public static BlockStateWrapper fromBlockState(@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, ILevelWrapper levelWrapper) + public static BlockStateWrapper fromBlockState( + @Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, + ILevelWrapper levelWrapper) { // air is a special case if (isAir(blockState)) @@ -248,13 +273,13 @@ public class BlockStateWrapper implements IBlockStateWrapper } else { - #if MC_VER <= MC_1_12_2 - this.isLiquid = this.blockState.getMaterial().isLiquid() || this.blockState.getBlock() instanceof IFluidBlock; - #elif MC_VER < MC_1_20_1 - this.isLiquid = this.blockState.getMaterial().isLiquid() || !this.blockState.getFluidState().isEmpty(); - #else - this.isLiquid = !this.blockState.getFluidState().isEmpty(); - #endif + #if MC_VER <= MC_1_12_2 + this.isLiquid = this.blockState.getMaterial().isLiquid() || this.blockState.getBlock() instanceof IFluidBlock; + #elif MC_VER < MC_1_20_1 + this.isLiquid = this.blockState.getMaterial().isLiquid() || !this.blockState.getFluidState().isEmpty(); + #else + this.isLiquid = !this.blockState.getFluidState().isEmpty(); + #endif } } @@ -349,7 +374,7 @@ public class BlockStateWrapper implements IBlockStateWrapper // beacon tint color Color beaconTintColor = null; - // 1.12.2 doesn't have block for beacon beam + // 1.12.2 doesn't support changing the beacon beam color #if MC_VER > MC_1_12_2 if (this.blockState != null // beacon blocks also show up here, but since they block the beacon beam we don't want their color @@ -462,71 +487,188 @@ public class BlockStateWrapper implements IBlockStateWrapper @Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, String lowercaseSerialString, boolean isLiquid - ) + ) { - if (blockState == null) + if (isAir(blockState)) { return EDhApiBlockMaterial.AIR; } - if (#if MC_VER <= MC_1_12_2 blockState.getBlock() instanceof BlockLeaves #else blockState.is(BlockTags.LEAVES) #endif + + //========// + // leaves // + //========// + //region + + boolean isLeafBlock; + #if MC_VER <= MC_1_12_2 + isLeafBlock = blockState.getBlock() instanceof BlockLeaves; + #else + isLeafBlock = blockState.is(BlockTags.LEAVES); + #endif + if (isLeafBlock || lowercaseSerialString.contains("bamboo") || lowercaseSerialString.contains("cactus") || lowercaseSerialString.contains("chorus_flower") || lowercaseSerialString.contains("mushroom") - ) + ) { return EDhApiBlockMaterial.LEAVES; } - else if (#if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.LAVA || blockState.getBlock() == Blocks.FLOWING_LAVA #else blockState.is(Blocks.LAVA) #endif) + //endregion + + + + //======// + // lava // + //======// + //region + + boolean isLavaBlock; + #if MC_VER <= MC_1_12_2 + isLavaBlock = blockState.getBlock() == Blocks.LAVA || blockState.getBlock() == Blocks.FLOWING_LAVA; + #else + isLavaBlock = blockState.is(Blocks.LAVA); + #endif + if (isLavaBlock) { return EDhApiBlockMaterial.LAVA; } - else if (isLiquid || #if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.WATER || blockState.getBlock() == Blocks.FLOWING_WATER #else blockState.is(Blocks.WATER) #endif) + + //endregion + + + + //=======// + // water // + //=======// + //region + + boolean isWaterBlock; + #if MC_VER <= MC_1_12_2 + isWaterBlock = blockState.getBlock() == Blocks.WATER || blockState.getBlock() == Blocks.FLOWING_WATER; + #else + isWaterBlock = blockState.is(Blocks.WATER); + #endif + if (isLiquid + || isWaterBlock) { return EDhApiBlockMaterial.WATER; } - else if (#if MC_VER <= MC_1_12_2 blockState.getBlock().getSoundType() #else blockState.getSoundType() #endif == SoundType.WOOD + + //endregion + + + + //======// + // wood // + //======// + //region + + boolean isWoodSoundingBlock; + #if MC_VER <= MC_1_12_2 + isWoodSoundingBlock = blockState.getBlock().getSoundType() == SoundType.WOOD; + #else + isWoodSoundingBlock = blockState.getSoundType() == SoundType.WOOD; + #endif + + boolean isCherryWood; + #if MC_VER <= MC_1_19_2 + isCherryWood = false; + #else + isWoodSoundingBlock = blockState.getSoundType() == SoundType.CHERRY_WOOD; + #endif + + if (isWoodSoundingBlock || lowercaseSerialString.contains("root") - #if MC_VER >= MC_1_19_4 - || blockState.getSoundType() == SoundType.CHERRY_WOOD - #endif - ) + || isCherryWood + ) { return EDhApiBlockMaterial.WOOD; } - else if (#if MC_VER <= MC_1_12_2 blockState.getBlock().getSoundType() #else blockState.getSoundType() #endif == SoundType.METAL - #if MC_VER >= MC_1_19_2 - || blockState.getSoundType() == SoundType.COPPER - #endif - #if MC_VER >= MC_1_20_4 - || blockState.getSoundType() == SoundType.COPPER_BULB - || blockState.getSoundType() == SoundType.COPPER_GRATE - #endif - ) + + //endregion + + + + //=======// + // metal // + //=======// + //region + + boolean isMetalSoundingBlock; + #if MC_VER <= MC_1_12_2 + isMetalSoundingBlock = blockState.getBlock().getSoundType() == SoundType.METAL; + #else + isMetalSoundingBlock = blockState.getSoundType() == SoundType.METAL; + #endif + + boolean isCopperSounding; + #if MC_VER <= MC_1_18_2 + isCopperSounding = false; + #elif MC_VER <= MC_1_20_2 + isCopperSounding = blockState.getSoundType() == SoundType.COPPER + #else + isCopperSounding + = blockState.getSoundType() == SoundType.COPPER + || blockState.getSoundType() == SoundType.COPPER_BULB + || blockState.getSoundType() == SoundType.COPPER_GRATE; + #endif + + if (isMetalSoundingBlock + || isCopperSounding) { return EDhApiBlockMaterial.METAL; } - else if ( - lowercaseSerialString.contains("grass_block") - || lowercaseSerialString.contains("grass_slab") - ) + + //endregion + + + + //=======// + // grass // + //=======// + //region + + if (lowercaseSerialString.contains("grass_block") + || lowercaseSerialString.contains("grass_slab") + ) { return EDhApiBlockMaterial.GRASS; } - else if ( + + //endregion + + + + //======// + // dirt // + //======// + //region + + if ( lowercaseSerialString.contains("dirt") - || lowercaseSerialString.contains("gravel") - || lowercaseSerialString.contains("mud") - || lowercaseSerialString.contains("podzol") - || lowercaseSerialString.contains("mycelium") - ) + || lowercaseSerialString.contains("gravel") + || lowercaseSerialString.contains("mud") + || lowercaseSerialString.contains("podzol") + || lowercaseSerialString.contains("mycelium") + ) { return EDhApiBlockMaterial.DIRT; } + + //endregion + + + + //===========// + // deepslate // + //===========// + //region + #if MC_VER >= MC_1_17_1 - else if (blockState.getSoundType() == SoundType.DEEPSLATE + if (blockState.getSoundType() == SoundType.DEEPSLATE || blockState.getSoundType() == SoundType.DEEPSLATE_BRICKS || blockState.getSoundType() == SoundType.DEEPSLATE_TILES || blockState.getSoundType() == SoundType.POLISHED_DEEPSLATE @@ -535,35 +677,68 @@ public class BlockStateWrapper implements IBlockStateWrapper return EDhApiBlockMaterial.DEEPSLATE; } #endif - else if (lowercaseSerialString.contains("snow")) - { - return EDhApiBlockMaterial.SNOW; - } - else if (lowercaseSerialString.contains("sand")) - { - return EDhApiBlockMaterial.SAND; - } - else if (lowercaseSerialString.contains("terracotta")) - { - return EDhApiBlockMaterial.TERRACOTTA; - } - else if (#if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.NETHERRACK #else blockState.is(BlockTags.BASE_STONE_NETHER) #endif) + + //endregion + + + + //============// + // netherrack // + //============// + //region + + boolean isNetherRack; + #if MC_VER <= MC_1_12_2 + isNetherRack = blockState.getBlock() == Blocks.NETHERRACK; + #else + isNetherRack = blockState.is(BlockTags.BASE_STONE_NETHER); + #endif + + if (isNetherRack) { return EDhApiBlockMaterial.NETHER_STONE; } - else if (lowercaseSerialString.contains("stone") + + //endregion + + + + //=============// + // misc/simple // + //=============// + //region + + if (lowercaseSerialString.contains("snow")) + { + return EDhApiBlockMaterial.SNOW; + } + + if (lowercaseSerialString.contains("sand")) + { + return EDhApiBlockMaterial.SAND; + } + + if (lowercaseSerialString.contains("terracotta")) + { + return EDhApiBlockMaterial.TERRACOTTA; + } + + if (lowercaseSerialString.contains("stone") || lowercaseSerialString.contains("ore")) { return EDhApiBlockMaterial.STONE; } - else if (#if MC_VER <= MC_1_12_2 blockState.getLightValue() #else blockState.getLightEmission() #endif > 0) + + if (getLightEmission(blockState) > 0) { return EDhApiBlockMaterial.ILLUMINATED; } - else - { - return EDhApiBlockMaterial.UNKNOWN; - } + + //endregion + + + + return EDhApiBlockMaterial.UNKNOWN; } private static int calculateOpacity( @@ -691,8 +866,10 @@ public class BlockStateWrapper implements IBlockStateWrapper return waterSurfaceReplacementBlocks; } - ObjectOpenHashSet baseIgnoredBlock = new ObjectOpenHashSet<>(); - waterSurfaceReplacementBlocks = getAllBlockWrappers(Config.Client.Advanced.Graphics.Culling.waterSurfaceBlockReplacementCsv, baseIgnoredBlock, levelWrapper); + ObjectOpenHashSet baseIgnoredBlockResourceSet = new ObjectOpenHashSet<>(); + waterSurfaceReplacementBlocks = getAllBlockWrappers(Config.Client.Advanced.Graphics.Culling.waterSurfaceBlockReplacementCsv, baseIgnoredBlockResourceSet, levelWrapper); + waterSubsurfaceReplacementBlocks.remove(AIR); + return waterSurfaceReplacementBlocks; } public static ObjectOpenHashSet getWaterSubsurfaceReplacementBlocks(ILevelWrapper levelWrapper) @@ -703,8 +880,10 @@ public class BlockStateWrapper implements IBlockStateWrapper return waterSubsurfaceReplacementBlocks; } - ObjectOpenHashSet baseIgnoredBlock = new ObjectOpenHashSet<>(); - waterSubsurfaceReplacementBlocks = getAllBlockWrappers(Config.Client.Advanced.Graphics.Culling.waterSubSurfaceBlockReplacementCsv, baseIgnoredBlock, levelWrapper); + ObjectOpenHashSet baseIgnoredBlockResourceSet = new ObjectOpenHashSet<>(); + waterSubsurfaceReplacementBlocks = getAllBlockWrappers(Config.Client.Advanced.Graphics.Culling.waterSubSurfaceBlockReplacementCsv, baseIgnoredBlockResourceSet, levelWrapper); + // air will be present if any invalid resource locations are present + // but we don't want to replace air with water, that'll cause monoliths waterSubsurfaceReplacementBlocks.remove(AIR); return waterSubsurfaceReplacementBlocks; @@ -826,7 +1005,21 @@ public class BlockStateWrapper implements IBlockStateWrapper public int getOpacity() { return this.opacity; } @Override - public int getLightEmission() { return (this.blockState != null) ? #if MC_VER <= MC_1_12_2 this.blockState.getLightValue() #else this.blockState.getLightEmission() #endif : 0; } + public int getLightEmission() { return getLightEmission(this.blockState); } + public static int getLightEmission(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState) + { + if (blockState == null) + { + return 0; + } + + #if MC_VER <= MC_1_12_2 + return blockState.getLightValue(); + #else + return blockState.getLightEmission(); + #endif + } + @Override public String getSerialString() { return this.serialString; } @@ -836,7 +1029,19 @@ public class BlockStateWrapper implements IBlockStateWrapper @Override public boolean isAir() { return isAir(this.blockState); } - public static boolean isAir(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState) { return blockState == null || #if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.AIR #else blockState.isAir() #endif; } + public static boolean isAir(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState) + { + if (blockState == null) + { + return true; + } + + #if MC_VER <= MC_1_12_2 + return blockState.getBlock() == Blocks.AIR; + #else + return blockState.isAir(); + #endif + } @Override public boolean isSolid() { return this.isSolid; } @@ -1056,7 +1261,12 @@ public class BlockStateWrapper implements IBlockStateWrapper } } - foundState = #if MC_VER <= MC_1_12_2 block.getDefaultState() #else block.defaultBlockState() #endif; + + #if MC_VER <= MC_1_12_2 + foundState = block.getDefaultState(); + #else + foundState = block.defaultBlockState(); + #endif } foundWrapper = fromBlockState(foundState, levelWrapper); @@ -1086,12 +1296,13 @@ public class BlockStateWrapper implements IBlockStateWrapper // get the property list for this block (doesn't contain this block state's values, just the names and possible values) #if MC_VER <= MC_1_12_2 java.util.Collection> blockPropertyCollection = blockState.getPropertyKeys(); + List> sortedBlockPropteryList = new ArrayList<>(blockPropertyCollection); #else java.util.Collection> blockPropertyCollection = blockState.getProperties();; + List> sortedBlockPropteryList = new ArrayList<>(blockPropertyCollection); #endif // alphabetically sort the list so they are always in the same order - List<#if MC_VER <= MC_1_12_2 IProperty #else net.minecraft.world.level.block.state.properties.Property #endif> sortedBlockPropteryList = new ArrayList<>(blockPropertyCollection); sortedBlockPropteryList.sort((a, b) -> a.getName().compareTo(b.getName())); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/ClientBlockStateColorCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/ClientBlockStateColorCache.java index d6114790a..9514bc0bb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/ClientBlockStateColorCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/ClientBlockStateColorCache.java @@ -94,7 +94,11 @@ public class ClientBlockStateColorCache private static final Minecraft MC = Minecraft.#if MC_VER <= MC_1_12_2 getMinecraft() #else getInstance() #endif; - private static final HashSet<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif> BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>(); + #if MC_VER <= MC_1_12_2 + #else + private static final HashSet BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>(); + #endif + private static final HashSet<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif> BROKEN_BLOCK_STATES = new HashSet<>(); /** @@ -107,6 +111,8 @@ public class ClientBlockStateColorCache */ private static final ReentrantLock RESOLVE_LOCK = new ReentrantLock(); + public static final int INVALID_COLOR = -1; + /** This is the order each direction on a block is processed when attempting to get the texture/color */ private static final @Nullable #if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif[] COLOR_RESOLUTION_DIRECTION_ORDER = @@ -225,7 +231,9 @@ public class ClientBlockStateColorCache //=============// //region - public ClientBlockStateColorCache(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, IClientLevelWrapper clientLevelWrapper) + public ClientBlockStateColorCache( + #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, + IClientLevelWrapper clientLevelWrapper) { this.blockState = blockState; this.blockStateWrapper = BlockStateWrapper.fromBlockState(blockState, clientLevelWrapper); @@ -241,6 +249,7 @@ public class ClientBlockStateColorCache //===================// // color calculation // //===================// + //region private void resolveColors() { @@ -268,11 +277,7 @@ public class ClientBlockStateColorCache } #endif - #if MC_VER <= MC_1_12_2 - if (!this.blockState.getMaterial().isLiquid()) - #else - if (this.blockState.getFluidState().isEmpty()) - #endif + if (!this.blockStateWrapper.isLiquid()) { // look for the first non-empty direction List quads = null; @@ -593,6 +598,8 @@ public class ClientBlockStateColorCache EColorMode.getColorMode(this.blockState.getBlock())); } + //endregion + //===============// @@ -602,11 +609,7 @@ public class ClientBlockStateColorCache public int getColor(BiomeWrapper biomeWrapper, FullDataSourceV2 fullDataSource, DhBlockPos blockPos) { // only get the tint if the block needs to be tinted - #if MC_VER <= MC_1_12_2 - int tintColor = -1; - #else - int tintColor = AbstractDhTintGetter.INVALID_COLOR; - #endif + int tintColor = INVALID_COLOR; if (this.needPostTinting) { @@ -624,8 +627,10 @@ public class ClientBlockStateColorCache // 1.12.2 doesn't have BlockAndTintGetter -> get tintColor from biome WorldClient world = (WorldClient) this.clientLevelWrapper.getWrappedMcObject(); BlockPos mcPos = new BlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ()); + Block block = this.blockState.getBlock(); - if (block instanceof BlockGrass || block instanceof BlockBush) + if (block instanceof BlockGrass + || block instanceof BlockBush) { tintColor = biomeWrapper.biome.getGrassColorAtPos(mcPos); } @@ -635,7 +640,8 @@ public class ClientBlockStateColorCache } else if (block instanceof BlockLiquid) // We don't want lava to fall into the else block { - if(block == Blocks.WATER || block == Blocks.FLOWING_WATER) + if(block == Blocks.WATER + || block == Blocks.FLOWING_WATER) { tintColor = biomeWrapper.biome.getWaterColor(); } @@ -721,29 +727,32 @@ public class ClientBlockStateColorCache } } #endif - // level-specific logic is only needed for MC 1.21.11 and older - #if MC_VER <= MC_1_21_11 && MC_VER > MC_1_12_2 - // use the level logic only if requested - if (BLOCK_STATES_THAT_NEED_LEVEL.contains(this.blockState)) - { - // the level shouldn't be used all the time due to it breaking some blocks tinting - // specifically oceans don't render correctly - TintGetterOverride tintOverride = TintOverrideGetter.get(); - tintOverride.update(biomeWrapper, this.blockStateWrapper, fullDataSource, this.clientLevelWrapper); - tintColor = tintOverride.tryGetBlockTint(new DhBlockPosMutable(blockPos)); - if (tintColor == AbstractDhTintGetter.INVALID_COLOR) + // level-specific logic is only needed for MC 1.21.11 and older + #if MC_VER <= MC_1_21_11 && MC_VER > MC_1_12_2 + // use the level logic only if requested + if (BLOCK_STATES_THAT_NEED_LEVEL.contains(this.blockState)) { - tintColor = Minecraft.getInstance() - .getBlockColors() - .getColor(this.blockState, - tintOverride, - McObjectConverter.Convert(blockPos), - this.tintIndex); + // the level shouldn't be used all the time due to it breaking some blocks tinting + // specifically oceans don't render correctly + + TintGetterOverride tintOverride = TintOverrideGetter.get(); + tintOverride.update(biomeWrapper, this.blockStateWrapper, fullDataSource, this.clientLevelWrapper); + + tintColor = tintOverride.tryGetBlockTint(new DhBlockPosMutable(blockPos)); + if (tintColor == AbstractDhTintGetter.INVALID_COLOR) + { + tintColor = Minecraft.getInstance() + .getBlockColors() + .getColor(this.blockState, + tintOverride, + McObjectConverter.Convert(blockPos), + this.tintIndex); + } } - } - #endif + #endif + } catch (Exception e) { @@ -758,11 +767,7 @@ public class ClientBlockStateColorCache int returnColor; - #if MC_VER <= MC_1_12_2 - if (tintColor != -1) - #else - if (tintColor != AbstractDhTintGetter.INVALID_COLOR) - #endif + if (tintColor != INVALID_COLOR) { returnColor = ColorUtil.multiplyARGBwithRGB(this.baseColor, tintColor); } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GetConfigScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GetConfigScreen.java index 9e57db5a7..6b86db0b1 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GetConfigScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GetConfigScreen.java @@ -15,7 +15,11 @@ public class GetConfigScreen { protected static final DhLogger LOGGER = new DhLoggerBuilder().build(); - public static #if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif getScreen(#if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent) + #if MC_VER <= MC_1_12_2 + public static GuiScreen getScreen(GuiScreen parent) + #else + public static Screen getScreen(Screen parent) + #endif { if (ModInfo.IS_DEV_BUILD) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index faffcc0dd..52a334b9d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -34,7 +34,11 @@ import java.util.*; public class MinecraftScreen { - public static #if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif getScreen(#if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent, AbstractScreen screen, String translationName) + #if MC_VER <= MC_1_12_2 + public static GuiScreen getScreen(GuiScreen parent, AbstractScreen screen, String translationName) + #else + public static Screen getScreen(Screen parent, AbstractScreen screen, String translationName) + #endif { return new ConfigScreenRenderer(parent, screen, translationName); } @@ -56,7 +60,9 @@ public class MinecraftScreen { return net.minecraft.network.chat.Component.translatable(str, args); } #endif - protected ConfigScreenRenderer(#if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent, AbstractScreen screen, String translationName) + protected ConfigScreenRenderer( + #if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent, + AbstractScreen screen, String translationName) { super(translate(translationName)); #if MC_VER <= MC_1_12_2 @@ -77,7 +83,13 @@ public class MinecraftScreen protected void init() #endif { - super.#if MC_VER <= MC_1_12_2 initGui(); #else init(); #endif // Init Minecraft's screen + #if MC_VER <= MC_1_12_2 + super.initGui(); + #else + super.init(); + #endif + + #if MC_VER <= MC_1_12_2 this.screen.width = Display.getWidth(); this.screen.height = Display.getHeight(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/OnPressed.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/OnPressed.java index 41bc58650..3227ab477 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/OnPressed.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/OnPressed.java @@ -1,4 +1,5 @@ package com.seibel.distanthorizons.common.wrappers.gui; + #if MC_VER <= MC_1_12_2 import net.minecraft.client.gui.GuiButton; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java index 11f1173b5..cdfaa5cc8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java @@ -85,7 +85,8 @@ public class ClientLevelWrapper implements IClientLevelWrapper private final ConcurrentHashMap<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif, ClientBlockStateColorCache> blockColorCacheByBlockState = new ConcurrentHashMap<>(); /** cached method reference to reduce GC overhead */ - private final Function<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif, ClientBlockStateColorCache> createCachedBlockColorCacheFunc = (blockState) -> new ClientBlockStateColorCache(blockState, this); + private final Function<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif, ClientBlockStateColorCache> createCachedBlockColorCacheFunc + = (blockState) -> new ClientBlockStateColorCache(blockState, this); private boolean cloudColorFailLogged = false; diff --git a/gradle.properties b/gradle.properties index 1287140ff..38f2d23ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -48,7 +48,7 @@ versionStr= # This defines what MC version Intellij will use for the preprocessor # and what version is used automatically by build and run commands -mcVer=26.1.2 +mcVer=1.12.2 # Defines the maximum amount of memory Minecraft is allowed when run in a development environment minecraftMemoryJavaArg=-Xmx6G diff --git a/versionProperties/1.12.2.properties b/versionProperties/1.12.2.properties index 46a1d6323..48ab26d05 100644 --- a/versionProperties/1.12.2.properties +++ b/versionProperties/1.12.2.properties @@ -8,7 +8,7 @@ builds_for=cleanroom embed_joml=true # Netty -netty_version=4.2.9.Final +netty_version=4.1.9.Final # LWJGL lwjgl_version=3.3.6