Compare commits

...

15 Commits

Author SHA1 Message Date
James Seibel 5138af0b78 up version number 2.3.7 -> 2.4.0 2025-12-13 10:20:17 -06:00
James Seibel 37e99cd0a5 Fix infinite loop in DhSectionPos 2025-12-13 09:10:17 -06:00
James Seibel 6cb8cd2bd9 fix missing localization 2025-12-12 07:45:54 -06:00
James Seibel c5ae7da96c add mod menu and neo iris support 2025-12-11 21:37:08 -06:00
James Seibel 59b886c5e3 API cleanup 2025-12-11 07:35:47 -06:00
James Seibel 01e78f249f auto disable clouds/chunk fading and fix sodium crash 2025-12-10 18:51:13 -06:00
James Seibel e1c3da59db Fix pre MC 1.21.11 compiling 2025-12-10 07:28:39 -06:00
James Seibel cdfb46b041 Allow world gen limits on singleplayer 2025-12-10 07:09:44 -06:00
James Seibel f944fe4409 change the default issue template 2025-12-09 21:15:20 -06:00
James Seibel c2e45f3d65 add support for MC 1.21.11 2025-12-09 21:15:09 -06:00
James Seibel a9c4f3ea46 revert long windows filepath char 2025-12-09 07:21:45 -06:00
James Seibel 204d48517b Merge branch 'batchGenRefactor' 2025-12-09 07:16:32 -06:00
James Seibel 8d2b5fa3ce fix unit tests and enable long config file paths 2025-12-06 12:28:35 -06:00
James Seibel 2851b2c2db Merge branch 'batchGenRefactor' 2025-12-06 12:19:26 -06:00
James Seibel c518345bcd enable long file paths on windows for the DB 2025-12-02 07:08:27 -06:00
63 changed files with 703 additions and 324 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ build:
parallel:
matrix:
- MC_VER: [
"1.21.10", "1.21.9", "1.21.8", "1.21.6", "1.21.5", "1.21.4", "1.21.3", "1.21.1",
"1.21.11", "1.21.10", "1.21.9", "1.21.8", "1.21.6", "1.21.5", "1.21.4", "1.21.3", "1.21.1",
"1.20.6", "1.20.4", "1.20.2", "1.20.1",
"1.19.4", "1.19.2",
"1.18.2",
+36 -2
View File
@@ -1,3 +1,37 @@
Before creating an issue, please select the appropriate template from the dropdown above.
## Check off each item in this list before submitting:
<!--
To mark a section as complete either put an "x" in between the square brackets, example: "[x]"
Or click the checkbox once the issue has been created.
-->
1. [ ] Check the FAQ to see if your issue has already been reported and has a solution:
[Problems-and-solutions](https://gitlab.com/distant-horizons-team/distant-horizons/-/wikis/1-user-guide/1-frequently-asked-questions/2-problems-and-solutions/Problems-and-Solutions)
2. [ ] Make sure you are not using any mods on the incompatible list:
[Mod support FAQ](https://gitlab.com/distant-horizons-team/distant-horizons/-/wikis/1-user-guide/1-frequently-asked-questions/4-mod-support/Mod-Support)
3. [ ] Check the existing issues to verify that your bug hasn't already been submitted:
[Issues](https://gitlab.com/distant-horizons-team/distant-horizons/-/issues)
4. [ ] Upload Minecraft's crash report and/or log. \
Minecraft crash reports are located in: `.minecraft/crash-reports` \
Minecraft logs are located in: `.minecraft/logs`
5. [ ] Upload your Distant Horizons Config. \
The config is found in: `.minecraft/configs/DistantHorizons.toml`
6. [ ] Fill out the information below:
* **minecraft version**:
* **Distant Horizons version**:
* **Mod loader**:
* **Installed mods (list the smallest number of mods that you can use to re-create the bug)**:
* **Describe the bug**:
* **Steps to reproduce the bug**:
The template will walk you through submitting a bug, feature, or improvement request.
+1 -1
View File
@@ -19,7 +19,7 @@ plugins {
id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha"
// Architectury is used here only as a replacement for forge's own loom
id "dev.architectury.loom" version "1.11-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.13-SNAPSHOT" apply false
}
@@ -116,7 +116,7 @@ public abstract class AbstractModInitializer
LOGGER.info(ModInfo.READABLE_NAME + " server Initialized, adding event subscribers...");
this.commandInitializer = new CommandInitializer();
this.subscribeRegisterCommandsEvent(dispatcher -> { commandInitializer.initCommands(dispatcher); });
this.subscribeRegisterCommandsEvent(dispatcher -> { this.commandInitializer.initCommands(dispatcher); });
this.subscribeServerStartingEvent(server ->
{
@@ -13,9 +13,14 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapp
import com.seibel.distanthorizons.coreapi.ModInfo;
import io.netty.buffer.ByteBufUtil;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#else
import net.minecraft.resources.Identifier;
#endif
import java.io.IOException;
import java.util.Objects;
@@ -25,10 +30,12 @@ public abstract class AbstractPluginPacketSender implements IPluginPacketSender
.fileLevelConfig(Config.Common.Logging.logNetworkEventToFile)
.build();
#if MC_VER >= MC_1_21_1
#if MC_VER <= MC_1_20_6
public static final ResourceLocation WRAPPER_PACKET_RESOURCE = new ResourceLocation(ModInfo.RESOURCE_NAMESPACE, ModInfo.WRAPPER_PACKET_PATH);
#elif MC_VER <= MC_1_21_10
public static final ResourceLocation WRAPPER_PACKET_RESOURCE = ResourceLocation.fromNamespaceAndPath(ModInfo.RESOURCE_NAMESPACE, ModInfo.WRAPPER_PACKET_PATH);
#else
public static final ResourceLocation WRAPPER_PACKET_RESOURCE = new ResourceLocation(ModInfo.RESOURCE_NAMESPACE, ModInfo.WRAPPER_PACKET_PATH);
public static final Identifier WRAPPER_PACKET_RESOURCE = Identifier.fromNamespaceAndPath(ModInfo.RESOURCE_NAMESPACE, ModInfo.WRAPPER_PACKET_PATH);
#endif
// "Forge byte" is an unused packet ID. We have our own system which works with all mod loaders,
@@ -8,13 +8,23 @@ import org.jetbrains.annotations.Nullable;
import static com.seibel.distanthorizons.core.network.messages.MessageRegistry.DEBUG_CODEC_CRASH_MESSAGE;
import static net.minecraft.commands.Commands.literal;
/**
* Initializes commands of the mod.
*/
#if MC_VER <= MC_1_21_10
#else
import net.minecraft.server.permissions.PermissionCheck;
import net.minecraft.server.permissions.Permissions;
#endif
public class CommandInitializer
{
private boolean serverReady = false;
#if MC_VER <= MC_1_21_10
private static final int REQUIRED_PERMISSION_LEVEL = 4;
#else
private static final PermissionCheck COMMAND_PERMISSION_CHECK = new PermissionCheck.Require(Permissions.COMMANDS_OWNER);
#endif
/**
* A received command dispatcher, which is held until the server is ready to initialize the commands.
*/
@@ -50,7 +60,14 @@ public class CommandInitializer
}
LiteralArgumentBuilder<CommandSourceStack> builder = literal("dh")
.requires(source -> source.hasPermission(4));
.requires((source) ->
{
#if MC_VER <= MC_1_21_10
return source.hasPermission(REQUIRED_PERMISSION_LEVEL);
#else
return COMMAND_PERMISSION_CHECK.check(source.permissions());
#endif
});
builder.then(new ConfigCommand().buildCommand());
builder.then(new DebugCommand().buildCommand());
@@ -83,6 +83,8 @@ public class VersionConstants implements IVersionConstants
return "1.21.9";
#elif MC_VER == MC_1_21_10
return "1.21.10";
#elif MC_VER == MC_1_21_11
return "1.21.11";
#else
ERROR MC version constant missing
#endif
@@ -29,7 +29,6 @@ import java.util.concurrent.ConcurrentMap;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
import net.minecraft.world.level.Level;
import org.apache.logging.log4j.LogManager;
import com.seibel.distanthorizons.core.logging.DhLogger;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
@@ -46,7 +45,12 @@ import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
#endif
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#else
import net.minecraft.resources.Identifier;
#endif
import net.minecraft.world.level.biome.Biome;
#if MC_VER >= MC_1_18_2
@@ -217,7 +221,12 @@ public class BiomeWrapper implements IBiomeWrapper
Level level = (Level)levelWrapper.getWrappedMcObject();
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
#if MC_VER < MC_1_21_11
ResourceLocation resourceLocation;
#else
Identifier resourceLocation;
#endif
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome);
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
@@ -324,13 +333,19 @@ public class BiomeWrapper implements IBiomeWrapper
throw new IOException("Unable to parse resource location string: [" + resourceLocationString + "].");
}
#if MC_VER < MC_1_21_11
ResourceLocation resourceLocation;
#else
Identifier resourceLocation;
#endif
try
{
#if MC_VER < MC_1_21_1
#if MC_VER <= MC_1_20_6
resourceLocation = new ResourceLocation(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1));
#else
#elif MC_VER <= MC_1_21_10
resourceLocation = ResourceLocation.fromNamespaceAndPath(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1));
#else
resourceLocation = Identifier.fromNamespaceAndPath(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1));
#endif
}
catch (Exception e)
@@ -28,7 +28,6 @@ import com.seibel.distanthorizons.core.util.LodUtil;
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.BeaconBeamBlock;
import net.minecraft.world.level.block.Block;
@@ -63,6 +62,12 @@ import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.core.Holder;
#endif
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#else
import net.minecraft.resources.Identifier;
#endif
public class BlockStateWrapper implements IBlockStateWrapper
{
/** example "minecraft:water" */
@@ -87,7 +92,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
public static HashSet<IBlockStateWrapper> rendererIgnoredCaveBlocks = null;
/** keep track of broken blocks so we don't log every time */
#if MC_VER <= MC_1_21_10
private static final HashSet<ResourceLocation> BROKEN_RESOURCE_LOCATIONS = new HashSet<>();
#else
private static final HashSet<Identifier> BROKEN_RESOURCE_LOCATIONS = new HashSet<>();
#endif
@@ -555,7 +564,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
#endif
#if MC_VER < MC_1_21_11
ResourceLocation resourceLocation;
#else
Identifier resourceLocation;
#endif
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
resourceLocation = Registry.BLOCK.getKey(this.blockState.getBlock());
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
@@ -622,13 +636,20 @@ public class BlockStateWrapper implements IBlockStateWrapper
throw new IOException("Unable to parse Resource Location out of string: [" + resourceStateString + "].");
}
#if MC_VER < MC_1_21_11
ResourceLocation resourceLocation;
#else
Identifier resourceLocation;
#endif
try
{
#if MC_VER < MC_1_21_1
resourceLocation = new ResourceLocation(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1));
#else
#elif MC_VER <= MC_1_21_10
resourceLocation = ResourceLocation.fromNamespaceAndPath(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1));
#else
resourceLocation = Identifier.fromNamespaceAndPath(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1));
#endif
}
catch (Exception e)
@@ -37,7 +37,6 @@ import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import com.seibel.distanthorizons.core.logging.DhLogger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -54,6 +53,12 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.narration.NarratableEntry;
#endif
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#else
import net.minecraft.resources.Identifier;
#endif
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.*;
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.Translatable;
@@ -180,8 +185,10 @@ public class ClassicConfigGUI
0,
#if MC_VER < MC_1_21_1
new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"),
#else
#elif MC_VER <= MC_1_21_10
ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/changelog.png"),
#else
Identifier.fromNamespaceAndPath(ModInfo.ID, "textures/gui/changelog.png"),
#endif
20, 20,
// Create the button and tell it where to go
@@ -14,9 +14,13 @@ import java.util.List;
import net.minecraft.client.gui.components.debug.DebugScreenDisplayer;
import net.minecraft.client.gui.components.debug.DebugScreenEntries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.chunk.LevelChunk;
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#endif
#endif
#if MC_VER < MC_1_21_9
@@ -31,7 +35,12 @@ public class DhDebugScreenEntry implements net.minecraft.client.gui.components.d
// This method is private, so its access will need to be widened
DebugScreenEntries.register(
// The id, this will be displayed on the options screen
#if MC_VER <= MC_1_21_10
ResourceLocation.fromNamespaceAndPath(ModInfo.RESOURCE_NAMESPACE, "distant_horizons"),
#else
"distant_horizons",
#endif
// The screen entry
new DhDebugScreenEntry()
);
@@ -95,10 +95,22 @@ public class MinecraftScreen
super.render(matrices, mouseX, mouseY, delta); // Render the vanilla stuff (currently only used for the background and tint)
}
#if MC_VER <= MC_1_21_10
@Override
public void resize(Minecraft mc, int width, int height)
#else
@Override
public void resize(int width, int height)
#endif
{
super.resize(mc, width, height); // Resize Minecraft's screen
// Resize Minecraft's screen
#if MC_VER <= MC_1_21_10
super.resize(mc, width, height);
#else
super.resize(width, height);
#endif
Window mcWindow = this.minecraft.getWindow();
this.screen.width = mcWindow.getWidth();
this.screen.height = mcWindow.getHeight();
@@ -20,7 +20,6 @@
package com.seibel.distanthorizons.common.wrappers.gui;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
#if MC_VER >= MC_1_17_1
import net.minecraft.client.gui.components.Button;
@@ -42,10 +41,19 @@ import net.minecraft.client.gui.GuiGraphics;
#elif MC_VER < MC_1_21_6
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
#else
#elif MC_VER <= MC_1_21_10
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderPipelines;
#else
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderPipelines;
#endif
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#else
import net.minecraft.resources.Identifier;
#endif
/**
@@ -67,18 +75,33 @@ public class TexturedButtonWidget extends Button
private final int v;
private final int hoveredVOffset;
#if MC_VER <= MC_1_21_10
private final ResourceLocation textureResourceLocation;
#else
private final Identifier textureResourceLocation;
#endif
private final int textureWidth;
private final int textureHeight;
#endif
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation textureResourceLocation, int textureWidth, int textureHeight, OnPress pressAction, Component text)
public TexturedButtonWidget(
int x, int y, int width, int height, int u, int v, int hoveredVOffset,
#if MC_VER <= MC_1_21_10 ResourceLocation textureResourceLocation,
#else Identifier textureResourceLocation,
#endif
int textureWidth, int textureHeight, OnPress pressAction, Component text)
{
this(x, y, width, height, u, v, hoveredVOffset, textureResourceLocation, textureWidth, textureHeight, pressAction, text, true);
}
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation textureResourceLocation, int textureWidth, int textureHeight, OnPress pressAction, Component text, boolean renderBackground)
public TexturedButtonWidget(
int x, int y, int width, int height, int u, int v, int hoveredVOffset,
#if MC_VER <= MC_1_21_10 ResourceLocation textureResourceLocation,
#else Identifier textureResourceLocation,
#endif
int textureWidth, int textureHeight, OnPress pressAction, Component text,
boolean renderBackground)
{
#if MC_VER < MC_1_20_2
super(x, y, width, height, u, v, hoveredVOffset, textureResourceLocation, textureWidth, textureHeight, pressAction, text);
@@ -169,8 +192,13 @@ public class TexturedButtonWidget extends Button
#endif
#else
#if MC_VER < MC_1_21_11
@Override
public void renderWidget(GuiGraphics matrices, int mouseX, int mouseY, float delta)
#else
@Override
protected void renderContents(GuiGraphics matrices, int mouseX, int mouseY, float delta)
#endif
{
if (this.renderBackground)
{
@@ -9,14 +9,21 @@ import com.seibel.distanthorizons.coreapi.ModInfo;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter;
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
import com.seibel.distanthorizons.core.logging.DhLogger;
import net.minecraft.client.gui.screens.Screen;
#if MC_VER >= MC_1_20_1
import net.minecraft.client.gui.GuiGraphics;
#else
import com.mojang.blaze3d.vertex.PoseStack;
#endif
import net.minecraft.client.gui.screens.Screen;
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
import com.seibel.distanthorizons.core.logging.DhLogger;
#else
import net.minecraft.resources.Identifier;
#endif
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.*;
@@ -88,10 +95,12 @@ public class UpdateModScreen extends DhScreen
0, 0,
// Some textuary stuff
0,
#if MC_VER < MC_1_21_1
#if MC_VER <= MC_1_20_6
new ResourceLocation(ModInfo.ID, "logo.png"),
#else
#elif MC_VER <= MC_1_21_10
ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "logo.png"),
#else
Identifier.fromNamespaceAndPath(ModInfo.ID, "logo.png"),
#endif
195, 65,
// Create the button and tell it where to go
@@ -121,12 +130,14 @@ public class UpdateModScreen extends DhScreen
0,
#if MC_VER < MC_1_21_1
new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"),
#else
#elif MC_VER <= MC_1_21_10
ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/changelog.png"),
#else
Identifier.fromNamespaceAndPath(ModInfo.ID, "textures/gui/changelog.png"),
#endif
20, 20,
// Create the button and tell it where to go
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(new ChangelogScreen(this, this.newVersionID)), // TODO: Add a proper easter egg to pressing the logo (maybe with confetti)
(buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(new ChangelogScreen(this, this.newVersionID)),
// Add a title to the button
Translatable(ModInfo.ID + ".updater.title")
));
@@ -20,18 +20,8 @@
package com.seibel.distanthorizons.common.wrappers.minecraft;
import java.io.File;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Objects;
import java.util.UUID;
import com.mojang.blaze3d.platform.NativeImage;
import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading;
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.enums.EDhDirection;
import com.seibel.distanthorizons.core.file.structure.ClientOnlySaveStructure;
import com.seibel.distanthorizons.core.render.glObject.GLProxy;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
@@ -40,25 +30,25 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
import com.seibel.distanthorizons.core.pos.DhChunkPos;
import com.seibel.distanthorizons.core.logging.DhLogger;
import net.minecraft.CrashReport;
import net.minecraft.client.CloudStatus;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.ChunkPos;
import org.jetbrains.annotations.Nullable;
#if MC_VER < MC_1_19_2
import net.minecraft.network.chat.TextComponent;
#endif
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.ChunkPos;
import com.seibel.distanthorizons.core.logging.DhLogger;
import org.jetbrains.annotations.Nullable;
#if MC_VER < MC_1_21_3
#else
@@ -78,82 +68,13 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
public static final MinecraftClientWrapper INSTANCE = new MinecraftClientWrapper();
/**
* The lightmap for the current:
* Time, dimension, brightness setting, etc.
*/
private NativeImage lightMap = null;
private ProfilerWrapper profilerWrapper;
private MinecraftClientWrapper()
{
}
//================//
// helper methods //
//================//
/**
* This should be called at the beginning of every frame to
* clear any Minecraft data that becomes out of date after a frame. <br> <br>
* <p>
* LightMaps and other time sensitive objects fall in this category. <br> <br>
* <p>
* This doesn't affect OpenGL objects in any way.
*/
@Override
public void clearFrameObjectCache() { this.lightMap = null; }
//=================//
// method wrappers //
//=================//
@Override
public float getShade(EDhDirection lodDirection)
{
EDhApiLodShading lodShading = Config.Client.Advanced.Graphics.Quality.lodShading.get();
switch (lodShading)
{
default:
case AUTO:
if (MINECRAFT.level != null)
{
Direction mcDir = McObjectConverter.Convert(lodDirection);
return MINECRAFT.level.getShade(mcDir, true);
}
else
{
return 0.0f;
}
case ENABLED:
switch (lodDirection)
{
case DOWN:
return 0.5F;
default:
case UP:
return 1.0F;
case NORTH:
case SOUTH:
return 0.8F;
case WEST:
case EAST:
return 0.6F;
}
case DISABLED:
return 1.0F;
}
}
//======================//
// multiplayer handling //
//======================//
@Override
public boolean hasSinglePlayerServer() { return MINECRAFT.hasSingleplayerServer(); }
@@ -183,7 +104,6 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
return (server != null) ? server.name : "NULL";
}
}
@Override
public String getCurrentServerIp()
{
@@ -197,7 +117,6 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
return (server != null) ? server.ip : "NA";
}
}
@Override
public String getCurrentServerVersion()
{
@@ -205,21 +124,17 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
return (server != null) ? server.version.getString() : "UNKOWN";
}
//=============//
// Simple gets //
//=============//
//=================//
// player handling //
//=================//
public LocalPlayer getPlayer() { return MINECRAFT.player; }
@Override
public boolean playerExists() { return MINECRAFT.player != null; }
@Override
public UUID getPlayerUUID() { return this.getPlayer().getUUID(); }
@Override
public String getUsername() { return MINECRAFT.getUser().getName(); }
@Override
public DhBlockPos getPlayerBlockPos()
{
@@ -250,6 +165,12 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
return new DhChunkPos(playerPos.x, playerPos.z);
}
//================//
// level handling //
//================//
@Nullable
@Override
public IClientLevelWrapper getWrappedClientLevel() { return this.getWrappedClientLevel(false); }
@@ -267,44 +188,11 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
return ClientLevelWrapper.getWrapper(level, bypassLevelKeyManager);
}
@Override
public IProfilerWrapper getProfiler()
{
ProfilerFiller profiler;
#if MC_VER < MC_1_21_3
profiler = MINECRAFT.getProfiler();
#else
profiler = Profiler.get();
#endif
if (this.profilerWrapper == null)
{
this.profilerWrapper = new ProfilerWrapper(profiler);
}
else if (profiler != this.profilerWrapper.profiler)
{
this.profilerWrapper.profiler = profiler;
}
return this.profilerWrapper;
}
/** Returns all worlds available to the server */
@Override
public ArrayList<ILevelWrapper> getAllServerWorlds()
{
ArrayList<ILevelWrapper> worlds = new ArrayList<ILevelWrapper>();
Iterable<ServerLevel> serverWorlds = MINECRAFT.getSingleplayerServer().getAllLevels();
for (ServerLevel world : serverWorlds)
{
worlds.add(ServerLevelWrapper.getWrapper(world));
}
return worlds;
}
//===========//
// messaging //
//===========//
@Override
public void sendChatMessage(String string)
@@ -350,14 +238,58 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
#endif
}
/**
* Crashes Minecraft, displaying the given errorMessage <br> <br>
* In the following format: <br>
*
* The game crashed whilst <strong>errorMessage</strong> <br>
* Error: <strong>ExceptionClass: exceptionErrorMessage</strong> <br>
* Exit Code: -1 <br>
*/
//==========================//
// vanilla option overrides //
//==========================//
public void disableVanillaClouds()
{
#if MC_VER <= MC_1_18_2
MINECRAFT.options.renderClouds = CloudStatus.OFF;
#else
MINECRAFT.options.cloudStatus().set(CloudStatus.OFF);
#endif
}
public void disableVanillaChunkFadeIn()
{
#if MC_VER <= MC_1_21_10
// chunk fade in was added MC 1.21.11
#else
MINECRAFT.options.chunkSectionFadeInTime().set(0.0);
#endif
}
//======//
// misc //
//======//
@Override
public IProfilerWrapper getProfiler()
{
ProfilerFiller profiler;
#if MC_VER < MC_1_21_3
profiler = MINECRAFT.getProfiler();
#else
profiler = Profiler.get();
#endif
if (this.profilerWrapper == null)
{
this.profilerWrapper = new ProfilerWrapper(profiler);
}
else if (profiler != this.profilerWrapper.profiler)
{
this.profilerWrapper.profiler = profiler;
}
return this.profilerWrapper;
}
@Override
public void crashMinecraft(String errorMessage, Throwable exception)
{
@@ -366,22 +298,31 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
#if MC_VER < MC_1_20_4
Minecraft.crash(report);
#else
Minecraft.getInstance().delayCrash(report);
MINECRAFT.delayCrash(report);
#endif
}
//=============//
// mod support //
//=============//
@Override
public Object getOptionsObject() { return MINECRAFT.options; }
//========//
// shared //
//========//
@Override
public boolean isDedicatedServer() { return false; }
@Override
public File getInstallationDirectory() { return MINECRAFT.gameDirectory; }
@Override
public void executeOnRenderThread(Runnable runnable) { MINECRAFT.execute(runnable); }
@Override
public int getPlayerCount()
{
@@ -396,10 +337,6 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
}
}
@Override
public void setPreventAutoPause(boolean preventAutoPause)
{
throw new UnsupportedOperationException();
}
}
@@ -25,9 +25,13 @@ import java.util.concurrent.ConcurrentHashMap;
import com.mojang.blaze3d.pipeline.RenderTarget;
import com.mojang.blaze3d.platform.NativeImage;
import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading;
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
import com.seibel.distanthorizons.core.enums.EDhDirection;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.util.ColorUtil;
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
@@ -52,12 +56,12 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IDimensionTypeWra
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
import com.seibel.distanthorizons.core.util.math.Vec3d;
import com.seibel.distanthorizons.core.util.math.Vec3f;
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.phys.Vec3;
@@ -79,6 +83,11 @@ import com.mojang.blaze3d.opengl.GlTexture;
#else
#endif
#if MC_VER <= MC_1_21_10
#else
import net.minecraft.world.attribute.EnvironmentAttributes;
#endif
/**
* A singleton that contains everything
* related to rendering in Minecraft.
@@ -90,8 +99,6 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
private static final Minecraft MC = Minecraft.getInstance();
private static final IOptifineAccessor OPTIFINE_ACCESSOR = ModAccessorInjector.INSTANCE.get(IOptifineAccessor.class);
/**
* In the case of immersive portals multiple levels may be active at once, causing conflicting lightmaps. <br>
* Requiring the use of multiple {@link LightMapWrapper}.
@@ -121,12 +128,20 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
@Override
public Vec3f getLookAtVector()
{
#if MC_VER <= MC_1_21_10
Camera camera = MC.gameRenderer.getMainCamera();
return new Vec3f(camera.getLookVector().x(), camera.getLookVector().y(), camera.getLookVector().z());
#else
Camera camera = MC.gameRenderer.getMainCamera();
return new Vec3f(camera.forwardVector().x(), camera.forwardVector().y(), camera.forwardVector().z());
#endif
}
/**
* Unless you really need to know if the player is blind,
* use {@link MinecraftRenderWrapper#isFogStateSpecial()} or {@link IMinecraftRenderWrapper#isFogStateSpecial()} instead
*/
@Override
/** Unless you really need to know if the player is blind, use {@link MinecraftRenderWrapper#isFogStateSpecial()}/{@link IMinecraftRenderWrapper#isFogStateSpecial()} instead */
public boolean playerHasBlindingEffect()
{
if (MC.player == null)
@@ -151,7 +166,11 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
public Vec3d getCameraExactPosition()
{
Camera camera = MC.gameRenderer.getMainCamera();
#if MC_VER <= MC_1_21_10
Vec3 projectedView = camera.getPosition();
#else
Vec3 projectedView = camera.position();
#endif
return new Vec3d(projectedView.x, projectedView.y, projectedView.z);
}
@@ -185,8 +204,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
Math.max(0f, Math.min(colorValues.z, 1f)), // b
Math.max(0f, Math.min(colorValues.w, 1f)) // a
);
#else
#elif MC_VER <= MC_1_21_10
if (mcFogRenderer == null)
{
mcFogRenderer = new FogRenderer();
@@ -210,9 +228,33 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
Math.max(0f, Math.min(colorValues.z, 1f)), // b
Math.max(0f, Math.min(colorValues.w, 1f)) // a
);
#else
if (mcFogRenderer == null)
{
mcFogRenderer = new FogRenderer();
}
if (MC.level == null)
{
// shouldn't happen, but just in case
return Color.white;
}
Vector4f colorValues = mcFogRenderer.setupFog(
MC.gameRenderer.getMainCamera(),
MC.options.getEffectiveRenderDistance(),
MC.deltaTracker,
MC.gameRenderer.getDarkenWorldAmount(MC.deltaTracker.getGameTimeDeltaPartialTick(true)),
MC.level);
return new Color(
Math.max(0f, Math.min(colorValues.x, 1f)), // r
Math.max(0f, Math.min(colorValues.y, 1f)), // g
Math.max(0f, Math.min(colorValues.z, 1f)), // b
Math.max(0f, Math.min(colorValues.w, 1f)) // a
);
#endif
}
// getSpecialFogColor() is the same as getFogColor()
@Override
public Color getSkyColor()
@@ -224,8 +266,10 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
frameTime = MC.getFrameTime();
#elif MC_VER < MC_1_21_3
frameTime = MC.getTimer().getRealtimeDeltaTicks();
#else
#elif MC_VER <= MC_1_21_10
frameTime = MC.deltaTracker.getGameTimeDeltaTicks();
#else
frameTime = 0f; // unused
#endif
#if MC_VER < MC_1_17_1
@@ -234,9 +278,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
#elif MC_VER < MC_1_21_3
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), frameTime);
return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z);
#elif MC_VER <= MC_1_21_10
int argbColorInt = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), frameTime);
return ColorUtil.toColorObjARGB(argbColorInt);
#else
int argbColorInt = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), frameTime);;
return ColorUtil.toColorObjARGB(argbColorInt); // TODO MC changed color formats
int argbColor = MC.level.environmentAttributes().getValue(EnvironmentAttributes.SKY_COLOR, BlockPos.ZERO);
return new Color(ColorUtil.getRed(argbColor), ColorUtil.getGreen(argbColor), ColorUtil.getBlue(argbColor), 255 /* ignore alpha since DH clouds don't render correctly with transparency */);
#endif
}
else
@@ -246,10 +293,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
}
@Override
public double getFov(float partialTicks)
{
return MC.gameRenderer.getFov(MC.gameRenderer.getMainCamera(), partialTicks, true);
}
public double getFov(float partialTicks) { return MC.gameRenderer.getFov(MC.gameRenderer.getMainCamera(), partialTicks, true); }
/** Measured in chunks */
@Override
@@ -263,41 +307,6 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
#endif
}
@Override
public int getScreenWidth()
{
// alternate ways of getting the window's resolution,
// using one of these methods may fix the optifine render resolution bug
// TODO: test these once we can run with Optifine again
// int[] heightArray = new int[1];
// int[] widthArray = new int[1];
//
// long window = GLProxy.getInstance().minecraftGlContext;
// GLFW.glfwGetWindowSize(window, widthArray, heightArray); // option 1
// GLFW.glfwGetFramebufferSize(window, widthArray, heightArray); // option 2
int width = MC.getWindow().getWidth();
if (OPTIFINE_ACCESSOR != null)
{
// TODO remove comment after testing:
// this should fix the issue where different optifine render resolutions screw up the LOD rendering
width *= OPTIFINE_ACCESSOR.getRenderResolutionMultiplier();
}
return width;
}
@Override
public int getScreenHeight()
{
int height = MC.getWindow().getHeight();
if (OPTIFINE_ACCESSOR != null)
{
height *= OPTIFINE_ACCESSOR.getRenderResolutionMultiplier();
}
return height;
}
protected RenderTarget getRenderTarget() { return MC.getMainRenderTarget(); }
@Override
@@ -466,4 +475,45 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
wrapper.setLightmapId(tetxureId);
}
@Override
public float getShade(EDhDirection lodDirection)
{
EDhApiLodShading lodShading = Config.Client.Advanced.Graphics.Quality.lodShading.get();
switch (lodShading)
{
default:
case AUTO:
if (MC.level != null)
{
Direction mcDir = McObjectConverter.Convert(lodDirection);
return MC.level.getShade(mcDir, true);
}
else
{
return 0.0f;
}
case ENABLED:
switch (lodDirection)
{
case DOWN:
return 0.5F;
default:
case UP:
return 1.0F;
case NORTH:
case SOUTH:
return 0.8F;
case WEST:
case EAST:
return 0.6F;
}
case DISABLED:
return 1.0F;
}
}
}
@@ -2,16 +2,18 @@ package com.seibel.distanthorizons.common.wrappers.minecraft;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
import net.minecraft.server.dedicated.DedicatedServer;
import org.jetbrains.annotations.Nullable;
import java.io.File;
//@Environment(EnvType.SERVER)
public class MinecraftServerWrapper implements IMinecraftSharedWrapper
{
public static final MinecraftServerWrapper INSTANCE = new MinecraftServerWrapper();
/** set during server startup */
@Nullable
public DedicatedServer dedicatedServer = null;
public boolean preventAutoPause = false;
//=============//
@@ -34,7 +36,7 @@ public class MinecraftServerWrapper implements IMinecraftSharedWrapper
{
if (this.dedicatedServer == null)
{
throw new IllegalStateException("Trying to get Installation Direction before Dedicated server completed initialization!");
throw new IllegalStateException("Trying to get Installation Direction before dedicated server completed initialization!");
}
#if MC_VER < MC_1_21_1
@@ -45,15 +47,16 @@ public class MinecraftServerWrapper implements IMinecraftSharedWrapper
}
@Override
public int getPlayerCount()
public int getPlayerCount()
{
return this.dedicatedServer.getPlayerCount();
if (this.dedicatedServer == null)
{
throw new IllegalStateException("Trying to get player count before dedicated server completed initialization!");
}
return this.dedicatedServer.getPlayerCount();
}
@Override
public void setPreventAutoPause(boolean preventAutoPause)
{
this.preventAutoPause = preventAutoPause;
}
}
@@ -21,6 +21,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IDimensionTypeWra
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
@@ -50,6 +51,12 @@ import net.minecraft.world.phys.Vec3;
import com.seibel.distanthorizons.core.util.ColorUtil;
#endif
#if MC_VER <= MC_1_21_10
#else
import net.minecraft.world.attribute.EnvironmentAttributes;
#endif
public class ClientLevelWrapper implements IClientLevelWrapper
{
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
@@ -92,7 +99,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
* IE rendering.
*/
@Nullable
public static IClientLevelWrapper getWrapperIfDifferent(@Nullable IClientLevelWrapper levelWrapper, @NotNull ClientLevel level)
public static IClientLevelWrapper getWrapperIfDifferent(@Nullable IClientLevelWrapper levelWrapper, @NotNull ClientLevel level) // TODO handle null level
{
if (KEYED_CLIENT_LEVEL_MANAGER.isEnabled() && KEYED_CLIENT_LEVEL_MANAGER.getServerKeyedLevel() != levelWrapper)
{
@@ -237,11 +244,24 @@ public class ClientLevelWrapper implements IClientLevelWrapper
public void clearBlockColorCache() { this.blockColorCacheByBlockState.clear(); }
@Override
public IDimensionTypeWrapper getDimensionType() { return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType()); }
public IDimensionTypeWrapper getDimensionType()
{
#if MC_VER <= MC_1_21_10
return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType());
#else
return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType(), this.getDimensionName());
#endif
}
@Override
public String getDimensionName() { return this.level.dimension().location().toString(); }
public String getDimensionName()
{
#if MC_VER <= MC_1_21_10
return this.level.dimension().location().toString();
#else
return this.level.dimension().identifier().getPath();
#endif
}
@Override
public long getHashedSeed() { return this.level.getBiomeManager().biomeZoomSeed; }
@@ -342,9 +362,12 @@ public class ClientLevelWrapper implements IClientLevelWrapper
#if MC_VER < MC_1_21_3
Vec3 colorVec3 = this.level.getCloudColor(tickDelta);
return new Color((float)colorVec3.x, (float)colorVec3.y, (float)colorVec3.z);
#else
#elif MC_VER <= MC_1_21_10
int argbColor = this.level.getCloudColor(tickDelta);
return ColorUtil.toColorObjARGB(argbColor);
#else
int argbColor = this.level.environmentAttributes().getValue(EnvironmentAttributes.CLOUD_COLOR, BlockPos.ZERO);
return new Color(ColorUtil.getRed(argbColor), ColorUtil.getGreen(argbColor), ColorUtil.getBlue(argbColor), 255 /* ignore alpha since DH clouds don't render correctly with transparency */);
#endif
}
@@ -26,25 +26,45 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IDimensionTypeWra
import net.minecraft.world.level.dimension.DimensionType;
/**
* @author James Seibel
*/
public class DimensionTypeWrapper implements IDimensionTypeWrapper
{
private static final ConcurrentMap<String, DimensionTypeWrapper> DIMENSION_WRAPPER_BY_NAME = new ConcurrentHashMap<>();
private final DimensionType dimensionType;
private final String name;
//=============//
// Constructor //
//=============//
public DimensionTypeWrapper(DimensionType dimensionType) { this.dimensionType = dimensionType; }
public static DimensionTypeWrapper getDimensionTypeWrapper(DimensionType dimensionType)
#if MC_VER <= MC_1_21_10
public DimensionTypeWrapper(DimensionType dimensionType)
#else
public DimensionTypeWrapper(DimensionType dimensionType, String name)
#endif
{
String dimName = getName(dimensionType);
this.dimensionType = dimensionType;
#if MC_VER <= MC_1_21_10
this.name = determineName(dimensionType);
#else
this.name = name;
#endif
}
#if MC_VER <= MC_1_21_10
public static DimensionTypeWrapper getDimensionTypeWrapper(DimensionType dimensionType)
#else
public static DimensionTypeWrapper getDimensionTypeWrapper(DimensionType dimensionType, String name)
#endif
{
#if MC_VER <= MC_1_21_10
String dimName = determineName(dimensionType);
#else
String dimName = name;
#endif
// check if the dimension has already been wrapped
if (DIMENSION_WRAPPER_BY_NAME.containsKey(dimName)
@@ -55,10 +75,26 @@ public class DimensionTypeWrapper implements IDimensionTypeWrapper
// create the missing wrapper
#if MC_VER <= MC_1_21_10
DimensionTypeWrapper dimensionTypeWrapper = new DimensionTypeWrapper(dimensionType);
#else
DimensionTypeWrapper dimensionTypeWrapper = new DimensionTypeWrapper(dimensionType, dimName);
#endif
DIMENSION_WRAPPER_BY_NAME.put(dimName, dimensionTypeWrapper);
return dimensionTypeWrapper;
}
private static String determineName(DimensionType dimensionType)
{
#if MC_VER <= MC_1_16_5
// effectsLocation() is marked as client only, so using the backing field directly
return dimensionType.effectsLocation.getPath();
#elif MC_VER <= MC_1_21_10
return dimensionType.effectsLocation().getPath();
#else
throw new UnsupportedOperationException("As of MC 1.21.11 the dimension type no longer stores it's name and must be determined from the level.");
#endif
}
public static void clearMap() { DIMENSION_WRAPPER_BY_NAME.clear(); }
@@ -69,16 +105,7 @@ public class DimensionTypeWrapper implements IDimensionTypeWrapper
//=================//
@Override
public String getName() { return getName(this.dimensionType); }
public static String getName(DimensionType dimensionType)
{
#if MC_VER <= MC_1_16_5
// effectsLocation() is marked as client only, so using the backing field directly
return dimensionType.effectsLocation.getPath();
#else
return dimensionType.effectsLocation().getPath();
#endif
}
public String getName() { return this.name; }
@Override
public boolean hasCeiling() { return this.dimensionType.hasCeiling(); }
@@ -89,7 +116,6 @@ public class DimensionTypeWrapper implements IDimensionTypeWrapper
@Override
public Object getWrappedMcObject() { return this.dimensionType; }
// there's definitely a better way of doing this, but it should work well enough for now
@Override
public boolean isTheEnd() { return this.getName().equalsIgnoreCase("the_end"); }
@@ -98,7 +124,6 @@ public class DimensionTypeWrapper implements IDimensionTypeWrapper
//================//
// base overrides //
//================//
@@ -172,10 +172,24 @@ public class ServerLevelWrapper implements IServerLevelWrapper
@Override
public DimensionTypeWrapper getDimensionType() { return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType()); }
public DimensionTypeWrapper getDimensionType()
{
#if MC_VER <= MC_1_21_10
return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType());
#else
return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType(), this.getDimensionName());
#endif
}
@Override
public String getDimensionName() { return this.level.dimension().location().toString(); }
public String getDimensionName()
{
#if MC_VER <= MC_1_21_10
return this.level.dimension().location().toString();
#else
return this.level.dimension().identifier().getPath();
#endif
}
@Override
public long getHashedSeed() { return this.level.getBiomeManager().biomeZoomSeed; }
@@ -18,7 +18,6 @@ accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chu
# used for grabbing vanilla rendered chunks
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
#accessible field net/minecraft/world/entity/Entity blockPosition Lnet/minecraft/core/BlockPos;
# lighting
accessible field net/minecraft/client/renderer/LightTexture lightPixels Lcom/mojang/blaze3d/platform/NativeImage;
@@ -30,8 +29,6 @@ accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine L
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory;
#accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Lnet/minecraft/core/Holder;
#accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V
accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
accessible field net/minecraft/server/level/ServerChunkCache distanceManager Lnet/minecraft/server/level/DistanceManager;
accessible method net/minecraft/server/level/ChunkMap getUpdatingChunkIfPresent (J)Lnet/minecraft/server/level/ChunkHolder;
@@ -29,8 +29,6 @@ accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine L
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory;
# accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Lnet/minecraft/core/Holder;
#accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V
accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
accessible field net/minecraft/server/level/ServerChunkCache distanceManager Lnet/minecraft/server/level/DistanceManager;
accessible method net/minecraft/server/level/ChunkMap getUpdatingChunkIfPresent (J)Lnet/minecraft/server/level/ChunkHolder;
@@ -15,7 +15,6 @@ accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
# world generation
# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
@@ -11,10 +11,7 @@ accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecr
# used for grabbing vanilla rendered chunks
accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
#accessible method net/minecraft/client/renderer/LevelRenderer renderSectionLayer (Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V
# world generation
# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
@@ -11,10 +11,7 @@ accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecr
# used for grabbing vanilla rendered chunks
accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
#accessible method net/minecraft/client/renderer/LevelRenderer renderSectionLayer (Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V
# world generation
# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
@@ -15,7 +15,6 @@ accessible field net/minecraft/client/renderer/LevelRenderer level Lnet/minecraf
accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
# world generation
# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
@@ -0,0 +1,53 @@
accessWidener v1 named
# used when determining where to save files to
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/nio/file/Path;
# used to help determine what folder a clientLevel is
accessible field net/minecraft/world/level/biome/BiomeManager biomeZoomSeed J
# used when rendering
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)F
accessible field net/minecraft/client/Minecraft deltaTracker Lnet/minecraft/client/DeltaTracker$Timer;
accessible field net/minecraft/client/renderer/LevelRenderer level Lnet/minecraft/client/multiplayer/ClientLevel;
# used for grabbing vanilla rendered chunks
accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
# world generation
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
accessible field net/minecraft/server/level/ServerChunkCache distanceManager Lnet/minecraft/server/level/DistanceManager;
accessible method net/minecraft/server/level/ChunkMap getUpdatingChunkIfPresent (J)Lnet/minecraft/server/level/ChunkHolder;
accessible method net/minecraft/server/level/ChunkMap tick (Ljava/util/function/BooleanSupplier;)V
accessible field net/minecraft/server/level/ServerLevel entityManager Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
# lod generation from save file
accessible field net/minecraft/world/level/chunk/storage/SimpleRegionStorage worker Lnet/minecraft/world/level/chunk/storage/IOWorker;
accessible field net/minecraft/world/level/chunk/storage/IOWorker storage Lnet/minecraft/world/level/chunk/storage/RegionFileStorage;
accessible field net/minecraft/world/level/chunk/storage/RegionFileStorage regionCache Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap;
accessible field net/minecraft/world/level/chunk/storage/RegionFileStorage folder Ljava/nio/file/Path;
# grabbing textures
accessible class net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture
accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameX (I)I
accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameY (I)I
accessible field net/minecraft/client/renderer/texture/SpriteContents animatedTexture Lnet/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture;
accessible field net/minecraft/client/renderer/texture/SpriteContents originalImage Lcom/mojang/blaze3d/platform/NativeImage;
# UI stuff
accessible field net/minecraft/client/gui/components/AbstractButton SPRITES Lnet/minecraft/client/gui/components/WidgetSprites;
# Handles inserting the config button
accessible field net/minecraft/client/gui/layouts/HeaderAndFooterLayout headerFrame Lnet/minecraft/client/gui/layouts/FrameLayout;
accessible field net/minecraft/client/gui/layouts/FrameLayout children Ljava/util/List;
accessible class net/minecraft/client/gui/layouts/FrameLayout$ChildContainer
accessible field net/minecraft/client/gui/layouts/LinearLayout wrapped Lnet/minecraft/client/gui/layouts/GridLayout;
accessible method net/minecraft/client/gui/components/debug/DebugScreenEntries register (Ljava/lang/String;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/Identifier;
# hacky stuff
accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
@@ -14,7 +14,6 @@ accessible field net/minecraft/client/Minecraft deltaTracker Lnet/minecraft/clie
accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
# world generation
# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
@@ -14,7 +14,6 @@ accessible field net/minecraft/client/Minecraft deltaTracker Lnet/minecraft/clie
accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
# world generation
# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
+1 -1
View File
@@ -102,7 +102,7 @@ dependencies {
// Mod Menu
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}")
addMod("com.terraformersmc:modmenu:${rootProject.modmenu_version}", rootProject.enable_mod_menu)
// Starlight
addMod("curse.maven:starlight-521783:${rootProject.starlight_version_fabric}", rootProject.enable_starlight)
@@ -36,7 +36,6 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import com.seibel.distanthorizons.core.logging.DhLogger;
import org.lwjgl.util.tinyfd.TinyFileDialogs;
@@ -47,6 +46,12 @@ import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
#endif
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#else
import net.minecraft.resources.Identifier;
#endif
import java.util.function.Consumer;
/**
@@ -56,10 +61,12 @@ import java.util.function.Consumer;
*/
public class FabricMain extends AbstractModInitializer implements ClientModInitializer, DedicatedServerModInitializer
{
#if MC_VER >= MC_1_21_1
#if MC_VER <= MC_1_20_6
private static final ResourceLocation INITIAL_PHASE = new ResourceLocation(ModInfo.RESOURCE_NAMESPACE, ModInfo.DEDICATED_SERVER_INITIAL_PATH);
#elif MC_VER <= MC_1_21_10
private static final ResourceLocation INITIAL_PHASE = ResourceLocation.fromNamespaceAndPath(ModInfo.RESOURCE_NAMESPACE, ModInfo.DEDICATED_SERVER_INITIAL_PATH);
#else
private static final ResourceLocation INITIAL_PHASE = new ResourceLocation(ModInfo.RESOURCE_NAMESPACE, ModInfo.DEDICATED_SERVER_INITIAL_PATH);
private static final Identifier INITIAL_PHASE = Identifier.fromNamespaceAndPath(ModInfo.RESOURCE_NAMESPACE, ModInfo.DEDICATED_SERVER_INITIAL_PATH);
#endif
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
@@ -27,7 +27,7 @@ import org.spongepowered.asm.mixin.Mixin;
public class MixinChunkSectionsToRender
{ /* rendering before was handled via Fabric API events */ }
#else
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
import com.seibel.distanthorizons.core.api.internal.ClientApi;
import net.minecraft.client.Minecraft;
@@ -38,15 +38,27 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
#if MC_VER <= MC_1_21_10
#else
import com.mojang.blaze3d.textures.GpuSampler;
#endif
@Mixin(ChunkSectionsToRender.class)
public class MixinChunkSectionsToRender
{
#if MC_VER <= MC_1_21_10
// needs to fire at HEAD with a lower than normal order (less than 1000)
// otherwise it will be canceled by Sodium
@Inject(at = @At("HEAD"), method = "renderGroup", order = 800)
private void renderDeferredLayer(ChunkSectionLayerGroup chunkSectionLayerGroup, CallbackInfo ci)
#else
// needs to fire at HEAD with a lower than normal order (less than 1000)
// otherwise it will be canceled by Sodium
@Inject(at = @At("HEAD"), method = "renderGroup", order = 800)
private void renderDeferredLayer(ChunkSectionLayerGroup chunkSectionLayerGroup, GpuSampler gpuSampler, CallbackInfo ci)
#endif
{
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, Minecraft.getInstance().levelRenderer.level);
@@ -160,9 +160,12 @@ public class MixinFogRenderer
{
#if MC_VER < MC_1_21_6
Entity entity = camera.getEntity();
#elif MC_VER <= MC_1_21_10
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
Entity entity = camera.getEntity();
#else
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
Entity entity = camera.getEntity();
Entity entity = camera.entity();
#endif
@@ -28,7 +28,6 @@ import net.minecraft.network.chat.Component;
#if MC_VER < MC_1_19_2
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -51,6 +50,11 @@ import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.options.OptionsScreen;
#endif
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#else
import net.minecraft.resources.Identifier;
#endif
/**
* Adds a button to the menu to goto the config
@@ -62,13 +66,16 @@ import net.minecraft.client.gui.screens.options.OptionsScreen;
public class MixinOptionsScreen extends Screen
{
/** Texture used for the config opening button */
#if MC_VER <= MC_1_20_6
@Unique
private static final ResourceLocation ICON_TEXTURE =
#if MC_VER < MC_1_21_1
new ResourceLocation(ModInfo.ID, "textures/gui/button.png");
#else
ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/button.png");
#endif
private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png");
#elif MC_VER <= MC_1_21_10
@Unique
private static final ResourceLocation ICON_TEXTURE = ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/button.png");
#else
@Unique
private static final Identifier ICON_TEXTURE = Identifier.fromNamespaceAndPath(ModInfo.ID, "textures/gui/button.png");
#endif
@Unique
@@ -23,7 +23,11 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio
import com.seibel.distanthorizons.core.util.objects.RunOnThisThreadExecutorService;
import org.spongepowered.asm.mixin.Mixin;
#if MC_VER <= MC_1_21_10
import net.minecraft.Util;
#else
import net.minecraft.util.Util;
#endif
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -23,9 +23,7 @@ import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
/**
* For making the config show up in modmenu
*/
/** For making the config show up in modmenu */
public class ModMenuIntegration implements ModMenuApi
{
// For the custom config code
@@ -28,9 +28,6 @@ public class OptifineAccessor extends AbstractOptifineAccessor
{
@Override
public String getModName()
{
return "Optifine-Fabric-1.18.X";
}
public String getModName() { return "Optifine-Fabric"; }
}
@@ -26,6 +26,7 @@ import java.lang.invoke.MethodType;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
import net.minecraft.client.Minecraft;
#if MC_VER < MC_1_20_1
@@ -50,9 +51,11 @@ public class SodiumAccessor implements ISodiumAccessor
*/
public static final boolean isSodiumV5OrLess;
#if MC_VER >= MC_1_20_1
#if MC_VER <= MC_1_19_4
#elif MC_VER <= MC_1_21_10
private static MethodHandle setFogOcclusionMethod;
private static Object sodiumPerformanceOptions;
#else
#endif
static {
@@ -78,7 +81,8 @@ public class SodiumAccessor implements ISodiumAccessor
@Override
public void setFogOcclusion(boolean occlusionEnabled)
{
#if MC_VER >= MC_1_20_1
#if MC_VER <= MC_1_19_4
#elif MC_VER <= MC_1_21_10
try
{
if (sodiumPerformanceOptions == null)
@@ -122,6 +126,8 @@ public class SodiumAccessor implements ISodiumAccessor
{
throw new RuntimeException(e);
}
#else
// in newer versions of Sodium this doesn't appear to be an issue so it can probably just be ignored
#endif
}
+2 -2
View File
@@ -5,7 +5,7 @@ org.gradle.caching=true
# Mod Info
mod_name=DistantHorizons
mod_version=2.3.7-b-dev
mod_version=2.4.0-b
api_version=5.0.0
maven_group=com.seibel.distanthorizons
mod_readable_name=Distant Horizons
@@ -55,7 +55,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=1.21.10
mcVer=1.21.11
# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
#minecraftMemoryJavaArg="-Xmx4G"
@@ -160,9 +160,12 @@ public class MixinFogRenderer
{
#if MC_VER < MC_1_21_6
Entity entity = camera.getEntity();
#elif MC_VER <= MC_1_21_10
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
Entity entity = camera.getEntity();
#else
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
Entity entity = camera.getEntity();
Entity entity = camera.entity();
#endif
@@ -28,7 +28,6 @@ import net.minecraft.network.chat.Component;
#if MC_VER < MC_1_19_2
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -51,6 +50,11 @@ import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.options.OptionsScreen;
#endif
#if MC_VER <= MC_1_21_10
import net.minecraft.resources.ResourceLocation;
#else
import net.minecraft.resources.Identifier;
#endif
/**
* Adds a button to the menu to goto the config
@@ -62,13 +66,16 @@ import net.minecraft.client.gui.screens.options.OptionsScreen;
public class MixinOptionsScreen extends Screen
{
/** Texture used for the config opening button */
#if MC_VER <= MC_1_20_6
@Unique
private static final ResourceLocation ICON_TEXTURE =
#if MC_VER < MC_1_21_1
new ResourceLocation(ModInfo.ID, "textures/gui/button.png");
#else
ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/button.png");
#endif
private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png");
#elif MC_VER <= MC_1_21_10
@Unique
private static final ResourceLocation ICON_TEXTURE = ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/button.png");
#else
@Unique
private static final Identifier ICON_TEXTURE = Identifier.fromNamespaceAndPath(ModInfo.ID, "textures/gui/button.png");
#endif
@Unique
@@ -23,7 +23,11 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio
import com.seibel.distanthorizons.core.util.objects.RunOnThisThreadExecutorService;
import org.spongepowered.asm.mixin.Mixin;
#if MC_VER <= MC_1_21_10
import net.minecraft.Util;
#else
import net.minecraft.util.Util;
#endif
#if MC_VER < MC_1_21_3
import org.spongepowered.asm.mixin.injection.At;
@@ -31,10 +31,19 @@ import net.irisshaders.iris.api.v0.IrisApi;
public class IrisAccessor implements IIrisAccessor
{
public IrisAccessor()
{
#if MC_VER == MC_1_21_11
throw new UnsupportedOperationException("Iris isn't supported on this version of DH. When this version of DH was created Iris wasn't available for Neoforge yet.");
#endif
}
@Override
public String getModName()
{
#if MC_VER == MC_1_21_9
#if MC_VER == MC_1_21_9 || MC_VER == MC_1_21_11
return "iris"; // Iris doesn't support this MC version
#else
return Iris.MODID;
@@ -28,9 +28,6 @@ public class OptifineAccessor extends AbstractOptifineAccessor
{
@Override
public String getModName()
{
return "Optifine-Forge-1.18.X";
}
public String getModName() { return "Optifine-Forge"; }
}
+1
View File
@@ -32,6 +32,7 @@ fabric_api_version=0.42.0+1.16
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_lithium=0
+1
View File
@@ -32,6 +32,7 @@ fabric_api_version=0.46.1+1.17
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_lithium=0
+1
View File
@@ -33,6 +33,7 @@ fabric_api_version=0.76.0+1.18.2
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -32,6 +32,7 @@ fabric_api_version=0.76.1+1.19.2
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -31,6 +31,7 @@ fabric_api_version=0.87.1+1.19.4
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -31,6 +31,7 @@ fabric_api_version=0.90.4+1.20.1
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -31,6 +31,7 @@ fabric_api_version=0.90.4+1.20.2
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -32,6 +32,7 @@ fabric_api_version=0.91.2+1.20.4
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -32,6 +32,7 @@ fabric_api_version=0.97.8+1.20.6
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -32,6 +32,7 @@ fabric_api_version=0.115.0+1.21.1
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -30,6 +30,7 @@ fabric_api_version=0.138.3+1.21.10
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+55
View File
@@ -0,0 +1,55 @@
# 1.21.11 version
java_version=21
minecraft_version=1.21.11
parchment_version=1.21:2024.07.28
compatible_minecraft_versions=["1.21.11"]
accessWidenerVersion=1_21_11
builds_for=fabric,neoforge
# forge is broken due to gradle/build script issues
# Netty
netty_version=4.1.97.Final
# Fabric loader
fabric_loader_version=0.17.3
fabric_api_version=0.139.4+1.21.11
modmenu_version=17.0.0-alpha.1
starlight_version_fabric=
phosphor_version_fabric=
lithium_version=
sodium_version=mc1.21.11-0.8.0-fabric
iris_version=1.10.0+1.21.11-fabric
bclib_version=
immersive_portals_version=
canvas_version=
fabric_incompatibility_list={ }
fabric_recommend_list={}
# Fabric mod run
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
enable_lithium=0
enable_iris=1
enable_bclib=0
enable_immersive_portals=0
enable_canvas=0
# NeoForge loader
forge_version=
neoforge_version=21.11.0-beta
neoforge_version_range=[*,)
# NeoForge mod versions
neo_iris_version=1.10.2+1.21.11-neoforge
# (Neo)Forge mod run
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
neo_enable_iris=1
+1
View File
@@ -32,6 +32,7 @@ fabric_api_version=0.110.0+1.21.3
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -31,6 +31,7 @@ fabric_api_version=0.110.5+1.21.4
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -31,6 +31,7 @@ fabric_api_version=0.119.5+1.21.5
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -30,6 +30,7 @@ fabric_api_version=0.127.0+1.21.6
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -30,6 +30,7 @@ fabric_api_version=0.133.4+1.21.8
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1
+1
View File
@@ -30,6 +30,7 @@ fabric_api_version=0.134.0+1.21.9
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
enable_sodium=1