Compare commits
29 Commits
build-test
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f3aaecae2 | |||
| e53622d17c | |||
| 516dab0d29 | |||
| 98d68704e1 | |||
| a13e06d600 | |||
| eb82ab1439 | |||
| 00b47fc776 | |||
| 1d7cb1e6fc | |||
| 3da97f75d7 | |||
| ab7a34be54 | |||
| e412ec2409 | |||
| 4a2f7178ee | |||
| 656bf17191 | |||
| 068399fd2f | |||
| be95801640 | |||
| 41e2912de7 | |||
| f64072eeab | |||
| 17af90d4e8 | |||
| 0dfbcb3c6d | |||
| 19df5c10cb | |||
| b25afa4ef5 | |||
| 9e092091d2 | |||
| 2afefd03b4 | |||
| 4c65c710f2 | |||
| 88710bde46 | |||
| 1ef6382582 | |||
| 0393375fae | |||
| 608fbd5952 | |||
| a94cd91a97 |
@@ -48,6 +48,11 @@ build:
|
|||||||
"1.16.5",
|
"1.16.5",
|
||||||
"1.12.2"
|
"1.12.2"
|
||||||
]
|
]
|
||||||
|
before_script:
|
||||||
|
# MC 1.12.2 needs both JDK 25 (for unimined) and JDK 8 (for MC 1.12)
|
||||||
|
# hopefully downloading the JDK 8 like this will solve that problem?
|
||||||
|
- apt-get update -q
|
||||||
|
- apt-get install -y openjdk-8-jdk
|
||||||
script:
|
script:
|
||||||
# this both runs the unit tests and assembles the code
|
# this both runs the unit tests and assembles the code
|
||||||
- ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/;
|
- ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="Fabric Client & Server" type="CompoundRunConfigurationType">
|
<configuration default="false" name="Fabric Client & Server" type="CompoundRunConfigurationType">
|
||||||
<toRun name="Fabric Client (:fabric)" type="Application" />
|
<toRun name="distant-horizons [fabric:runClient]" type="GradleRunConfiguration" />
|
||||||
<toRun name="Fabric Server (:fabric)" type="Application" />
|
<toRun name="distant-horizons [fabric:runServer]" type="GradleRunConfiguration" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
@@ -578,7 +578,8 @@ if (isNotCommonProject) {
|
|||||||
new JsonSlurper()
|
new JsonSlurper()
|
||||||
.parse(input)
|
.parse(input)
|
||||||
.each { key, value ->
|
.each { key, value ->
|
||||||
writer.writeLine("${key}=${value.toString().replace("%", "%%").replace("\n", "\\n")}")
|
def text = value.toString().replaceAll(/%(?!((\d+)\$)?s|%)/, "%%").replace("\n", "\\n")
|
||||||
|
writer.writeLine("${key}=${text}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-37
@@ -77,43 +77,6 @@ public class CleanroomClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
|
||||||
// world events //
|
|
||||||
//==============//
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void clientLevelLoadEvent(WorldEvent.Load event)
|
|
||||||
{
|
|
||||||
LOGGER.info("level load");
|
|
||||||
|
|
||||||
World level = event.getWorld();
|
|
||||||
if (!(level instanceof WorldClient clientLevel))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel, true);
|
|
||||||
ClientApi.INSTANCE.clientLevelLoadEvent(clientLevelWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void clientLevelUnloadEvent(WorldEvent.Unload event)
|
|
||||||
{
|
|
||||||
LOGGER.info("level unload");
|
|
||||||
|
|
||||||
World level = event.getWorld();
|
|
||||||
if (!(level instanceof WorldClient clientLevel))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel);
|
|
||||||
ClientApi.INSTANCE.clientLevelUnloadEvent(clientLevelWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
//==============//
|
||||||
// chunk events //
|
// chunk events //
|
||||||
//==============//
|
//==============//
|
||||||
|
|||||||
+1
-1
@@ -126,7 +126,7 @@ public class CleanroomServerProxy implements AbstractModInitializer.IEventProxy
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void serverChunkSaveEvent(ChunkDataEvent.Save event)
|
public void serverChunkSaveEvent(ChunkDataEvent.Save event)
|
||||||
{
|
{
|
||||||
if (event.getWorld() instanceof WorldServer worldServer)
|
if (event.getWorld() instanceof WorldServer worldServer && event.getChunk().dirty)
|
||||||
{
|
{
|
||||||
MixinChunkMapCommon.onChunkSave(worldServer, event.getChunk());
|
MixinChunkMapCommon.onChunkSave(worldServer, event.getChunk());
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -26,7 +26,6 @@ import com.seibel.distanthorizons.core.config.Config;
|
|||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.EntityRenderer;
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
@@ -61,9 +60,8 @@ public class MixinEntityRenderer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
MinecraftRenderWrapper renderWrapper = (MinecraftRenderWrapper)SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class);
|
MinecraftRenderWrapper renderWrapper = (MinecraftRenderWrapper)SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class);
|
||||||
renderWrapper.setLightmapId(lightmapTexture.getGlTextureId(), clientLevel);
|
renderWrapper.setLightmapId(lightmapTexture.getGlTextureId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(at = @At("RETURN"), method = "setupFog")
|
@Inject(at = @At("RETURN"), method = "setupFog")
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package com.seibel.distanthorizons.cleanroom.mixins.client;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.commonMixins.DhUpdateScreenBase;
|
||||||
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(Minecraft.class)
|
||||||
|
public class MixinMinecraft
|
||||||
|
{
|
||||||
|
|
||||||
|
@Inject(method = "init", at = @At("TAIL"))
|
||||||
|
private void onInit(CallbackInfo ci)
|
||||||
|
{
|
||||||
|
if(Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && !ModInfo.IS_DEV_BUILD) // weird lib class not found error can occur if we don't check if we are in dev
|
||||||
|
{
|
||||||
|
DhUpdateScreenBase.tryShowUpdateScreenAndRunAutoUpdateStartup(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-24
@@ -21,16 +21,12 @@ package com.seibel.distanthorizons.cleanroom.mixins.client;
|
|||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.renderer.RenderGlobal;
|
import net.minecraft.client.renderer.RenderGlobal;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL32;
|
||||||
import org.lwjgl.opengl.GL15;
|
|
||||||
import org.lwjgl.opengl.GL20;
|
|
||||||
import org.lwjgl.opengl.GL30;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -48,34 +44,25 @@ public class MixinRenderGlobal
|
|||||||
if (blockLayerIn == BlockRenderLayer.SOLID)
|
if (blockLayerIn == BlockRenderLayer.SOLID)
|
||||||
{
|
{
|
||||||
float[] mcProjMatrixRaw = new float[16];
|
float[] mcProjMatrixRaw = new float[16];
|
||||||
GL11.glGetFloatv(GL11.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
GL32.glGetFloatv(GL32.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix = new Mat4f(mcProjMatrixRaw);
|
ClientApi.RENDER_STATE.mcProjectionMatrix = new DhMat4f(mcProjMatrixRaw);
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix.transpose();
|
ClientApi.RENDER_STATE.mcProjectionMatrix.transpose();
|
||||||
|
|
||||||
float[] mcModelViewRaw = new float[16];
|
float[] mcModelViewRaw = new float[16];
|
||||||
GL11.glGetFloatv(GL11.GL_MODELVIEW_MATRIX, mcModelViewRaw);
|
GL32.glGetFloatv(GL32.GL_MODELVIEW_MATRIX, mcModelViewRaw);
|
||||||
ClientApi.RENDER_STATE.mcModelViewMatrix = new Mat4f(mcModelViewRaw);
|
ClientApi.RENDER_STATE.mcModelViewMatrix = new DhMat4f(mcModelViewRaw);
|
||||||
ClientApi.RENDER_STATE.mcModelViewMatrix.transpose();
|
ClientApi.RENDER_STATE.mcModelViewMatrix.transpose();
|
||||||
|
|
||||||
ClientApi.RENDER_STATE.partialTickTime = (float) partialTicks;
|
ClientApi.RENDER_STATE.partialTickTime = (float) partialTicks;
|
||||||
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, this.world);
|
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, this.world);
|
||||||
|
|
||||||
int blendSrc = GL11.glGetInteger(GL11.GL_BLEND_SRC);
|
|
||||||
int blendDst = GL11.glGetInteger(GL11.GL_BLEND_DST);
|
|
||||||
int boundTexture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
|
||||||
|
|
||||||
ClientApi.INSTANCE.renderLods();
|
ClientApi.INSTANCE.renderLods();
|
||||||
|
|
||||||
GL30.glBindVertexArray(0);
|
//Some 1.12.2 rendering mods breaks if we don't unbind buffers
|
||||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
GL32.glBindVertexArray(0);
|
||||||
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
|
GL32.glBindBuffer(GL32.GL_ARRAY_BUFFER, 0);
|
||||||
GL20.glUseProgram(0);
|
GL32.glBindBuffer(GL32.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
|
GL32.glUseProgram(0);
|
||||||
//Restore vanilla states
|
|
||||||
GlStateManager.depthFunc(GL11.GL_LEQUAL);
|
|
||||||
GlStateManager.bindTexture(boundTexture);
|
|
||||||
GlStateManager.tryBlendFuncSeparate(blendSrc, blendDst, GL11.GL_ONE, GL11.GL_ZERO);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,20 @@
|
|||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"package": "com.seibel.distanthorizons.cleanroom.mixins",
|
"package": "com.seibel.distanthorizons.cleanroom.mixins",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"target": "@env(DEFAULT)",
|
"target": "@env(DEFAULT)",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"common.MixinThreadedFileIOBase"
|
"common.MixinThreadedFileIOBase"
|
||||||
],
|
],
|
||||||
"minVersion": "0.8.7",
|
"minVersion": "0.8.7",
|
||||||
"server": [
|
"server": [
|
||||||
"server.MixinEntityPlayerMP"
|
"server.MixinEntityPlayerMP"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"client.MixinEntityRenderer",
|
"client.MixinEntityRenderer",
|
||||||
"client.MixinNetHandlerPlayClient",
|
"client.MixinMinecraft",
|
||||||
"client.MixinOptionsScreen",
|
"client.MixinNetHandlerPlayClient",
|
||||||
"client.MixinRenderGlobal"
|
"client.MixinOptionsScreen",
|
||||||
]
|
"client.MixinRenderGlobal"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.seibel.distanthorizons.common;
|
package com.seibel.distanthorizons.common;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.api.enums.config.EDhApiMcRenderingFadeMode;
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingEngine;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingEngine;
|
||||||
|
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiDistantGeneratorMode;
|
||||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent;
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent;
|
||||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent;
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent;
|
||||||
import com.seibel.distanthorizons.common.commands.CommandInitializer;
|
import com.seibel.distanthorizons.common.commands.CommandInitializer;
|
||||||
import com.seibel.distanthorizons.common.wrappers.DependencySetup;
|
import com.seibel.distanthorizons.common.wrappers.DependencySetup;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.DhDebugScreenEntry;
|
import com.seibel.distanthorizons.common.wrappers.gui.DhDebugScreenEntry;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftServerWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftServerWrapper;
|
||||||
import com.seibel.distanthorizons.core.Initializer;
|
import com.seibel.distanthorizons.core.Initializer;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
@@ -262,6 +265,8 @@ public abstract class AbstractModInitializer
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, e.getMessage(), "ok", "error");
|
||||||
|
MinecraftClientWrapper.INSTANCE.crashMinecraft(e.getMessage(), e);
|
||||||
future.completeExceptionally(e);
|
future.completeExceptionally(e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
+2
-8
@@ -39,12 +39,6 @@ public class DhUpdateScreenBase
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get())
|
|
||||||
{
|
|
||||||
LOGGER.info("Auto update disabled, ignoring new version...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
runnable = () ->
|
runnable = () ->
|
||||||
{
|
{
|
||||||
@@ -82,8 +76,8 @@ public class DhUpdateScreenBase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
DhScreenUtil.showScreen(new UpdateModScreen(
|
DhScreenUtil.setScreen(new UpdateModScreen(
|
||||||
new TitleScreen(false),
|
new GuiMainMenu(),
|
||||||
versionId
|
versionId
|
||||||
));
|
));
|
||||||
#else
|
#else
|
||||||
|
|||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
package com.seibel.distanthorizons.common.commonMixins;
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_12_2
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.modAccessor.AbstractImmersivePortalsAccessorCommon;
|
||||||
|
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||||
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.level.ChunkPos;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
|
public class MixinImmersivePortalsRenderStatesCommon
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Used to access variables that will change when rendering
|
||||||
|
* different levels with Immersive Portals
|
||||||
|
* (ie player/camera position level reference)
|
||||||
|
* but that we only want for the loaded level.
|
||||||
|
*/
|
||||||
|
public static void saveVolatileOriginals()
|
||||||
|
{
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
|
||||||
|
AbstractImmersivePortalsAccessorCommon.actualLevel = mc.level;
|
||||||
|
|
||||||
|
|
||||||
|
// clear everything if the player is missing
|
||||||
|
// (ie the world hasn't loaded yet)
|
||||||
|
if (mc.player == null)
|
||||||
|
{
|
||||||
|
AbstractImmersivePortalsAccessorCommon.actualBlockPos = null;
|
||||||
|
AbstractImmersivePortalsAccessorCommon.actualChunkPos = null;
|
||||||
|
AbstractImmersivePortalsAccessorCommon.actualCameraPos = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// player block pos
|
||||||
|
BlockPos playerBlockPos = mc.player.blockPosition();
|
||||||
|
AbstractImmersivePortalsAccessorCommon.actualBlockPos = new DhBlockPos(playerBlockPos.getX(), playerBlockPos.getY(), playerBlockPos.getZ());
|
||||||
|
|
||||||
|
// player chunk pos
|
||||||
|
#if MC_VER < MC_1_17_1
|
||||||
|
ChunkPos playerChunkPos = new ChunkPos(mc.player.blockPosition());
|
||||||
|
#else
|
||||||
|
ChunkPos playerChunkPos = mc.player.chunkPosition();
|
||||||
|
#endif
|
||||||
|
AbstractImmersivePortalsAccessorCommon.actualChunkPos = McObjectConverter.Convert(playerChunkPos);
|
||||||
|
|
||||||
|
// camera pos
|
||||||
|
#if MC_VER <= MC_1_21_10
|
||||||
|
Vec3 cameraPos = mc.gameRenderer.getMainCamera().getPosition();
|
||||||
|
#elif MC_VER <= MC_26_1_2
|
||||||
|
Vec3 cameraPos = mc.gameRenderer.getMainCamera().position();
|
||||||
|
#else
|
||||||
|
Vec3 cameraPos = mc.gameRenderer.mainCamera().position();
|
||||||
|
#endif
|
||||||
|
AbstractImmersivePortalsAccessorCommon.actualCameraPos = new DhVec3d(cameraPos.x(), cameraPos.y(), cameraPos.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
+27
-1
@@ -7,6 +7,7 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
|||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IImmersivePortalsAccessor;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -20,12 +21,17 @@ import net.minecraft.world.entity.LivingEntity;
|
|||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.init.MobEffects;
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.fluids.IFluidBlock;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
#elif MC_VER < MC_1_17_1
|
#elif MC_VER < MC_1_17_1
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.client.renderer.FogRenderer;
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
#elif MC_VER < MC_1_21_3
|
#elif MC_VER < MC_1_21_3
|
||||||
@@ -50,6 +56,11 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
#else
|
#else
|
||||||
import net.minecraft.world.level.material.FogType;
|
import net.minecraft.world.level.material.FogType;
|
||||||
|
import net.minecraft.client.renderer.fog.FogRenderer;
|
||||||
|
import net.minecraft.client.renderer.fog.FogData;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -104,6 +115,15 @@ public class MixinVanillaFogCommon
|
|||||||
cancelFog = cancelFog && !Config.Client.Advanced.Graphics.Fog.enableVanillaFog.get();
|
cancelFog = cancelFog && !Config.Client.Advanced.Graphics.Fog.enableVanillaFog.get();
|
||||||
|
|
||||||
|
|
||||||
|
// since DH won't render through immersive portals
|
||||||
|
// the vanilla fog should be enabled
|
||||||
|
IImmersivePortalsAccessor immersivePortals = ModAccessorInjector.INSTANCE.get(IImmersivePortalsAccessor.class);
|
||||||
|
if (immersivePortals != null
|
||||||
|
&& immersivePortals.isRenderingPortal())
|
||||||
|
{
|
||||||
|
cancelFog = false;
|
||||||
|
}
|
||||||
|
|
||||||
return cancelFog;
|
return cancelFog;
|
||||||
}
|
}
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
@@ -113,7 +133,11 @@ public class MixinVanillaFogCommon
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
boolean cameraNotInFluid = mc.getRenderViewEntity() != null && !mc.world.getBlockState(mc.getRenderViewEntity().getPosition()).getMaterial().isLiquid();
|
Entity view = mc.getRenderViewEntity();
|
||||||
|
if (view == null) return true;
|
||||||
|
|
||||||
|
IBlockState fluidState = mc.world.getBlockState(new BlockPos(view.getPositionEyes(mc.getRenderPartialTicks())));
|
||||||
|
boolean cameraNotInFluid = !(fluidState.getMaterial().isLiquid() || fluidState.getBlock() instanceof IFluidBlock);
|
||||||
#elif MC_VER < MC_1_17_1
|
#elif MC_VER < MC_1_17_1
|
||||||
FluidState fluidState = camera.getFluidInCamera();
|
FluidState fluidState = camera.getFluidInCamera();
|
||||||
boolean cameraNotInFluid = fluidState.isEmpty();
|
boolean cameraNotInFluid = fluidState.isEmpty();
|
||||||
@@ -124,4 +148,6 @@ public class MixinVanillaFogCommon
|
|||||||
|
|
||||||
return cameraNotInFluid;
|
return cameraNotInFluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-11
@@ -41,12 +41,11 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
|
|||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
||||||
import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer;
|
import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
import com.seibel.distanthorizons.core.util.math.DhVec3f;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
@@ -98,7 +97,7 @@ public class BlazeDebugWireframeRenderer extends AbstractDebugWireframeRenderer
|
|||||||
//endregion
|
//endregion
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Mat4f TRANSFORM_MATRIX = new Mat4f();
|
private static final DhMat4f TRANSFORM_MATRIX = new DhMat4f();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -174,10 +173,10 @@ public class BlazeDebugWireframeRenderer extends AbstractDebugWireframeRenderer
|
|||||||
|
|
||||||
|
|
||||||
// box vertices
|
// box vertices
|
||||||
ByteBuffer boxVerticesBuffer = MemoryUtil.memAlloc(BOX_VERTICES.length * Float.BYTES);
|
ByteBuffer boxVerticesBuffer = ByteBuffer.allocateDirect(BOX_VERTICES.length * Float.BYTES);
|
||||||
|
boxVerticesBuffer.order(ByteOrder.nativeOrder());
|
||||||
boxVerticesBuffer.asFloatBuffer().put(BOX_VERTICES);
|
boxVerticesBuffer.asFloatBuffer().put(BOX_VERTICES);
|
||||||
boxVerticesBuffer.rewind();
|
boxVerticesBuffer.rewind();
|
||||||
MemoryUtil.memFree(boxVerticesBuffer);
|
|
||||||
|
|
||||||
// upload vertex data
|
// upload vertex data
|
||||||
{
|
{
|
||||||
@@ -255,14 +254,14 @@ public class BlazeDebugWireframeRenderer extends AbstractDebugWireframeRenderer
|
|||||||
// uniforms
|
// uniforms
|
||||||
{
|
{
|
||||||
// create data //
|
// create data //
|
||||||
Vec3d camPos = MC_RENDER.getCameraExactPosition();
|
DhVec3d camPos = MC_RENDER.getCameraExactPosition();
|
||||||
Vec3f camPosFloatThisFrame = new Vec3f((float) camPos.x, (float) camPos.y, (float) camPos.z);
|
DhVec3f camPosFloatThisFrame = new DhVec3f((float) camPos.x, (float) camPos.y, (float) camPos.z);
|
||||||
|
|
||||||
Mat4f boxTransform = Mat4f.createTranslateMatrix(
|
DhMat4f boxTransform = DhMat4f.createTranslateMatrix(
|
||||||
box.minPos.x - camPosFloatThisFrame.x,
|
box.minPos.x - camPosFloatThisFrame.x,
|
||||||
box.minPos.y - camPosFloatThisFrame.y,
|
box.minPos.y - camPosFloatThisFrame.y,
|
||||||
box.minPos.z - camPosFloatThisFrame.z);
|
box.minPos.z - camPosFloatThisFrame.z);
|
||||||
boxTransform.multiply(Mat4f.createScaleMatrix(
|
boxTransform.multiply(DhMat4f.createScaleMatrix(
|
||||||
box.maxPos.x - box.minPos.x,
|
box.maxPos.x - box.minPos.x,
|
||||||
box.maxPos.y - box.minPos.y,
|
box.maxPos.y - box.minPos.y,
|
||||||
box.maxPos.z - box.minPos.z));
|
box.maxPos.z - box.minPos.z));
|
||||||
|
|||||||
+4
-4
@@ -60,8 +60,8 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRender
|
|||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.IDhGenericObjectVertexBufferContainer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.IDhGenericObjectVertexBufferContainer;
|
||||||
import com.seibel.distanthorizons.core.render.renderer.RenderableBoxGroup;
|
import com.seibel.distanthorizons.core.render.renderer.RenderableBoxGroup;
|
||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhGenericRenderer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhGenericRenderer;
|
||||||
@@ -350,7 +350,7 @@ public class BlazeDhGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
|
|
||||||
ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeGenericRenderSetupEvent.class, renderEventParam.apiCopy);
|
ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeGenericRenderSetupEvent.class, renderEventParam.apiCopy);
|
||||||
|
|
||||||
Vec3d camPos = MC_RENDER.getCameraExactPosition();
|
DhVec3d camPos = MC_RENDER.getCameraExactPosition();
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ public class BlazeDhGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
{
|
{
|
||||||
// create data //
|
// create data //
|
||||||
|
|
||||||
Mat4f projectionMvmMatrix = new Mat4f(renderEventParam.dhProjectionMatrix);
|
DhMat4f projectionMvmMatrix = new DhMat4f(renderEventParam.dhProjectionMatrix);
|
||||||
projectionMvmMatrix.multiply(renderEventParam.dhModelViewMatrix);
|
projectionMvmMatrix.multiply(renderEventParam.dhModelViewMatrix);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -6,7 +6,6 @@ public class BlazeDhRenderApiDefinition {}
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingApi;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingApi;
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingEngine;
|
|
||||||
import com.seibel.distanthorizons.common.render.blaze.objects.BlazeGenericObjectVertexContainer;
|
import com.seibel.distanthorizons.common.render.blaze.objects.BlazeGenericObjectVertexContainer;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFarFadeRenderer;
|
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFarFadeRenderer;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFogRenderer;
|
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFogRenderer;
|
||||||
@@ -35,8 +34,8 @@ public class BlazeDhRenderApiDefinition extends AbstractDhRenderApiDefinition
|
|||||||
//=========//
|
//=========//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
private final String apiName;
|
private final String engineName;
|
||||||
public String getApiName() { return this.apiName; }
|
public String getEngineName() { return this.engineName; }
|
||||||
|
|
||||||
public EDhRenderDepth getRenderDepth()
|
public EDhRenderDepth getRenderDepth()
|
||||||
{
|
{
|
||||||
@@ -66,11 +65,11 @@ public class BlazeDhRenderApiDefinition extends AbstractDhRenderApiDefinition
|
|||||||
#if MC_VER <= MC_26_1_2
|
#if MC_VER <= MC_26_1_2
|
||||||
renderApi = EDhApiRenderingApi.OPEN_GL;
|
renderApi = EDhApiRenderingApi.OPEN_GL;
|
||||||
#else
|
#else
|
||||||
// use the same rendering API as Minecraft
|
// Blaze always uses the same rendering API as Minecraft
|
||||||
this.renderApi = MinecraftRenderWrapper.INSTANCE.getMcRenderingApi();
|
this.renderApi = MinecraftRenderWrapper.INSTANCE.getMcRenderingApi();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this.apiName = "Blaze3D: " + this.getRenderApi();
|
this.engineName = "Blaze3D: " + this.getRenderApi();
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
+6
-6
@@ -32,9 +32,9 @@ import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
|||||||
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
import com.seibel.distanthorizons.core.util.math.DhVec3f;
|
||||||
import com.seibel.distanthorizons.core.util.objects.SortedArraySet;
|
import com.seibel.distanthorizons.core.util.objects.SortedArraySet;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
||||||
@@ -54,7 +54,7 @@ public class BlazeDhTerrainRenderer implements IDhTerrainRenderer
|
|||||||
|
|
||||||
public static final BlazeDhTerrainRenderer INSTANCE = new BlazeDhTerrainRenderer();
|
public static final BlazeDhTerrainRenderer INSTANCE = new BlazeDhTerrainRenderer();
|
||||||
|
|
||||||
private static final Vec3f MODEL_POS = new Vec3f();
|
private static final DhVec3f MODEL_POS = new DhVec3f();
|
||||||
/** single event object used to reduce GC pressure */
|
/** single event object used to reduce GC pressure */
|
||||||
private static final DhApiBeforeBufferRenderEvent.EventParam BEFORE_BUFFER_RENDER_EVENT_PARAM = new DhApiBeforeBufferRenderEvent.EventParam();
|
private static final DhApiBeforeBufferRenderEvent.EventParam BEFORE_BUFFER_RENDER_EVENT_PARAM = new DhApiBeforeBufferRenderEvent.EventParam();
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ public class BlazeDhTerrainRenderer implements IDhTerrainRenderer
|
|||||||
|
|
||||||
profiler.popPush("vert share uniforms");
|
profiler.popPush("vert share uniforms");
|
||||||
{
|
{
|
||||||
Mat4f combinedMatrix = new Mat4f(renderEventParam.dhProjectionMatrix);
|
DhMat4f combinedMatrix = new DhMat4f(renderEventParam.dhProjectionMatrix);
|
||||||
combinedMatrix.multiply(renderEventParam.dhModelViewMatrix);
|
combinedMatrix.multiply(renderEventParam.dhModelViewMatrix);
|
||||||
|
|
||||||
float earthCurveRatio = Config.Client.Advanced.Graphics.Experimental.earthCurveRatio.get();
|
float earthCurveRatio = Config.Client.Advanced.Graphics.Experimental.earthCurveRatio.get();
|
||||||
@@ -304,7 +304,7 @@ public class BlazeDhTerrainRenderer implements IDhTerrainRenderer
|
|||||||
|
|
||||||
// fire render event
|
// fire render event
|
||||||
{
|
{
|
||||||
Vec3d camPos = renderEventParam.exactCameraPosition;
|
DhVec3d camPos = renderEventParam.exactCameraPosition;
|
||||||
MODEL_POS.set(
|
MODEL_POS.set(
|
||||||
(float) (bufferContainer.minCornerBlockPos.getX() - camPos.x),
|
(float) (bufferContainer.minCornerBlockPos.getX() - camPos.x),
|
||||||
(float) (bufferContainer.minCornerBlockPos.getY() - camPos.y),
|
(float) (bufferContainer.minCornerBlockPos.getY() - camPos.y),
|
||||||
|
|||||||
-1
@@ -44,7 +44,6 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhFarFadeRenderer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhFarFadeRenderer;
|
||||||
|
|
||||||
|
|||||||
+4
-6
@@ -40,7 +40,7 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
||||||
@@ -69,8 +69,6 @@ public class BlazeDhFogRenderer implements IDhFogRenderer
|
|||||||
{
|
{
|
||||||
public static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
public static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
|
|
||||||
private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
private static final IMinecraftRenderWrapper MC_RENDER = SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class);
|
|
||||||
private static final AbstractDhRenderApiDefinition RENDER_API_DEF = SingletonInjector.INSTANCE.get(AbstractDhRenderApiDefinition.class);
|
private static final AbstractDhRenderApiDefinition RENDER_API_DEF = SingletonInjector.INSTANCE.get(AbstractDhRenderApiDefinition.class);
|
||||||
|
|
||||||
private static final GpuDevice GPU_DEVICE = RenderSystem.getDevice();
|
private static final GpuDevice GPU_DEVICE = RenderSystem.getDevice();
|
||||||
@@ -180,7 +178,7 @@ public class BlazeDhFogRenderer implements IDhFogRenderer
|
|||||||
|
|
||||||
int lodDrawDistance = Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius.get() * LodUtil.CHUNK_WIDTH;
|
int lodDrawDistance = Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius.get() * LodUtil.CHUNK_WIDTH;
|
||||||
|
|
||||||
Mat4f inverseMvmProjMatrix = new Mat4f(renderParams.dhMvmProjMatrix);
|
DhMat4f inverseMvmProjMatrix = new DhMat4f(renderParams.dhMvmProjMatrix);
|
||||||
inverseMvmProjMatrix.invert();
|
inverseMvmProjMatrix.invert();
|
||||||
|
|
||||||
EDhApiHeightFogMixMode heightFogMixingMode = fogRenderParams.getHeightFogMixingMode();
|
EDhApiHeightFogMixMode heightFogMixingMode = fogRenderParams.getHeightFogMixingMode();
|
||||||
@@ -203,7 +201,7 @@ public class BlazeDhFogRenderer implements IDhFogRenderer
|
|||||||
fogColor.getBlue() / 255.0f,
|
fogColor.getBlue() / 255.0f,
|
||||||
fogColor.getAlpha() / 255.0f) // uFogColor
|
fogColor.getAlpha() / 255.0f) // uFogColor
|
||||||
.putFloat(1.f / lodDrawDistance) //uFogScale
|
.putFloat(1.f / lodDrawDistance) //uFogScale
|
||||||
.putFloat(1.f / MC.getWrappedClientLevel().getMaxHeight()) //uFogVerticalScale
|
.putFloat(1.f / renderParams.clientLevelWrapper.getMaxHeight()) //uFogVerticalScale
|
||||||
.putInt(0) //uFogDebugMode // 0 = normal // 1 = render everything with fog color // 7 = use debug rendering
|
.putInt(0) //uFogDebugMode // 0 = normal // 1 = render everything with fog color // 7 = use debug rendering
|
||||||
.putInt(fogRenderParams.getFarFogFalloff().value) //uFogFalloffType
|
.putInt(fogRenderParams.getFarFogFalloff().value) //uFogFalloffType
|
||||||
|
|
||||||
@@ -230,7 +228,7 @@ public class BlazeDhFogRenderer implements IDhFogRenderer
|
|||||||
.putInt(fogRenderParams.getHeightFogDirection().fogAppliesDown ? 1 : 0) // uHeightFogAppliesDown
|
.putInt(fogRenderParams.getHeightFogDirection().fogAppliesDown ? 1 : 0) // uHeightFogAppliesDown
|
||||||
.putInt(useSphericalFog ? 1 : 0) // uUseSphericalFog
|
.putInt(useSphericalFog ? 1 : 0) // uUseSphericalFog
|
||||||
.putInt(heightFogMixingMode.value) // uHeightFogMixingMode
|
.putInt(heightFogMixingMode.value) // uHeightFogMixingMode
|
||||||
.putFloat((float)MC_RENDER.getCameraExactPosition().y) // uCameraBlockYPos
|
.putFloat((float)renderParams.exactCameraPosition.y) // uCameraBlockYPos
|
||||||
|
|
||||||
.putMat4f(inverseMvmProjMatrix) // uInvMvmProj
|
.putMat4f(inverseMvmProjMatrix) // uInvMvmProj
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -37,7 +37,7 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhSsaoRenderer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhSsaoRenderer;
|
||||||
@@ -173,8 +173,8 @@ public class BlazeDhSsaoRenderer implements IDhSsaoRenderer
|
|||||||
// frag uniforms
|
// frag uniforms
|
||||||
{
|
{
|
||||||
// create data //
|
// create data //
|
||||||
Mat4f projMatrix = new Mat4f(renderParams.dhProjectionMatrix);
|
DhMat4f projMatrix = new DhMat4f(renderParams.dhProjectionMatrix);
|
||||||
Mat4f invertedProjMatrix = new Mat4f(renderParams.dhProjectionMatrix);
|
DhMat4f invertedProjMatrix = new DhMat4f(renderParams.dhProjectionMatrix);
|
||||||
invertedProjMatrix.invert();
|
invertedProjMatrix.invert();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -45,7 +45,7 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhVanillaFadeRenderer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhVanillaFadeRenderer;
|
||||||
@@ -174,16 +174,16 @@ public class BlazeVanillaFadeRenderer implements IDhVanillaFadeRenderer
|
|||||||
float fadeEndDistance = dhNearClipDistance * 1.9f;
|
float fadeEndDistance = dhNearClipDistance * 1.9f;
|
||||||
|
|
||||||
|
|
||||||
Mat4f inverseMcModelViewProjectionMatrix = new Mat4f(renderParams.mcProjectionMatrix);
|
DhMat4f inverseMcModelViewProjectionMatrix = new DhMat4f(renderParams.mcProjectionMatrix);
|
||||||
inverseMcModelViewProjectionMatrix.multiply(renderParams.mcModelViewMatrix);
|
inverseMcModelViewProjectionMatrix.multiply(renderParams.mcModelViewMatrix);
|
||||||
inverseMcModelViewProjectionMatrix.invert();
|
inverseMcModelViewProjectionMatrix.invert();
|
||||||
Mat4f inverseMcMvmProjMatrix = inverseMcModelViewProjectionMatrix;
|
DhMat4f inverseMcMvmProjMatrix = inverseMcModelViewProjectionMatrix;
|
||||||
|
|
||||||
|
|
||||||
Mat4f inverseDhModelViewProjectionMatrix = new Mat4f(renderParams.dhProjectionMatrix);
|
DhMat4f inverseDhModelViewProjectionMatrix = new DhMat4f(renderParams.dhProjectionMatrix);
|
||||||
inverseDhModelViewProjectionMatrix.multiply(renderParams.dhModelViewMatrix);
|
inverseDhModelViewProjectionMatrix.multiply(renderParams.dhModelViewMatrix);
|
||||||
inverseDhModelViewProjectionMatrix.invert();
|
inverseDhModelViewProjectionMatrix.invert();
|
||||||
Mat4f inverseDhMvmProjMatrix = inverseDhModelViewProjectionMatrix;
|
DhMat4f inverseDhMvmProjMatrix = inverseDhModelViewProjectionMatrix;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
@@ -16,6 +16,7 @@ import com.seibel.distanthorizons.common.render.blaze.wrappers.uniform.BlazeUnif
|
|||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.OptionalDouble;
|
import java.util.OptionalDouble;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|||||||
-4
@@ -18,7 +18,6 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.IVertexBufferWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.IVertexBufferWrapper;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@@ -83,9 +82,6 @@ public class BlazeVertexBufferWrapper implements IVertexBufferWrapper
|
|||||||
|
|
||||||
GpuBufferSlice bufferSlice = new GpuBufferSlice(GLOBAL_INDEX_GPU_BUFFER, /*offset*/ 0, indexBuffer.capacity());
|
GpuBufferSlice bufferSlice = new GpuBufferSlice(GLOBAL_INDEX_GPU_BUFFER, /*offset*/ 0, indexBuffer.capacity());
|
||||||
COMMAND_ENCODER.writeToBuffer(bufferSlice, indexBuffer);
|
COMMAND_ENCODER.writeToBuffer(bufferSlice, indexBuffer);
|
||||||
|
|
||||||
MemoryUtil.memFree(indexBuffer);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ public class BlazeLodUniformBufferWrapper {}
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.LodBufferContainer;
|
import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.LodBufferContainer;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
import com.seibel.distanthorizons.core.util.math.DhVec3f;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.ILodContainerUniformBufferWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.ILodContainerUniformBufferWrapper;
|
||||||
|
|
||||||
public class BlazeLodUniformBufferWrapper extends BlazeUniformBufferWrapper implements ILodContainerUniformBufferWrapper
|
public class BlazeLodUniformBufferWrapper extends BlazeUniformBufferWrapper implements ILodContainerUniformBufferWrapper
|
||||||
@@ -40,7 +40,7 @@ public class BlazeLodUniformBufferWrapper extends BlazeUniformBufferWrapper impl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f modelOffset = new Vec3f(
|
DhVec3f modelOffset = new DhVec3f(
|
||||||
(float) (bufferContainer.minCornerBlockPos.getX()),
|
(float) (bufferContainer.minCornerBlockPos.getX()),
|
||||||
(float) (bufferContainer.minCornerBlockPos.getY()),
|
(float) (bufferContainer.minCornerBlockPos.getY()),
|
||||||
(float) (bufferContainer.minCornerBlockPos.getZ()));
|
(float) (bufferContainer.minCornerBlockPos.getZ()));
|
||||||
|
|||||||
+3
-10
@@ -16,8 +16,7 @@ import com.seibel.distanthorizons.api.objects.math.DhApiMat4f;
|
|||||||
import com.seibel.distanthorizons.common.render.blaze.util.BlazeUniformUtil;
|
import com.seibel.distanthorizons.common.render.blaze.util.BlazeUniformUtil;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
@@ -95,7 +94,7 @@ public class BlazeUniformBufferWrapper implements AutoCloseable
|
|||||||
public BlazeUniformBufferWrapper putMat4f(DhApiMat4f matrix)
|
public BlazeUniformBufferWrapper putMat4f(DhApiMat4f matrix)
|
||||||
{
|
{
|
||||||
this.putElement(EUniformElement.MAT4f);
|
this.putElement(EUniformElement.MAT4f);
|
||||||
this.uniformBufferBuilder.putMat4f(Mat4f.createJomlMatrix(matrix));
|
this.uniformBufferBuilder.putMat4f(DhMat4f.createJomlMatrix(matrix));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public BlazeUniformBufferWrapper putFloat(float f)
|
public BlazeUniformBufferWrapper putFloat(float f)
|
||||||
@@ -132,14 +131,13 @@ public class BlazeUniformBufferWrapper implements AutoCloseable
|
|||||||
ByteBuffer oldBuffer = this.cpuBuffer;
|
ByteBuffer oldBuffer = this.cpuBuffer;
|
||||||
|
|
||||||
int size = calcBufferSize(this.uniformElementTypes);
|
int size = calcBufferSize(this.uniformElementTypes);
|
||||||
this.cpuBuffer = MemoryUtil.memAlloc(size);
|
this.cpuBuffer = ByteBuffer.allocateDirect(size);
|
||||||
this.cpuBuffer.order(ByteOrder.nativeOrder());
|
this.cpuBuffer.order(ByteOrder.nativeOrder());
|
||||||
|
|
||||||
if (oldBuffer != null)
|
if (oldBuffer != null)
|
||||||
{
|
{
|
||||||
oldBuffer.position(0);
|
oldBuffer.position(0);
|
||||||
this.cpuBuffer.put(oldBuffer);
|
this.cpuBuffer.put(oldBuffer);
|
||||||
MemoryUtil.memFree(oldBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bufferSize = size;
|
this.bufferSize = size;
|
||||||
@@ -210,11 +208,6 @@ public class BlazeUniformBufferWrapper implements AutoCloseable
|
|||||||
{
|
{
|
||||||
this.gpuBuffer.close();
|
this.gpuBuffer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cpuBuffer != null)
|
|
||||||
{
|
|
||||||
MemoryUtil.memFree(this.cpuBuffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
+4
-4
@@ -30,7 +30,7 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
|
|||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer;
|
import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
@@ -178,10 +178,10 @@ public class GlDhDebugWireframeRenderer extends AbstractDebugWireframeRenderer
|
|||||||
@Override
|
@Override
|
||||||
public void renderBox(Box box)
|
public void renderBox(Box box)
|
||||||
{
|
{
|
||||||
Mat4f boxTransform = Mat4f.createTranslateMatrix(box.minPos.x - this.camPosFloatThisFrame.x, box.minPos.y - this.camPosFloatThisFrame.y, box.minPos.z - this.camPosFloatThisFrame.z);
|
DhMat4f boxTransform = DhMat4f.createTranslateMatrix(box.minPos.x - this.camPosFloatThisFrame.x, box.minPos.y - this.camPosFloatThisFrame.y, box.minPos.z - this.camPosFloatThisFrame.z);
|
||||||
boxTransform.multiply(Mat4f.createScaleMatrix(box.maxPos.x - box.minPos.x, box.maxPos.y - box.minPos.y, box.maxPos.z - box.minPos.z));
|
boxTransform.multiply(DhMat4f.createScaleMatrix(box.maxPos.x - box.minPos.x, box.maxPos.y - box.minPos.y, box.maxPos.z - box.minPos.z));
|
||||||
|
|
||||||
Mat4f transformMatrix = this.dhMvmProjMatrixThisFrame.copy();
|
DhMat4f transformMatrix = this.dhMvmProjMatrixThisFrame.copy();
|
||||||
transformMatrix.multiply(boxTransform);
|
transformMatrix.multiply(boxTransform);
|
||||||
this.basicShader.setUniform(this.basicShader.getUniformLocation("uTransform"), transformMatrix);
|
this.basicShader.setUniform(this.basicShader.getUniformLocation("uTransform"), transformMatrix);
|
||||||
|
|
||||||
|
|||||||
+17
-1
@@ -71,6 +71,11 @@ public class GlDhMetaRenderer implements IDhMetaRenderer
|
|||||||
/** used in case there's an API override */
|
/** used in case there's an API override */
|
||||||
public IDhApiShaderProgram shaderProgramForThisFrame;
|
public IDhApiShaderProgram shaderProgramForThisFrame;
|
||||||
|
|
||||||
|
/** Older MC versions assume GL state is unchanged, so we must restore it after DH rendering */
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private int previousBoundTextureId;
|
||||||
|
private int previousDepthFunc;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//============//
|
//============//
|
||||||
@@ -113,6 +118,11 @@ public class GlDhMetaRenderer implements IDhMetaRenderer
|
|||||||
DhApiRenderParam renderEventParam,
|
DhApiRenderParam renderEventParam,
|
||||||
boolean firstPass)
|
boolean firstPass)
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
this.previousBoundTextureId = GLMC.getActiveTexture();
|
||||||
|
this.previousDepthFunc = GLMC.getActiveDepthFunc();
|
||||||
|
#endif
|
||||||
|
|
||||||
//===================//
|
//===================//
|
||||||
// framebuffer setup //
|
// framebuffer setup //
|
||||||
//===================//
|
//===================//
|
||||||
@@ -357,7 +367,9 @@ public class GlDhMetaRenderer implements IDhMetaRenderer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
GLMC.glDepthFunc(previousDepthFunc);
|
||||||
|
#endif
|
||||||
this.unbindLightmap();
|
this.unbindLightmap();
|
||||||
this.shaderProgramForThisFrame.unbind();
|
this.shaderProgramForThisFrame.unbind();
|
||||||
}
|
}
|
||||||
@@ -456,7 +468,11 @@ public class GlDhMetaRenderer implements IDhMetaRenderer
|
|||||||
public void unbindLightmap()
|
public void unbindLightmap()
|
||||||
{
|
{
|
||||||
// strange that we don't call "glActiveTexture" here but since it's working James isn't going to change it right now (2026-03-10)
|
// strange that we don't call "glActiveTexture" here but since it's working James isn't going to change it right now (2026-03-10)
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
GLMC.glBindTexture(previousBoundTextureId);
|
||||||
|
#else
|
||||||
GLMC.glBindTexture(0);
|
GLMC.glBindTexture(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ public class GlDhRenderApiDefinition extends AbstractDhRenderApiDefinition
|
|||||||
//=========//
|
//=========//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
public String getApiName() { return "OpenGL"; }
|
public String getEngineName() { return "OpenGL"; }
|
||||||
|
|
||||||
public EDhRenderDepth getRenderDepth()
|
public EDhRenderDepth getRenderDepth()
|
||||||
{
|
{
|
||||||
|
|||||||
+10
-12
@@ -45,7 +45,7 @@ import com.seibel.distanthorizons.core.render.renderer.RenderableBoxGroup;
|
|||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhGenericRenderer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhGenericRenderer;
|
||||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.OverrideInjector;
|
import com.seibel.distanthorizons.coreapi.DependencyInjection.OverrideInjector;
|
||||||
@@ -53,10 +53,10 @@ import com.seibel.distanthorizons.coreapi.ModInfo;
|
|||||||
import org.lwjgl.opengl.ARBInstancedArrays;
|
import org.lwjgl.opengl.ARBInstancedArrays;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
import org.lwjgl.opengl.GL33;
|
import org.lwjgl.opengl.GL33;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@@ -226,22 +226,22 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
private void createBuffers()
|
private void createBuffers()
|
||||||
{
|
{
|
||||||
// box vertices
|
// box vertices
|
||||||
ByteBuffer boxVerticesBuffer = MemoryUtil.memAlloc(BOX_VERTICES.length * Float.BYTES);
|
ByteBuffer boxVerticesBuffer = ByteBuffer.allocateDirect(BOX_VERTICES.length * Float.BYTES);
|
||||||
|
boxVerticesBuffer.order(ByteOrder.nativeOrder());
|
||||||
boxVerticesBuffer.asFloatBuffer().put(BOX_VERTICES);
|
boxVerticesBuffer.asFloatBuffer().put(BOX_VERTICES);
|
||||||
boxVerticesBuffer.rewind();
|
boxVerticesBuffer.rewind();
|
||||||
this.boxVertexBuffer = new GLVertexBuffer(false);
|
this.boxVertexBuffer = new GLVertexBuffer(false);
|
||||||
this.boxVertexBuffer.bind();
|
this.boxVertexBuffer.bind();
|
||||||
this.boxVertexBuffer.uploadBuffer(boxVerticesBuffer, 8, EDhApiGpuUploadMethod.DATA, BOX_VERTICES.length * Float.BYTES);
|
this.boxVertexBuffer.uploadBuffer(boxVerticesBuffer, 8, EDhApiGpuUploadMethod.DATA, BOX_VERTICES.length * Float.BYTES);
|
||||||
MemoryUtil.memFree(boxVerticesBuffer);
|
|
||||||
|
|
||||||
// box vertex indexes
|
// box vertex indexes
|
||||||
ByteBuffer solidIndexBuffer = MemoryUtil.memAlloc(BOX_INDICES.length * Integer.BYTES);
|
ByteBuffer solidIndexBuffer = ByteBuffer.allocateDirect(BOX_INDICES.length * Integer.BYTES);
|
||||||
|
solidIndexBuffer.order(ByteOrder.nativeOrder());
|
||||||
solidIndexBuffer.asIntBuffer().put(BOX_INDICES);
|
solidIndexBuffer.asIntBuffer().put(BOX_INDICES);
|
||||||
solidIndexBuffer.rewind();
|
solidIndexBuffer.rewind();
|
||||||
this.boxIndexBuffer = new GLIndexBuffer(false);
|
this.boxIndexBuffer = new GLIndexBuffer(false);
|
||||||
this.boxIndexBuffer.uploadBuffer(solidIndexBuffer, EDhApiGpuUploadMethod.DATA, BOX_INDICES.length * Integer.BYTES, GL32.GL_STATIC_DRAW);
|
this.boxIndexBuffer.uploadBuffer(solidIndexBuffer, EDhApiGpuUploadMethod.DATA, BOX_INDICES.length * Integer.BYTES, GL32.GL_STATIC_DRAW);
|
||||||
this.boxIndexBuffer.bind();
|
this.boxIndexBuffer.bind();
|
||||||
MemoryUtil.memFree(solidIndexBuffer);
|
|
||||||
}
|
}
|
||||||
private void addGenericDebugObjects()
|
private void addGenericDebugObjects()
|
||||||
{
|
{
|
||||||
@@ -450,8 +450,6 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
|
|
||||||
this.boxIndexBuffer.bind();
|
this.boxIndexBuffer.bind();
|
||||||
|
|
||||||
Vec3d camPos = MC_RENDER.getCameraExactPosition();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// rendering //
|
// rendering //
|
||||||
@@ -512,11 +510,11 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
{
|
{
|
||||||
if (this.instancedRenderingAvailable)
|
if (this.instancedRenderingAvailable)
|
||||||
{
|
{
|
||||||
this.renderBoxGroupInstanced(shaderProgram, renderEventParam, boxGroup, camPos, profiler);
|
this.renderBoxGroupInstanced(shaderProgram, renderEventParam, boxGroup, renderEventParam.exactCameraPosition, profiler);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.renderBoxGroupDirect(shaderProgram, renderEventParam, boxGroup, camPos, profiler);
|
this.renderBoxGroupDirect(shaderProgram, renderEventParam, boxGroup, renderEventParam.exactCameraPosition, profiler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,7 +553,7 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
|
|
||||||
private void renderBoxGroupInstanced(
|
private void renderBoxGroupInstanced(
|
||||||
IDhApiGenericObjectShaderProgram shaderProgram, DhApiRenderParam renderEventParam,
|
IDhApiGenericObjectShaderProgram shaderProgram, DhApiRenderParam renderEventParam,
|
||||||
RenderableBoxGroup boxGroup, Vec3d camPos,
|
RenderableBoxGroup boxGroup, DhVec3d camPos,
|
||||||
IProfilerWrapper profiler)
|
IProfilerWrapper profiler)
|
||||||
{
|
{
|
||||||
try (IProfilerWrapper.IProfileBlock render_profile = profiler.push("vertex setup"))
|
try (IProfilerWrapper.IProfileBlock render_profile = profiler.push("vertex setup"))
|
||||||
@@ -656,7 +654,7 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
private void renderBoxGroupDirect(
|
private void renderBoxGroupDirect(
|
||||||
IDhApiGenericObjectShaderProgram shaderProgram,
|
IDhApiGenericObjectShaderProgram shaderProgram,
|
||||||
DhApiRenderParam renderEventParam,
|
DhApiRenderParam renderEventParam,
|
||||||
RenderableBoxGroup boxGroup, Vec3d camPos,
|
RenderableBoxGroup boxGroup, DhVec3d camPos,
|
||||||
IProfilerWrapper profiler)
|
IProfilerWrapper profiler)
|
||||||
{
|
{
|
||||||
profiler.popPush("shared uniforms");
|
profiler.popPush("shared uniforms");
|
||||||
|
|||||||
+8
-8
@@ -12,8 +12,8 @@ import com.seibel.distanthorizons.common.render.openGl.glObject.vertexAttribute.
|
|||||||
import com.seibel.distanthorizons.common.render.openGl.glObject.vertexAttribute.GlVertexPointer;
|
import com.seibel.distanthorizons.common.render.openGl.glObject.vertexAttribute.GlVertexPointer;
|
||||||
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
|
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
|
||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
import com.seibel.distanthorizons.core.util.math.DhVec3f;
|
||||||
|
|
||||||
public class GlGenericObjectShaderProgram extends GlShaderProgram implements IDhApiGenericObjectShaderProgram
|
public class GlGenericObjectShaderProgram extends GlShaderProgram implements IDhApiGenericObjectShaderProgram
|
||||||
{
|
{
|
||||||
@@ -123,7 +123,7 @@ public class GlGenericObjectShaderProgram extends GlShaderProgram implements IDh
|
|||||||
DhApiVec3d camPos
|
DhApiVec3d camPos
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Mat4f projectionMvmMatrix = new Mat4f(renderParameters.dhProjectionMatrix);
|
DhMat4f projectionMvmMatrix = new DhMat4f(renderParameters.dhProjectionMatrix);
|
||||||
projectionMvmMatrix.multiply(renderParameters.dhModelViewMatrix);
|
projectionMvmMatrix.multiply(renderParameters.dhModelViewMatrix);
|
||||||
|
|
||||||
super.bind();
|
super.bind();
|
||||||
@@ -138,7 +138,7 @@ public class GlGenericObjectShaderProgram extends GlShaderProgram implements IDh
|
|||||||
LodUtil.getChunkPosFromDouble(boxGroup.getOriginBlockPos().z)
|
LodUtil.getChunkPosFromDouble(boxGroup.getOriginBlockPos().z)
|
||||||
));
|
));
|
||||||
this.setUniform(this.instancedShaderOffsetSubChunkUniform,
|
this.setUniform(this.instancedShaderOffsetSubChunkUniform,
|
||||||
new Vec3f(
|
new DhVec3f(
|
||||||
LodUtil.getSubChunkPosFromDouble(boxGroup.getOriginBlockPos().x),
|
LodUtil.getSubChunkPosFromDouble(boxGroup.getOriginBlockPos().x),
|
||||||
LodUtil.getSubChunkPosFromDouble(boxGroup.getOriginBlockPos().y),
|
LodUtil.getSubChunkPosFromDouble(boxGroup.getOriginBlockPos().y),
|
||||||
LodUtil.getSubChunkPosFromDouble(boxGroup.getOriginBlockPos().z)
|
LodUtil.getSubChunkPosFromDouble(boxGroup.getOriginBlockPos().z)
|
||||||
@@ -151,7 +151,7 @@ public class GlGenericObjectShaderProgram extends GlShaderProgram implements IDh
|
|||||||
LodUtil.getChunkPosFromDouble(camPos.z)
|
LodUtil.getChunkPosFromDouble(camPos.z)
|
||||||
));
|
));
|
||||||
this.setUniform(this.instancedShaderCameraSubChunkPosUniform,
|
this.setUniform(this.instancedShaderCameraSubChunkPosUniform,
|
||||||
new Vec3f(
|
new DhVec3f(
|
||||||
LodUtil.getSubChunkPosFromDouble(camPos.x),
|
LodUtil.getSubChunkPosFromDouble(camPos.x),
|
||||||
LodUtil.getSubChunkPosFromDouble(camPos.y),
|
LodUtil.getSubChunkPosFromDouble(camPos.y),
|
||||||
LodUtil.getSubChunkPosFromDouble(camPos.z)
|
LodUtil.getSubChunkPosFromDouble(camPos.z)
|
||||||
@@ -201,14 +201,14 @@ public class GlGenericObjectShaderProgram extends GlShaderProgram implements IDh
|
|||||||
IDhApiRenderableBoxGroup boxGroup, DhApiRenderableBox box,
|
IDhApiRenderableBoxGroup boxGroup, DhApiRenderableBox box,
|
||||||
DhApiVec3d camPos)
|
DhApiVec3d camPos)
|
||||||
{
|
{
|
||||||
Mat4f projectionMvmMatrix = new Mat4f(renderParameters.dhProjectionMatrix);
|
DhMat4f projectionMvmMatrix = new DhMat4f(renderParameters.dhProjectionMatrix);
|
||||||
projectionMvmMatrix.multiply(renderParameters.dhModelViewMatrix);
|
projectionMvmMatrix.multiply(renderParameters.dhModelViewMatrix);
|
||||||
|
|
||||||
Mat4f boxTransform = Mat4f.createTranslateMatrix(
|
DhMat4f boxTransform = DhMat4f.createTranslateMatrix(
|
||||||
(float) (box.minPos.x + boxGroup.getOriginBlockPos().x - camPos.x),
|
(float) (box.minPos.x + boxGroup.getOriginBlockPos().x - camPos.x),
|
||||||
(float) (box.minPos.y + boxGroup.getOriginBlockPos().y - camPos.y),
|
(float) (box.minPos.y + boxGroup.getOriginBlockPos().y - camPos.y),
|
||||||
(float) (box.minPos.z + boxGroup.getOriginBlockPos().z - camPos.z));
|
(float) (box.minPos.z + boxGroup.getOriginBlockPos().z - camPos.z));
|
||||||
boxTransform.multiply(Mat4f.createScaleMatrix(
|
boxTransform.multiply(DhMat4f.createScaleMatrix(
|
||||||
(float) (box.maxPos.x - box.minPos.x),
|
(float) (box.maxPos.x - box.minPos.x),
|
||||||
(float) (box.maxPos.y - box.minPos.y),
|
(float) (box.maxPos.y - box.minPos.y),
|
||||||
(float) (box.maxPos.z - box.minPos.z)));
|
(float) (box.maxPos.z - box.minPos.z)));
|
||||||
|
|||||||
-2
@@ -31,7 +31,6 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.IVertexB
|
|||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiGpuUploadMethod;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiGpuUploadMethod;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a container for a OpenGL
|
* This is a container for a OpenGL
|
||||||
@@ -87,7 +86,6 @@ public class GLVertexBuffer extends GLBuffer implements IVertexBufferWrapper
|
|||||||
|
|
||||||
ByteBuffer buffer = IndexBufferBuilder.createBuffer(maxQuadCount);
|
ByteBuffer buffer = IndexBufferBuilder.createBuffer(maxQuadCount);
|
||||||
GLOBAL_QUAD_IBO.upload(buffer, maxQuadCount);
|
GLOBAL_QUAD_IBO.upload(buffer, maxQuadCount);
|
||||||
MemoryUtil.memFree(buffer);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -21,11 +21,9 @@ package com.seibel.distanthorizons.common.render.openGl.glObject.buffer;
|
|||||||
|
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiGpuUploadMethod;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiGpuUploadMethod;
|
||||||
import com.seibel.distanthorizons.common.render.openGl.glObject.enums.GLEnums;
|
import com.seibel.distanthorizons.common.render.openGl.glObject.enums.GLEnums;
|
||||||
import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.IndexBufferBuilder;
|
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -27,8 +27,8 @@ import com.seibel.distanthorizons.api.objects.math.DhApiVec3i;
|
|||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
import org.lwjgl.system.MemoryStack;
|
import org.lwjgl.system.MemoryStack;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
import com.seibel.distanthorizons.core.util.math.DhVec3f;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -182,9 +182,9 @@ public class GlShaderProgram
|
|||||||
public void trySetUniform(int location, float value) { if (location != -1) { this.setUniform(location, value); } }
|
public void trySetUniform(int location, float value) { if (location != -1) { this.setUniform(location, value); } }
|
||||||
|
|
||||||
/** Requires a bound ShaderProgram. */
|
/** Requires a bound ShaderProgram. */
|
||||||
public void setUniform(int location, Vec3f value) { GL32.glUniform3f(location, value.x, value.y, value.z); }
|
public void setUniform(int location, DhVec3f value) { GL32.glUniform3f(location, value.x, value.y, value.z); }
|
||||||
/** @see GlShaderProgram#setUniform(int, Vec3f) */
|
/** @see GlShaderProgram#setUniform(int, DhVec3f) */
|
||||||
public void trySetUniform(int location, Vec3f value) { if (location != -1) { this.setUniform(location, value); } }
|
public void trySetUniform(int location, DhVec3f value) { if (location != -1) { this.setUniform(location, value); } }
|
||||||
|
|
||||||
/** Requires a bound ShaderProgram. */
|
/** Requires a bound ShaderProgram. */
|
||||||
public void setUniform(int location, DhApiVec3i value) { GL32.glUniform3i(location, value.x, value.y, value.z); }
|
public void setUniform(int location, DhApiVec3i value) { GL32.glUniform3i(location, value.x, value.y, value.z); }
|
||||||
@@ -226,7 +226,7 @@ public class GlShaderProgram
|
|||||||
private static int bufferIndex(int xIndex, int zIndex) { return (zIndex * 4) + xIndex; }
|
private static int bufferIndex(int xIndex, int zIndex) { return (zIndex * 4) + xIndex; }
|
||||||
|
|
||||||
/** @see GlShaderProgram#setUniform(int, DhApiMat4f) */
|
/** @see GlShaderProgram#setUniform(int, DhApiMat4f) */
|
||||||
public void trySetUniform(int location, Mat4f value) { if (location != -1) { this.setUniform(location, value); } }
|
public void trySetUniform(int location, DhMat4f value) { if (location != -1) { this.setUniform(location, value); } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the color's RGBA values into values between 0 and 1. <br>
|
* Converts the color's RGBA values into values between 0 and 1. <br>
|
||||||
|
|||||||
+3
-3
@@ -24,9 +24,9 @@ import com.seibel.distanthorizons.common.render.openGl.glObject.buffer.GLVertexB
|
|||||||
import com.seibel.distanthorizons.common.render.openGl.glObject.vertexAttribute.GlAbstractVertexAttribute;
|
import com.seibel.distanthorizons.common.render.openGl.glObject.vertexAttribute.GlAbstractVertexAttribute;
|
||||||
import com.seibel.distanthorizons.common.render.openGl.glObject.vertexAttribute.GlVertexPointer;
|
import com.seibel.distanthorizons.common.render.openGl.glObject.vertexAttribute.GlVertexPointer;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a full-screen textured quad to the screen.
|
* Renders a full-screen textured quad to the screen.
|
||||||
@@ -76,14 +76,14 @@ public class GlScreenQuad
|
|||||||
}
|
}
|
||||||
private void createBuffer()
|
private void createBuffer()
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = MemoryUtil.memAlloc(BOX_VERTICES.length * Float.BYTES);
|
ByteBuffer buffer = ByteBuffer.allocateDirect(BOX_VERTICES.length * Float.BYTES);
|
||||||
|
buffer.order(ByteOrder.nativeOrder());
|
||||||
buffer.asFloatBuffer().put(BOX_VERTICES);
|
buffer.asFloatBuffer().put(BOX_VERTICES);
|
||||||
buffer.rewind();
|
buffer.rewind();
|
||||||
|
|
||||||
this.boxBuffer = new GLVertexBuffer(false);
|
this.boxBuffer = new GLVertexBuffer(false);
|
||||||
this.boxBuffer.bind();
|
this.boxBuffer.bind();
|
||||||
this.boxBuffer.uploadBuffer(buffer, BOX_VERTICES.length, EDhApiGpuUploadMethod.DATA, BOX_VERTICES.length * Float.BYTES);
|
this.boxBuffer.uploadBuffer(buffer, BOX_VERTICES.length, EDhApiGpuUploadMethod.DATA, BOX_VERTICES.length * Float.BYTES);
|
||||||
MemoryUtil.memFree(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
-1
@@ -28,7 +28,6 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|||||||
import com.seibel.distanthorizons.common.render.openGl.util.GlAbstractShaderRenderer;
|
import com.seibel.distanthorizons.common.render.openGl.util.GlAbstractShaderRenderer;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
|
|||||||
-1
@@ -29,7 +29,6 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|||||||
import com.seibel.distanthorizons.common.render.openGl.util.GlAbstractShaderRenderer;
|
import com.seibel.distanthorizons.common.render.openGl.util.GlAbstractShaderRenderer;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
|
|||||||
+5
-7
@@ -33,7 +33,7 @@ import com.seibel.distanthorizons.common.render.openGl.util.GlAbstractShaderRend
|
|||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
@@ -41,14 +41,12 @@ public class GlDhFogShader extends GlAbstractShaderRenderer
|
|||||||
{
|
{
|
||||||
public static final GlDhFogShader INSTANCE = new GlDhFogShader();
|
public static final GlDhFogShader INSTANCE = new GlDhFogShader();
|
||||||
|
|
||||||
private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
private static final MinecraftGLWrapper GLMC = MinecraftGLWrapper.INSTANCE;
|
private static final MinecraftGLWrapper GLMC = MinecraftGLWrapper.INSTANCE;
|
||||||
private static final IMinecraftRenderWrapper MC_RENDER = SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int frameBuffer;
|
public int frameBuffer;
|
||||||
private Mat4f inverseMvmProjMatrix;
|
private DhMat4f inverseMvmProjMatrix;
|
||||||
private DhApiFogRenderParam fogRenderParams;
|
private DhApiFogRenderParam fogRenderParams;
|
||||||
|
|
||||||
|
|
||||||
@@ -172,7 +170,7 @@ public class GlDhFogShader extends GlAbstractShaderRenderer
|
|||||||
// Fog uniforms
|
// Fog uniforms
|
||||||
this.shader.setUniform(this.uFogColor, this.fogRenderParams.getFogColor());
|
this.shader.setUniform(this.uFogColor, this.fogRenderParams.getFogColor());
|
||||||
this.shader.setUniform(this.uFogScale, 1.f / lodDrawDistance);
|
this.shader.setUniform(this.uFogScale, 1.f / lodDrawDistance);
|
||||||
this.shader.setUniform(this.uFogVerticalScale, 1.f / MC.getWrappedClientLevel().getMaxHeight());
|
this.shader.setUniform(this.uFogVerticalScale, 1.f / renderParams.clientLevelWrapper.getMaxHeight());
|
||||||
this.shader.setUniform(this.uFogDebugMode, 0); // 0 = normal // 1 = render everything with fog color // 7 = use debug rendering
|
this.shader.setUniform(this.uFogDebugMode, 0); // 0 = normal // 1 = render everything with fog color // 7 = use debug rendering
|
||||||
this.shader.setUniform(this.uFogFalloffType, this.fogRenderParams.getFarFogFalloff().value);
|
this.shader.setUniform(this.uFogFalloffType, this.fogRenderParams.getFarFogFalloff().value);
|
||||||
|
|
||||||
@@ -208,13 +206,13 @@ public class GlDhFogShader extends GlAbstractShaderRenderer
|
|||||||
this.shader.setUniform(this.uHeightFogAppliesDown, heightFogDirection.fogAppliesDown);
|
this.shader.setUniform(this.uHeightFogAppliesDown, heightFogDirection.fogAppliesDown);
|
||||||
this.shader.setUniform(this.uUseSphericalFog, useSphericalFog);
|
this.shader.setUniform(this.uUseSphericalFog, useSphericalFog);
|
||||||
this.shader.setUniform(this.uHeightFogMixingMode, heightFogMixingMode.value);
|
this.shader.setUniform(this.uHeightFogMixingMode, heightFogMixingMode.value);
|
||||||
this.shader.setUniform(this.uCameraBlockYPos, (float)MC_RENDER.getCameraExactPosition().y);
|
this.shader.setUniform(this.uCameraBlockYPos, (float)renderParams.exactCameraPosition.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepUniformObjects(DhApiMat4f modelViewProjectionMatrix, DhApiFogRenderParam fogRenderParams)
|
public void prepUniformObjects(DhApiMat4f modelViewProjectionMatrix, DhApiFogRenderParam fogRenderParams)
|
||||||
{
|
{
|
||||||
this.inverseMvmProjMatrix = new Mat4f(modelViewProjectionMatrix);
|
this.inverseMvmProjMatrix = new DhMat4f(modelViewProjectionMatrix);
|
||||||
this.inverseMvmProjMatrix.invert();
|
this.inverseMvmProjMatrix.invert();
|
||||||
|
|
||||||
this.fogRenderParams = fogRenderParams;
|
this.fogRenderParams = fogRenderParams;
|
||||||
|
|||||||
+5
-5
@@ -26,7 +26,7 @@ import com.seibel.distanthorizons.common.render.openGl.postProcessing.GlScreenQu
|
|||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
||||||
import com.seibel.distanthorizons.common.render.openGl.util.GlAbstractShaderRenderer;
|
import com.seibel.distanthorizons.common.render.openGl.util.GlAbstractShaderRenderer;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,8 +45,8 @@ public class GlDhSSAOShader extends GlAbstractShaderRenderer
|
|||||||
|
|
||||||
public int frameBuffer;
|
public int frameBuffer;
|
||||||
|
|
||||||
private Mat4f projection;
|
private DhMat4f projection;
|
||||||
private Mat4f invertedProjection;
|
private DhMat4f invertedProjection;
|
||||||
|
|
||||||
|
|
||||||
// uniforms
|
// uniforms
|
||||||
@@ -95,9 +95,9 @@ public class GlDhSSAOShader extends GlAbstractShaderRenderer
|
|||||||
|
|
||||||
public void setProjectionMatrix(DhApiMat4f projectionMatrix)
|
public void setProjectionMatrix(DhApiMat4f projectionMatrix)
|
||||||
{
|
{
|
||||||
this.projection = new Mat4f(projectionMatrix);
|
this.projection = new DhMat4f(projectionMatrix);
|
||||||
|
|
||||||
this.invertedProjection = new Mat4f(projectionMatrix);
|
this.invertedProjection = new DhMat4f(projectionMatrix);
|
||||||
this.invertedProjection.invert();
|
this.invertedProjection.invert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-7
@@ -23,9 +23,9 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
|
|||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
import com.seibel.distanthorizons.core.util.math.DhVec3f;
|
||||||
import com.seibel.distanthorizons.core.util.objects.SortedArraySet;
|
import com.seibel.distanthorizons.core.util.objects.SortedArraySet;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
||||||
@@ -46,7 +46,7 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
private static final MinecraftGLWrapper GLMC = MinecraftGLWrapper.INSTANCE;
|
private static final MinecraftGLWrapper GLMC = MinecraftGLWrapper.INSTANCE;
|
||||||
private static final IIrisAccessor IRIS_ACCESSOR = ModAccessorInjector.INSTANCE.get(IIrisAccessor.class);
|
private static final IIrisAccessor IRIS_ACCESSOR = ModAccessorInjector.INSTANCE.get(IIrisAccessor.class);
|
||||||
|
|
||||||
private static final Vec3f MODEL_POS = new Vec3f();
|
private static final DhVec3f MODEL_POS = new DhVec3f();
|
||||||
/** single event object used to reduce GC pressure */
|
/** single event object used to reduce GC pressure */
|
||||||
private static final DhApiBeforeBufferRenderEvent.EventParam BEFORE_BUFFER_RENDER_EVENT_PARAM = new DhApiBeforeBufferRenderEvent.EventParam();
|
private static final DhApiBeforeBufferRenderEvent.EventParam BEFORE_BUFFER_RENDER_EVENT_PARAM = new DhApiBeforeBufferRenderEvent.EventParam();
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
@Override
|
@Override
|
||||||
public void fillUniformData(DhApiRenderParam renderParameters)
|
public void fillUniformData(DhApiRenderParam renderParameters)
|
||||||
{
|
{
|
||||||
Mat4f combinedMatrix = new Mat4f(renderParameters.dhProjectionMatrix);
|
DhMat4f combinedMatrix = new DhMat4f(renderParameters.dhProjectionMatrix);
|
||||||
combinedMatrix.multiply(renderParameters.dhModelViewMatrix);
|
combinedMatrix.multiply(renderParameters.dhModelViewMatrix);
|
||||||
|
|
||||||
super.bind();
|
super.bind();
|
||||||
@@ -246,7 +246,7 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setModelOffsetPos(DhApiVec3f modelOffsetPos) { this.setUniform(this.uModelOffset, new Vec3f(modelOffsetPos)); }
|
public void setModelOffsetPos(DhApiVec3f modelOffsetPos) { this.setUniform(this.uModelOffset, new DhVec3f(modelOffsetPos)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getId() { return this.id; }
|
public int getId() { return this.id; }
|
||||||
@@ -294,6 +294,10 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
GLMC.disableBlend();
|
GLMC.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// needs to be explicitly called since Iris may disable color rendering and not re-enable it
|
||||||
|
// when boats are rendered in the scene (due to rendering out water inside the boat)
|
||||||
|
GL32.glColorMask(true, true, true, true);
|
||||||
|
|
||||||
// needs to be triggered after DH attempts to set the GL state so that Iris
|
// needs to be triggered after DH attempts to set the GL state so that Iris
|
||||||
// can override it as needed
|
// can override it as needed
|
||||||
ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeRenderPassEvent.class, renderEventParam.apiCopy);
|
ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeRenderPassEvent.class, renderEventParam.apiCopy);
|
||||||
@@ -328,7 +332,7 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
|
|
||||||
// set uniforms and fire events
|
// set uniforms and fire events
|
||||||
{
|
{
|
||||||
Vec3d camPos = renderEventParam.exactCameraPosition;
|
DhVec3d camPos = renderEventParam.exactCameraPosition;
|
||||||
MODEL_POS.set(
|
MODEL_POS.set(
|
||||||
(float) (bufferContainer.minCornerBlockPos.getX() - camPos.x),
|
(float) (bufferContainer.minCornerBlockPos.getX() - camPos.x),
|
||||||
(float) (bufferContainer.minCornerBlockPos.getY() - camPos.y),
|
(float) (bufferContainer.minCornerBlockPos.getY() - camPos.y),
|
||||||
|
|||||||
+4
-4
@@ -66,7 +66,7 @@ public class DependencySetup
|
|||||||
SingletonInjector.INSTANCE.bind(ILangWrapper.class, LangWrapper.INSTANCE);
|
SingletonInjector.INSTANCE.bind(ILangWrapper.class, LangWrapper.INSTANCE);
|
||||||
SingletonInjector.INSTANCE.bind(IVersionConstants.class, VersionConstants.INSTANCE);
|
SingletonInjector.INSTANCE.bind(IVersionConstants.class, VersionConstants.INSTANCE);
|
||||||
SingletonInjector.INSTANCE.bind(IWrapperFactory.class, WrapperFactory.INSTANCE);
|
SingletonInjector.INSTANCE.bind(IWrapperFactory.class, WrapperFactory.INSTANCE);
|
||||||
SingletonInjector.INSTANCE.bind(IKeyedClientLevelManager.class, KeyedClientLevelManager.INSTANCE);
|
SingletonInjector.INSTANCE.bind(IKeyedClientLevelManager.class, new KeyedClientLevelManager());
|
||||||
SingletonInjector.INSTANCE.bind(IDhApiCustomRenderObjectFactory.class, GenericRenderObjectFactory.INSTANCE);
|
SingletonInjector.INSTANCE.bind(IDhApiCustomRenderObjectFactory.class, GenericRenderObjectFactory.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ public class DependencySetup
|
|||||||
// crash if an invalid API is set
|
// crash if an invalid API is set
|
||||||
if (!validApi)
|
if (!validApi)
|
||||||
{
|
{
|
||||||
String message = "["+renderingApiEnum+"] is not supported on this version of Minecraft, reverting to ["+ EDhApiRenderingEngine.AUTO+"].";
|
String message = "The Distant Horizons rendering engine ["+renderDefinition.getEngineName()+"]-["+renderingApiEnum+"] is not supported with this Minecraft config, reverting to ["+ EDhApiRenderingEngine.AUTO+"].";
|
||||||
LOGGER.fatal(message);
|
LOGGER.fatal(message);
|
||||||
Config.Client.Advanced.Graphics.Experimental.renderingEngine.set(EDhApiRenderingEngine.AUTO);
|
Config.Client.Advanced.Graphics.Experimental.renderingEngine.set(EDhApiRenderingEngine.AUTO);
|
||||||
throw new IllegalStateException(message);
|
throw new IllegalStateException(message);
|
||||||
@@ -144,14 +144,14 @@ public class DependencySetup
|
|||||||
EDhApiRenderingApi mcRenderApi = MinecraftRenderWrapper.INSTANCE.getMcRenderingApi();
|
EDhApiRenderingApi mcRenderApi = MinecraftRenderWrapper.INSTANCE.getMcRenderingApi();
|
||||||
if (mcRenderApi != renderDefinition.getRenderApi())
|
if (mcRenderApi != renderDefinition.getRenderApi())
|
||||||
{
|
{
|
||||||
String message = "["+renderDefinition.getApiName()+"] cannot be used due to it's API ["+renderDefinition.getRenderApi().name()+"] not matching what Minecraft is currently set to use. Please either change Minecraft's rendering API or Distant Horizons'.";
|
String message = "The Distant Horizons rendering engine ["+renderDefinition.getEngineName()+"]-["+renderDefinition.getRenderApi().name()+"] cannot be used since it's API doesn't match what Minecraft is currently set to use ["+mcRenderApi.name()+"]. Please either change Minecraft's rendering API or Distant Horizons'.";
|
||||||
LOGGER.fatal(message);
|
LOGGER.fatal(message);
|
||||||
throw new IllegalStateException(message);
|
throw new IllegalStateException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
renderDefinition.bindRenderers();
|
renderDefinition.bindRenderers();
|
||||||
LOGGER.info("DH Rendering successfully bound to: ["+renderDefinition.getApiName()+"]...");
|
LOGGER.info("DH Rendering successfully bound to: ["+renderDefinition.getEngineName()+"]...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -24,7 +24,7 @@ import java.nio.FloatBuffer;
|
|||||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -53,7 +53,7 @@ public class McObjectConverter
|
|||||||
//region
|
//region
|
||||||
|
|
||||||
/** 4x4 float matrix converter */
|
/** 4x4 float matrix converter */
|
||||||
public static Mat4f Convert(
|
public static DhMat4f Convert(
|
||||||
#if MC_VER <= MC_1_12_2 org.joml.Matrix4f
|
#if MC_VER <= MC_1_12_2 org.joml.Matrix4f
|
||||||
#elif MC_VER < MC_1_19_4 com.mojang.math.Matrix4f
|
#elif MC_VER < MC_1_19_4 com.mojang.math.Matrix4f
|
||||||
#elif MC_VER < MC_1_21_6 org.joml.Matrix4f
|
#elif MC_VER < MC_1_21_6 org.joml.Matrix4f
|
||||||
@@ -63,7 +63,7 @@ public class McObjectConverter
|
|||||||
{
|
{
|
||||||
FloatBuffer buffer = FloatBuffer.allocate(16);
|
FloatBuffer buffer = FloatBuffer.allocate(16);
|
||||||
storeMatrix(mcMatrix, buffer);
|
storeMatrix(mcMatrix, buffer);
|
||||||
Mat4f matrix = new Mat4f(buffer);
|
DhMat4f matrix = new DhMat4f(buffer);
|
||||||
#if MC_VER > MC_1_12_2 && MC_VER < MC_1_19_4
|
#if MC_VER > MC_1_12_2 && MC_VER < MC_1_19_4
|
||||||
matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it
|
matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+37
@@ -319,8 +319,11 @@ public class ClientBlockStateColorCache
|
|||||||
// (i.e. AIR is somehow passed in)
|
// (i.e. AIR is somehow passed in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return for the first valid direction we find
|
||||||
if (quads != null
|
if (quads != null
|
||||||
&& !quads.isEmpty()
|
&& !quads.isEmpty()
|
||||||
|
// for rotated blocks (ie logs) we want the side instead of the top,
|
||||||
|
// so logs use their bark side instead of their cut/inner side
|
||||||
&& !(
|
&& !(
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
this.blockState.getBlock() instanceof BlockRotatedPillar
|
this.blockState.getBlock() instanceof BlockRotatedPillar
|
||||||
@@ -466,6 +469,13 @@ public class ClientBlockStateColorCache
|
|||||||
BlockState effectiveBlockState = this.blockState;
|
BlockState effectiveBlockState = this.blockState;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//=========================//
|
||||||
|
// specific state handling //
|
||||||
|
//=========================//
|
||||||
|
//region
|
||||||
|
|
||||||
// if this block is a slab, use it's double variant so we can get the top face,
|
// if this block is a slab, use it's double variant so we can get the top face,
|
||||||
// otherwise the color will use the side, which isn't as accurate
|
// otherwise the color will use the side, which isn't as accurate
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
@@ -480,6 +490,31 @@ public class ClientBlockStateColorCache
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// huge mushroom block sides will show the inner color,
|
||||||
|
// which isn't what you want to see at a distance,
|
||||||
|
// you want to see the primary color (ie red for red mushrooms)
|
||||||
|
// which is shown on all sides for the default state
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
if (this.blockState.getBlock() instanceof BlockHugeMushroom)
|
||||||
|
{
|
||||||
|
effectiveBlockState = this.blockState.getBlock().getDefaultState();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (this.blockState.getBlock() instanceof HugeMushroomBlock)
|
||||||
|
{
|
||||||
|
effectiveBlockState = this.blockState.getBlock().defaultBlockState();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//===============//
|
||||||
|
// quad handling //
|
||||||
|
//===============//
|
||||||
|
//region
|
||||||
|
|
||||||
List<BakedQuad> quads;
|
List<BakedQuad> quads;
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
@@ -519,6 +554,8 @@ public class ClientBlockStateColorCache
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
return quads;
|
return quads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-7
@@ -731,16 +731,25 @@ public class ChunkWrapper implements IChunkWrapper
|
|||||||
|
|
||||||
//1.12.2 doesn't store lights we must bruteforce it
|
//1.12.2 doesn't store lights we must bruteforce it
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
for (int x = 0; x < 16; x++)
|
for (ExtendedBlockStorage section : this.chunk.getBlockStorageArray()) {
|
||||||
{
|
if (section == null || section.isEmpty())
|
||||||
for (int z = 0; z < 16; z++)
|
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 256; y++)
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int baseY = section.getYLocation();
|
||||||
|
|
||||||
|
for (int x = 0; x < 16; x++)
|
||||||
|
{
|
||||||
|
for (int z = 0; z < 16; z++)
|
||||||
{
|
{
|
||||||
IBlockState blockState = this.chunk.getBlockState(x, y, z);
|
for (int y = 0; y < 16; y++)
|
||||||
if (blockState.getLightValue() > 0)
|
|
||||||
{
|
{
|
||||||
this.blockLightPosList.add(new DhBlockPos(this.chunk.getPos().getXStart() + x, y, this.chunk.getPos().getZStart() + z));
|
IBlockState blockState = section.get(x, y, z);
|
||||||
|
if (blockState.getLightValue() > 0)
|
||||||
|
{
|
||||||
|
this.blockLightPosList.add(new DhBlockPos(this.chunk.getPos().getXStart() + x, baseY + y, this.chunk.getPos().getZStart() + z));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.gui;
|
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
#else
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
#endif
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -12,7 +16,11 @@ public class DhScreenUtil
|
|||||||
//================//
|
//================//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public static void setScreen(GuiScreen screen)
|
||||||
|
#else
|
||||||
public static void setScreen(Screen screen)
|
public static void setScreen(Screen screen)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
Objects.requireNonNull(Minecraft.getMinecraft()).displayGuiScreen(screen);
|
Objects.requireNonNull(Minecraft.getMinecraft()).displayGuiScreen(screen);
|
||||||
|
|||||||
+10
-5
@@ -155,16 +155,21 @@ public class TexturedButtonWidget extends Button
|
|||||||
@Override
|
@Override
|
||||||
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
//Render vanilla background
|
|
||||||
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
|
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||||
int i = this.getHoverState(this.hovered);
|
int i = this.getHoverState(this.hovered);
|
||||||
|
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
this.drawTexturedModalRect(this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.drawTexturedModalRect(this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
|
||||||
|
if (this.renderBackground)
|
||||||
|
{
|
||||||
|
//Render vanilla background
|
||||||
|
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
|
||||||
|
this.drawTexturedModalRect(this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
||||||
|
this.drawTexturedModalRect(this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||||
|
}
|
||||||
|
|
||||||
//Render DH texture
|
//Render DH texture
|
||||||
mc.getTextureManager().bindTexture(textureResourceLocation);
|
mc.getTextureManager().bindTexture(textureResourceLocation);
|
||||||
|
|||||||
+390
-54
@@ -3,41 +3,55 @@ package com.seibel.distanthorizons.common.wrappers.gui.classicConfig;
|
|||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui;
|
import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.*;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreenUtil;
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.config.ConfigGuiInfo;
|
import com.seibel.distanthorizons.common.wrappers.gui.config.ConfigGuiInfo;
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.config.ConfigHandler;
|
import com.seibel.distanthorizons.core.config.ConfigHandler;
|
||||||
import com.seibel.distanthorizons.core.config.types.*;
|
import com.seibel.distanthorizons.core.config.types.*;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.updater.ChangelogScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.updater.ChangelogScreen;
|
||||||
|
import com.seibel.distanthorizons.core.config.types.enums.EConfigCommentTextPosition;
|
||||||
import com.seibel.distanthorizons.core.config.types.enums.EConfigValidity;
|
import com.seibel.distanthorizons.core.config.types.enums.EConfigValidity;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.util.AnnotationUtil;
|
import com.seibel.distanthorizons.core.util.AnnotationUtil;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.config.IConfigGui;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.ILangWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.config.ILangWrapper;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
import net.minecraft.client.gui.*;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.Style;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
#else
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.components.AbstractWidget;
|
import net.minecraft.client.gui.components.AbstractWidget;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
|
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||||
import net.minecraft.client.gui.components.EditBox;
|
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.client.gui.screens.Screen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
#endif
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
#if MC_VER < MC_1_20_1
|
#elif MC_VER < MC_1_20_1
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiComponent;
|
||||||
#elif MC_VER <= MC_1_21_11
|
#elif MC_VER <= MC_1_21_11
|
||||||
@@ -47,16 +61,21 @@ import net.minecraft.client.gui.GuiGraphicsExtractor;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER >= MC_1_17_1
|
#if MC_VER >= MC_1_17_1
|
||||||
|
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_12_2
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
#elif MC_VER <= MC_1_21_10
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
#else
|
#else
|
||||||
import net.minecraft.resources.Identifier;
|
import net.minecraft.resources.Identifier;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
#if MC_VER > MC_1_12_2
|
||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
#endif
|
||||||
|
|
||||||
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.*;
|
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.*;
|
||||||
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.Translatable;
|
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.Translatable;
|
||||||
@@ -70,21 +89,38 @@ class DhConfigScreen extends DhScreen
|
|||||||
|
|
||||||
private static final MinecraftClientWrapper MC_CLIENT = MinecraftClientWrapper.INSTANCE;
|
private static final MinecraftClientWrapper MC_CLIENT = MinecraftClientWrapper.INSTANCE;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private static final int changelogButton_id = 101;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private final GuiScreen parent;
|
||||||
|
#else
|
||||||
private final Screen parent;
|
private final Screen parent;
|
||||||
|
#endif
|
||||||
|
|
||||||
private final String category;
|
private final String category;
|
||||||
private ClassicConfigGUI.ConfigListWidget configListWidget;
|
private ClassicConfigGUI.ConfigListWidget configListWidget;
|
||||||
private boolean reload = false;
|
private boolean reload = false;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private GuiButton doneButton;
|
||||||
|
#else
|
||||||
private Button doneButton;
|
private Button doneButton;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=============//
|
//=============//
|
||||||
// constructor //
|
// constructor //
|
||||||
//=============//
|
//=============//
|
||||||
|
//region
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
protected DhConfigScreen(GuiScreen parent, String category)
|
||||||
|
#else
|
||||||
protected DhConfigScreen(Screen parent, String category)
|
protected DhConfigScreen(Screen parent, String category)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
super(Translatable(
|
super(Translatable(
|
||||||
LANG_WRAPPER.langExists(ModInfo.ID + ".config" + (category.isEmpty() ? "." + category : "") + ".title") ?
|
LANG_WRAPPER.langExists(ModInfo.ID + ".config" + (category.isEmpty() ? "." + category : "") + ".title") ?
|
||||||
@@ -95,20 +131,44 @@ class DhConfigScreen extends DhScreen
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//===================//
|
||||||
|
// menu UI lifecycle //
|
||||||
|
//===================//
|
||||||
|
//region
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public void updateScreen() { super.updateScreen(); }
|
||||||
|
#else
|
||||||
public void tick() { super.tick(); }
|
public void tick() { super.tick(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================//
|
//==================//
|
||||||
// menu UI creation //
|
// menu UI creation //
|
||||||
//==================//
|
//==================//
|
||||||
|
//region
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public void initGui()
|
||||||
|
#else
|
||||||
protected void init()
|
protected void init()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
super.initGui();
|
||||||
|
#else
|
||||||
super.init();
|
super.init();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!this.reload)
|
if (!this.reload)
|
||||||
{
|
{
|
||||||
ConfigHandler.INSTANCE.configFileHandler.loadFromFile();
|
ConfigHandler.INSTANCE.configFileHandler.loadFromFile();
|
||||||
@@ -120,6 +180,9 @@ class DhConfigScreen extends DhScreen
|
|||||||
&& !ModInfo.IS_DEV_BUILD)
|
&& !ModInfo.IS_DEV_BUILD)
|
||||||
{
|
{
|
||||||
this.addBtn(new TexturedButtonWidget(
|
this.addBtn(new TexturedButtonWidget(
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
changelogButton_id,
|
||||||
|
#endif
|
||||||
// Where the button is on the screen
|
// Where the button is on the screen
|
||||||
this.width - 28, this.height - 28,
|
this.width - 28, this.height - 28,
|
||||||
// Width and height of the button
|
// Width and height of the button
|
||||||
@@ -137,6 +200,7 @@ class DhConfigScreen extends DhScreen
|
|||||||
#endif
|
#endif
|
||||||
20, 20,
|
20, 20,
|
||||||
// Create the button and tell it where to go
|
// Create the button and tell it where to go
|
||||||
|
#if MC_VER > MC_1_12_2
|
||||||
(buttonWidget) -> {
|
(buttonWidget) -> {
|
||||||
ChangelogScreen changelogScreen = new ChangelogScreen(this);
|
ChangelogScreen changelogScreen = new ChangelogScreen(this);
|
||||||
if (changelogScreen.usable)
|
if (changelogScreen.usable)
|
||||||
@@ -148,8 +212,13 @@ class DhConfigScreen extends DhScreen
|
|||||||
LOGGER.warn("Changelog was not able to open");
|
LOGGER.warn("Changelog was not able to open");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
#endif
|
||||||
// Add a title to the button
|
// Add a title to the button
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
Translatable(ModInfo.ID + ".updater.title").getFormattedText()
|
||||||
|
#else
|
||||||
Translatable(ModInfo.ID + ".updater.title")
|
Translatable(ModInfo.ID + ".updater.title")
|
||||||
|
#endif
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,16 +244,23 @@ class DhConfigScreen extends DhScreen
|
|||||||
DhScreenUtil.setScreen(this.parent);
|
DhScreenUtil.setScreen(this.parent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
this.configListWidget = new ClassicConfigGUI.ConfigListWidget(this.mc, this.width * 2, this.height, 32, 32, 25);
|
||||||
|
#else
|
||||||
this.configListWidget = new ClassicConfigGUI.ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25);
|
this.configListWidget = new ClassicConfigGUI.ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MC_VER < MC_1_20_6 // no background is rendered in MC 1.20.6+
|
#if MC_VER <= MC_1_12_2
|
||||||
|
#elif MC_VER < MC_1_20_6 // no background is rendered in MC 1.20.6+
|
||||||
if (this.minecraft != null && this.minecraft.level != null)
|
if (this.minecraft != null && this.minecraft.level != null)
|
||||||
{
|
{
|
||||||
this.configListWidget.setRenderBackground(false);
|
this.configListWidget.setRenderBackground(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_12_2
|
||||||
this.addWidget(this.configListWidget);
|
this.addWidget(this.configListWidget);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (AbstractConfigBase<?> configEntry : ConfigHandler.INSTANCE.configBaseList)
|
for (AbstractConfigBase<?> configEntry : ConfigHandler.INSTANCE.configBaseList)
|
||||||
{
|
{
|
||||||
@@ -347,18 +423,35 @@ class DhConfigScreen extends DhScreen
|
|||||||
private static void setupBooleanMenuOption(ConfigEntry<Boolean> booleanConfigEntry)
|
private static void setupBooleanMenuOption(ConfigEntry<Boolean> booleanConfigEntry)
|
||||||
{
|
{
|
||||||
// For boolean
|
// For boolean
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
Function<Object, ITextComponent> func = value -> Translatable("distanthorizons.general."+((Boolean) value ? "true" : "false")).setStyle(new Style().setColor((Boolean) value ? TextFormatting.GREEN : TextFormatting.RED));
|
||||||
|
#else
|
||||||
Function<Object, Component> func = value -> Translatable("distanthorizons.general." + ((Boolean) value ? "true" : "false")).withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
|
Function<Object, Component> func = value -> Translatable("distanthorizons.general." + ((Boolean) value ? "true" : "false")).withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||||
|
#endif
|
||||||
|
|
||||||
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) booleanConfigEntry.guiValue);
|
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) booleanConfigEntry.guiValue);
|
||||||
|
|
||||||
configGuiInfo.buttonOptionMap =
|
configGuiInfo.buttonOptionMap =
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
new AbstractMap.SimpleEntry<OnPressed, Function<Object, ITextComponent>>(
|
||||||
|
#else
|
||||||
new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(
|
new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(
|
||||||
|
#endif
|
||||||
(button) ->
|
(button) ->
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
button.enabled = !booleanConfigEntry.apiIsOverriding();
|
||||||
|
#else
|
||||||
button.active = !booleanConfigEntry.apiIsOverriding();
|
button.active = !booleanConfigEntry.apiIsOverriding();
|
||||||
|
#endif
|
||||||
|
|
||||||
booleanConfigEntry.uiSetWithoutSaving(!booleanConfigEntry.get());
|
booleanConfigEntry.uiSetWithoutSaving(!booleanConfigEntry.get());
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
button.displayString = func.apply(booleanConfigEntry.get()).getFormattedText();
|
||||||
|
#else
|
||||||
button.setMessage(func.apply(booleanConfigEntry.get()));
|
button.setMessage(func.apply(booleanConfigEntry.get()));
|
||||||
|
#endif
|
||||||
}, func);
|
}, func);
|
||||||
}
|
}
|
||||||
private static void setupEnumMenuOption(ConfigEntry<Enum<?>> enumConfigEntry, Class<? extends Enum<?>> enumClass)
|
private static void setupEnumMenuOption(ConfigEntry<Enum<?>> enumConfigEntry, Class<? extends Enum<?>> enumClass)
|
||||||
@@ -367,20 +460,29 @@ class DhConfigScreen extends DhScreen
|
|||||||
|
|
||||||
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) enumConfigEntry.guiValue);
|
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) enumConfigEntry.guiValue);
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
Function<Object, ITextComponent > getEnumTranslatableFunc = (value) -> Translatable(TRANSLATION_PREFIX + "enum." + enumClass.getSimpleName() + "." + enumConfigEntry.get().toString());
|
||||||
|
#else
|
||||||
Function<Object, Component> getEnumTranslatableFunc = (value) -> Translatable(TRANSLATION_PREFIX + "enum." + enumClass.getSimpleName() + "." + enumConfigEntry.get().toString());
|
Function<Object, Component> getEnumTranslatableFunc = (value) -> Translatable(TRANSLATION_PREFIX + "enum." + enumClass.getSimpleName() + "." + enumConfigEntry.get().toString());
|
||||||
|
#endif
|
||||||
|
|
||||||
configGuiInfo.buttonOptionMap =
|
configGuiInfo.buttonOptionMap =
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
new AbstractMap.SimpleEntry<OnPressed, Function<Object, ITextComponent>>(
|
||||||
|
#else
|
||||||
new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(
|
new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(
|
||||||
|
#endif
|
||||||
(button) ->
|
(button) ->
|
||||||
{
|
{
|
||||||
// get the currently selected enum and enum index
|
// get the currently selected enum and enum index
|
||||||
int startingIndex = enumList.indexOf(enumConfigEntry.get());
|
int startingIndex = enumList.indexOf(enumConfigEntry.get());
|
||||||
Enum<?> enumValue = enumList.get(startingIndex);
|
Enum<?> enumValue = enumList.get(startingIndex);
|
||||||
|
|
||||||
boolean shiftPressed =
|
#if MC_VER <= MC_1_12_2
|
||||||
InputConstants.isKeyDown(MC_CLIENT.getGlfwWindowId(), GLFW.GLFW_KEY_LEFT_SHIFT)
|
boolean shiftPressed = GuiScreen.isShiftKeyDown();
|
||||||
|| InputConstants.isKeyDown(MC_CLIENT.getGlfwWindowId(), GLFW.GLFW_KEY_RIGHT_SHIFT);
|
#else
|
||||||
|
boolean shiftPressed = InputConstants.isKeyDown(MC_CLIENT.getGlfwWindowId(), GLFW.GLFW_KEY_LEFT_SHIFT) || InputConstants.isKeyDown(MC_CLIENT.getGlfwWindowId(), GLFW.GLFW_KEY_RIGHT_SHIFT);
|
||||||
|
#endif
|
||||||
|
|
||||||
// move forward or backwards depending on if the shift key is pressed
|
// move forward or backwards depending on if the shift key is pressed
|
||||||
int index = shiftPressed ? startingIndex - 1 : startingIndex + 1;
|
int index = shiftPressed ? startingIndex - 1 : startingIndex + 1;
|
||||||
@@ -432,9 +534,13 @@ class DhConfigScreen extends DhScreen
|
|||||||
|
|
||||||
enumConfigEntry.uiSetWithoutSaving(enumValue);
|
enumConfigEntry.uiSetWithoutSaving(enumValue);
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
button.enabled = !enumConfigEntry.apiIsOverriding();
|
||||||
|
button.displayString = getEnumTranslatableFunc.apply(enumConfigEntry.get()).getFormattedText();
|
||||||
|
#else
|
||||||
button.active = !enumConfigEntry.apiIsOverriding();
|
button.active = !enumConfigEntry.apiIsOverriding();
|
||||||
|
|
||||||
button.setMessage(getEnumTranslatableFunc.apply(enumConfigEntry.get()));
|
button.setMessage(getEnumTranslatableFunc.apply(enumConfigEntry.get()));
|
||||||
|
#endif
|
||||||
}, getEnumTranslatableFunc);
|
}, getEnumTranslatableFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,8 +556,9 @@ class DhConfigScreen extends DhScreen
|
|||||||
//==============//
|
//==============//
|
||||||
// reset button //
|
// reset button //
|
||||||
//==============//
|
//==============//
|
||||||
|
//region
|
||||||
|
|
||||||
Button.OnPress btnAction = (button) ->
|
#if MC_VER <= MC_1_12_2 OnPressed #else Button.OnPress #endif btnAction = (button) ->
|
||||||
{
|
{
|
||||||
configEntry.uiSetWithoutSaving(configEntry.getDefaultValue());
|
configEntry.uiSetWithoutSaving(configEntry.getDefaultValue());
|
||||||
this.reload = true;
|
this.reload = true;
|
||||||
@@ -463,29 +570,60 @@ class DhConfigScreen extends DhScreen
|
|||||||
- ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
- ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
||||||
int resetButtonPosZ = 0;
|
int resetButtonPosZ = 0;
|
||||||
|
|
||||||
Button resetButton = MakeBtn(
|
#if MC_VER <= MC_1_12_2 GuiButton #else Button #endif resetButton = MakeBtn(
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
Translatable("distanthorizons.general.reset").setStyle(new Style().setColor(TextFormatting.RED)),
|
||||||
|
#else
|
||||||
Translatable("distanthorizons.general.reset").withStyle(ChatFormatting.RED),
|
Translatable("distanthorizons.general.reset").withStyle(ChatFormatting.RED),
|
||||||
resetButtonPosX, resetButtonPosZ,
|
#endif
|
||||||
ClassicConfigGUI.ConfigScreenConfigs.RESET_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.RESET_BUTTON_HEIGHT,
|
resetButtonPosX, resetButtonPosZ,
|
||||||
btnAction);
|
ClassicConfigGUI.ConfigScreenConfigs.RESET_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.RESET_BUTTON_HEIGHT,
|
||||||
|
btnAction);
|
||||||
|
|
||||||
if (configEntry.apiIsOverriding())
|
|
||||||
|
if (configEntry.mcVersionOverridePresent())
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
resetButton.enabled = false;
|
||||||
|
resetButton.displayString = Translatable("distanthorizons.general.unsupportedMcVersion").setStyle(new Style().setColor(TextFormatting.DARK_GRAY)).getFormattedText();
|
||||||
|
#else
|
||||||
|
resetButton.active = false;
|
||||||
|
resetButton.setMessage(Translatable("distanthorizons.general.unsupportedMcVersion").withStyle(ChatFormatting.DARK_GRAY));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (configEntry.apiIsOverriding())
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
resetButton.enabled = false;
|
||||||
|
resetButton.displayString = Translatable("distanthorizons.general.apiOverride").setStyle(new Style().setColor(TextFormatting.DARK_GRAY)).getFormattedText();
|
||||||
|
#else
|
||||||
resetButton.active = false;
|
resetButton.active = false;
|
||||||
resetButton.setMessage(Translatable("distanthorizons.general.apiOverride").withStyle(ChatFormatting.DARK_GRAY));
|
resetButton.setMessage(Translatable("distanthorizons.general.apiOverride").withStyle(ChatFormatting.DARK_GRAY));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
resetButton.enabled = true;
|
||||||
|
#else
|
||||||
resetButton.active = true;
|
resetButton.active = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
//==============//
|
||||||
// option field //
|
// option field //
|
||||||
//==============//
|
//==============//
|
||||||
|
//region
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
ITextComponent textComponent = this.GetTranslatableTextComponentForConfig(configEntry);
|
||||||
|
#else
|
||||||
Component textComponent = this.GetTranslatableTextComponentForConfig(configEntry);
|
Component textComponent = this.GetTranslatableTextComponentForConfig(configEntry);
|
||||||
|
#endif
|
||||||
|
|
||||||
int optionFieldPosX = this.width
|
int optionFieldPosX = this.width
|
||||||
- ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN
|
- ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN
|
||||||
@@ -497,21 +635,40 @@ class DhConfigScreen extends DhScreen
|
|||||||
if (configGuiInfo.buttonOptionMap != null)
|
if (configGuiInfo.buttonOptionMap != null)
|
||||||
{
|
{
|
||||||
// enum/multi option input button
|
// enum/multi option input button
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
Map.Entry<OnPressed, Function<Object,ITextComponent>> widget = configGuiInfo.buttonOptionMap;
|
||||||
|
#else
|
||||||
Map.Entry<Button.OnPress, Function<Object, Component>> widget = configGuiInfo.buttonOptionMap;
|
Map.Entry<Button.OnPress, Function<Object, Component>> widget = configGuiInfo.buttonOptionMap;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (configEntry.getType().isEnum())
|
if (configEntry.getType().isEnum())
|
||||||
{
|
{
|
||||||
widget.setValue((value) -> Translatable(TRANSLATION_PREFIX + "enum." + configEntry.getType().getSimpleName() + "." + configEntry.get().toString()));
|
widget.setValue((value) -> Translatable(TRANSLATION_PREFIX + "enum." + configEntry.getType().getSimpleName() + "." + configEntry.get().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
GuiButton button = MakeBtn(
|
||||||
|
#else
|
||||||
Button button = MakeBtn(
|
Button button = MakeBtn(
|
||||||
|
#endif
|
||||||
widget.getValue().apply(configEntry.get()),
|
widget.getValue().apply(configEntry.get()),
|
||||||
optionFieldPosX, optionFieldPosZ,
|
optionFieldPosX, optionFieldPosZ,
|
||||||
ClassicConfigGUI.ConfigScreenConfigs.OPTION_FIELD_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
ClassicConfigGUI.ConfigScreenConfigs.OPTION_FIELD_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
||||||
widget.getKey());
|
widget.getKey());
|
||||||
|
|
||||||
|
|
||||||
// deactivate the button if the API is overriding it
|
// deactivate the button if the API is overriding it
|
||||||
button.active = !configEntry.apiIsOverriding();
|
// or the MC version doesn't support it
|
||||||
|
if (configEntry.mcVersionOverridePresent()
|
||||||
|
|| configEntry.apiIsOverriding())
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
button.enabled = false;
|
||||||
|
#else
|
||||||
|
button.active = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.configListWidget.addButton(this, configEntry,
|
this.configListWidget.addButton(this, configEntry,
|
||||||
@@ -525,16 +682,25 @@ class DhConfigScreen extends DhScreen
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// text box input
|
// text box input
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
GuiTextField widget = new GuiTextField(0, this.fontRenderer,
|
||||||
|
optionFieldPosX, optionFieldPosZ,
|
||||||
|
ClassicConfigGUI.ConfigScreenConfigs.OPTION_FIELD_WIDTH - 4, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT);
|
||||||
|
widget.setMaxStringLength(3_000_000); // hopefully 3 million characters should be enough for any normal use-case, lol
|
||||||
|
widget.setText(String.valueOf(configEntry.get()));
|
||||||
|
#else
|
||||||
EditBox widget = new EditBox(this.font,
|
EditBox widget = new EditBox(this.font,
|
||||||
optionFieldPosX, optionFieldPosZ,
|
optionFieldPosX, optionFieldPosZ,
|
||||||
ClassicConfigGUI.ConfigScreenConfigs.OPTION_FIELD_WIDTH - 4, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
ClassicConfigGUI.ConfigScreenConfigs.OPTION_FIELD_WIDTH - 4, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
||||||
Translatable(""));
|
Translatable(""));
|
||||||
widget.setMaxLength(3_000_000); // hopefully 3 million characters should be enough for any normal use-case, lol
|
widget.setMaxLength(3_000_000); // hopefully 3 million characters should be enough for any normal use-case, lol
|
||||||
widget.insertText(String.valueOf(configEntry.get()));
|
widget.insertText(String.valueOf(configEntry.get()));
|
||||||
|
#endif
|
||||||
|
|
||||||
Predicate<String> processor = configGuiInfo.tooltipFunction.apply(widget, this.doneButton);
|
Predicate<String> processor = configGuiInfo.tooltipFunction.apply(widget, this.doneButton);
|
||||||
#if MC_VER <= MC_1_21_11
|
#if MC_VER <= MC_1_12_2
|
||||||
|
widget.setValidator(processor::test);
|
||||||
|
#elif MC_VER <= MC_1_21_11
|
||||||
widget.setFilter(processor);
|
widget.setFilter(processor);
|
||||||
#else
|
#else
|
||||||
widget.setResponder(processor::test);
|
widget.setResponder(processor::test);
|
||||||
@@ -544,6 +710,8 @@ class DhConfigScreen extends DhScreen
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -554,12 +722,21 @@ class DhConfigScreen extends DhScreen
|
|||||||
{
|
{
|
||||||
ConfigCategory configCategory = (ConfigCategory) configType;
|
ConfigCategory configCategory = (ConfigCategory) configType;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
ITextComponent textComponent = this.GetTranslatableTextComponentForConfig(configCategory);
|
||||||
|
#else
|
||||||
Component textComponent = this.GetTranslatableTextComponentForConfig(configCategory);
|
Component textComponent = this.GetTranslatableTextComponentForConfig(configCategory);
|
||||||
|
#endif
|
||||||
|
|
||||||
int categoryPosX = this.width - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH - ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
int categoryPosX = this.width - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH - ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
||||||
int categoryPosZ = this.height - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT; // Note: the posZ value here seems to be ignored
|
int categoryPosZ = this.height - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT; // Note: the posZ value here seems to be ignored
|
||||||
|
|
||||||
Button widget = MakeBtn(textComponent,
|
#if MC_VER <= MC_1_12_2
|
||||||
|
GuiButton widget = MakeBtn(
|
||||||
|
#else
|
||||||
|
Button widget = MakeBtn(
|
||||||
|
#endif
|
||||||
|
textComponent,
|
||||||
categoryPosX, categoryPosZ,
|
categoryPosX, categoryPosZ,
|
||||||
ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
||||||
((button) ->
|
((button) ->
|
||||||
@@ -580,11 +757,20 @@ class DhConfigScreen extends DhScreen
|
|||||||
{
|
{
|
||||||
ConfigUIButton configUiButton = (ConfigUIButton) configType;
|
ConfigUIButton configUiButton = (ConfigUIButton) configType;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
ITextComponent textComponent = this.GetTranslatableTextComponentForConfig(configUiButton);
|
||||||
|
#else
|
||||||
Component textComponent = this.GetTranslatableTextComponentForConfig(configUiButton);
|
Component textComponent = this.GetTranslatableTextComponentForConfig(configUiButton);
|
||||||
|
#endif
|
||||||
|
|
||||||
int buttonPosX = this.width - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH - ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
int buttonPosX = this.width - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH - ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
||||||
|
|
||||||
Button widget = MakeBtn(textComponent,
|
#if MC_VER <= MC_1_12_2
|
||||||
|
GuiButton widget = MakeBtn(
|
||||||
|
#else
|
||||||
|
Button widget = MakeBtn(
|
||||||
|
#endif
|
||||||
|
textComponent,
|
||||||
buttonPosX, this.height - 28,
|
buttonPosX, this.height - 28,
|
||||||
ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
||||||
(button) -> ((ConfigUIButton) configType).runAction());
|
(button) -> ((ConfigUIButton) configType).runAction());
|
||||||
@@ -601,7 +787,11 @@ class DhConfigScreen extends DhScreen
|
|||||||
{
|
{
|
||||||
ConfigUIComment configUiComment = (ConfigUIComment) configType;
|
ConfigUIComment configUiComment = (ConfigUIComment) configType;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
ITextComponent textComponent = this.GetTranslatableTextComponentForConfig(configUiComment);
|
||||||
|
#else
|
||||||
Component textComponent = this.GetTranslatableTextComponentForConfig(configUiComment);
|
Component textComponent = this.GetTranslatableTextComponentForConfig(configUiComment);
|
||||||
|
#endif
|
||||||
if (configUiComment.parentConfigPath != null)
|
if (configUiComment.parentConfigPath != null)
|
||||||
{
|
{
|
||||||
textComponent = Translatable(TRANSLATION_PREFIX + configUiComment.parentConfigPath);
|
textComponent = Translatable(TRANSLATION_PREFIX + configUiComment.parentConfigPath);
|
||||||
@@ -618,7 +808,12 @@ class DhConfigScreen extends DhScreen
|
|||||||
{
|
{
|
||||||
if (configType instanceof ConfigUISpacer)
|
if (configType instanceof ConfigUISpacer)
|
||||||
{
|
{
|
||||||
Button spacerButton = MakeBtn(Translatable("distanthorizons.general.spacer"),
|
#if MC_VER <= MC_1_12_2
|
||||||
|
GuiButton spacerButton = MakeBtn(
|
||||||
|
#else
|
||||||
|
Button spacerButton = MakeBtn(
|
||||||
|
#endif
|
||||||
|
Translatable("distanthorizons.general.spacer"),
|
||||||
10, 10, // having too small of a size causes division by 0 errors in older MC versions (IE 1.20.1)
|
10, 10, // having too small of a size causes division by 0 errors in older MC versions (IE 1.20.1)
|
||||||
1, 1,
|
1, 1,
|
||||||
(button) -> { });
|
(button) -> { });
|
||||||
@@ -643,25 +838,36 @@ class DhConfigScreen extends DhScreen
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private ITextComponent GetTranslatableTextComponentForConfig(AbstractConfigBase<?> configType)
|
||||||
|
#else
|
||||||
private Component GetTranslatableTextComponentForConfig(AbstractConfigBase<?> configType)
|
private Component GetTranslatableTextComponentForConfig(AbstractConfigBase<?> configType)
|
||||||
|
#endif
|
||||||
{ return Translatable(TRANSLATION_PREFIX + configType.getNameAndCategory()); }
|
{ return Translatable(TRANSLATION_PREFIX + configType.getNameAndCategory()); }
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===========//
|
//===========//
|
||||||
// rendering //
|
// rendering //
|
||||||
//===========//
|
//===========//
|
||||||
|
//region
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float delta)
|
||||||
|
#elif MC_VER < MC_1_20_1
|
||||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||||
#elif MC_VER <= MC_1_21_11
|
#elif MC_VER <= MC_1_21_11
|
||||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||||
#else
|
#else
|
||||||
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function
|
#if MC_VER <= MC_1_12_2
|
||||||
|
this.drawDefaultBackground();
|
||||||
|
#elif MC_VER < MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function
|
||||||
this.renderBackground(matrices);
|
this.renderBackground(matrices);
|
||||||
#elif MC_VER <= MC_1_21_11
|
#elif MC_VER <= MC_1_21_11
|
||||||
super.render(matrices, mouseX, mouseY, delta);
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
@@ -670,7 +876,9 @@ class DhConfigScreen extends DhScreen
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Render buttons
|
// Render buttons
|
||||||
#if MC_VER <= MC_1_21_11
|
#if MC_VER <= MC_1_12_2
|
||||||
|
this.configListWidget.drawScreen(mouseX, mouseY, delta);
|
||||||
|
#elif MC_VER <= MC_1_21_11
|
||||||
this.configListWidget.render(matrices, mouseX, mouseY, delta);
|
this.configListWidget.render(matrices, mouseX, mouseY, delta);
|
||||||
#else
|
#else
|
||||||
this.configListWidget.extractRenderState(matrices, mouseX, mouseY, delta);
|
this.configListWidget.extractRenderState(matrices, mouseX, mouseY, delta);
|
||||||
@@ -678,51 +886,74 @@ class DhConfigScreen extends DhScreen
|
|||||||
|
|
||||||
|
|
||||||
// Render config title
|
// Render config title
|
||||||
this.DhDrawCenteredString(matrices, this.font, this.title,
|
this.DhDrawCenteredString(
|
||||||
|
#if MC_VER > MC_1_12_2
|
||||||
|
matrices, this.font,
|
||||||
|
#endif
|
||||||
|
this.title,
|
||||||
this.width / 2, 15,
|
this.width / 2, 15,
|
||||||
#if MC_VER < MC_1_21_6
|
#if MC_VER < MC_1_21_6
|
||||||
0xFFFFFF // RGB white
|
0xFFFFFF // RGB white
|
||||||
#else
|
#else
|
||||||
0xFFFFFFFF // ARGB white
|
0xFFFFFFFF // ARGB white
|
||||||
#endif );
|
#endif);
|
||||||
|
|
||||||
|
|
||||||
// render DH version
|
// render DH version
|
||||||
this.DhDrawString(matrices, this.font, TextOrLiteral(ModInfo.VERSION), 2, this.height - 10,
|
this.DhDrawString(
|
||||||
#if MC_VER < MC_1_21_6
|
#if MC_VER > MC_1_12_2
|
||||||
|
matrices, this.font,
|
||||||
|
#endif
|
||||||
|
TextOrLiteral(ModInfo.VERSION), 2, this.height - 10,
|
||||||
|
#if MC_VER < MC_1_21_6
|
||||||
0xAAAAAA // RGB white
|
0xAAAAAA // RGB white
|
||||||
#else
|
#else
|
||||||
0xFFAAAAAA // ARGB white
|
0xFFAAAAAA // ARGB white
|
||||||
#endif );
|
#endif);
|
||||||
|
|
||||||
// If the update is pending, display this message to inform the user that it will apply when the game restarts
|
// If the update is pending, display this message to inform the user that it will apply when the game restarts
|
||||||
if (SelfUpdater.deleteOldJarOnJvmShutdown)
|
if (SelfUpdater.deleteOldJarOnJvmShutdown)
|
||||||
{
|
{
|
||||||
this.DhDrawString(matrices, this.font, Translatable(ModInfo.ID + ".updater.waitingForClose"), 4, this.height - 42,
|
this.DhDrawString(
|
||||||
#if MC_VER < MC_1_21_6
|
#if MC_VER > MC_1_12_2
|
||||||
|
matrices, this.font,
|
||||||
|
#endif
|
||||||
|
Translatable(ModInfo.ID + ".updater.waitingForClose"), 4, this.height - 42,
|
||||||
|
#if MC_VER < MC_1_21_6
|
||||||
0xFFFFFF // RGB white
|
0xFFFFFF // RGB white
|
||||||
#else
|
#else
|
||||||
0xFFFFFFFF // ARGB white
|
0xFFFFFFFF // ARGB white
|
||||||
#endif );
|
#endif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
this.renderTooltip(mouseX, mouseY, delta);
|
||||||
|
#else
|
||||||
this.renderTooltip(matrices, mouseX, mouseY, delta);
|
this.renderTooltip(matrices, mouseX, mouseY, delta);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MC_VER < MC_1_20_2
|
#if MC_VER <= MC_1_12_2
|
||||||
|
super.drawScreen(mouseX, mouseY, delta);
|
||||||
|
#elif MC_VER < MC_1_20_2
|
||||||
super.render(matrices, mouseX, mouseY, delta);
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private void renderTooltip(int mouseX, int mouseY, float delta)
|
||||||
|
#elif MC_VER < MC_1_20_1
|
||||||
private void renderTooltip(PoseStack matrices, int mouseX, int mouseY, float delta)
|
private void renderTooltip(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||||
#elif MC_VER <= MC_1_21_11
|
#elif MC_VER <= MC_1_21_11
|
||||||
private void renderTooltip(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
private void renderTooltip(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||||
#else
|
#else
|
||||||
private void renderTooltip(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
private void renderTooltip(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
Gui hoveredWidget = this.configListWidget.getHoveredButton(mouseX, mouseY);
|
||||||
|
#else
|
||||||
AbstractWidget hoveredWidget = this.configListWidget.getHoveredButton(mouseX, mouseY);
|
AbstractWidget hoveredWidget = this.configListWidget.getHoveredButton(mouseX, mouseY);
|
||||||
|
#endif
|
||||||
if (hoveredWidget == null)
|
if (hoveredWidget == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -738,14 +969,20 @@ class DhConfigScreen extends DhScreen
|
|||||||
button.dhConfigType;
|
button.dhConfigType;
|
||||||
|
|
||||||
boolean apiOverrideActive = false;
|
boolean apiOverrideActive = false;
|
||||||
|
boolean unsupportedMcVersion = false;
|
||||||
if (configBase instanceof ConfigEntry)
|
if (configBase instanceof ConfigEntry)
|
||||||
{
|
{
|
||||||
apiOverrideActive = ((ConfigEntry<?>) configBase).apiIsOverriding();
|
apiOverrideActive = ((ConfigEntry<?>) configBase).apiIsOverriding();
|
||||||
|
unsupportedMcVersion = ((ConfigEntry<?>) configBase).mcVersionOverridePresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
String key = TRANSLATION_PREFIX + (configBase.category.isEmpty() ? "" : configBase.category + ".") + configBase.getName() + ".@tooltip";
|
String key = TRANSLATION_PREFIX + (configBase.category.isEmpty() ? "" : configBase.category + ".") + configBase.getName() + ".@tooltip";
|
||||||
|
|
||||||
if (apiOverrideActive)
|
if (unsupportedMcVersion)
|
||||||
|
{
|
||||||
|
key = "distanthorizons.general.unsupportedMcVersion.@tooltip";
|
||||||
|
}
|
||||||
|
else if (apiOverrideActive)
|
||||||
{
|
{
|
||||||
key = "distanthorizons.general.disabledByApi.@tooltip";
|
key = "distanthorizons.general.disabledByApi.@tooltip";
|
||||||
}
|
}
|
||||||
@@ -754,37 +991,136 @@ class DhConfigScreen extends DhScreen
|
|||||||
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) configBase.guiValue);
|
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) configBase.guiValue);
|
||||||
if (configGuiInfo.errorMessage != null)
|
if (configGuiInfo.errorMessage != null)
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
this.DhRenderTooltip(configGuiInfo.errorMessage, mouseX, mouseY);
|
||||||
|
#else
|
||||||
this.DhRenderTooltip(matrices, this.font, configGuiInfo.errorMessage, mouseX, mouseY);
|
this.DhRenderTooltip(matrices, this.font, configGuiInfo.errorMessage, mouseX, mouseY);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// display the tooltip if present
|
// display the tooltip if present
|
||||||
else if (LANG_WRAPPER.langExists(key))
|
else if (LANG_WRAPPER.langExists(key))
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
List<ITextComponent> list = new ArrayList<>();
|
||||||
|
#else
|
||||||
List<Component> list = new ArrayList<>();
|
List<Component> list = new ArrayList<>();
|
||||||
|
#endif
|
||||||
|
|
||||||
String lang = LANG_WRAPPER.getLang(key);
|
String lang = LANG_WRAPPER.getLang(key);
|
||||||
for (String langLine : lang.split("\n"))
|
for (String langLine : lang.split("\n"))
|
||||||
{
|
{
|
||||||
list.add(TextOrTranslatable(langLine));
|
list.add(TextOrTranslatable(langLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
this.DhRenderComponentTooltip(list, mouseX, mouseY);
|
||||||
|
#else
|
||||||
this.DhRenderComponentTooltip(matrices, this.font, list, mouseX, mouseY);
|
this.DhRenderComponentTooltip(matrices, this.font, list, mouseX, mouseY);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(GuiButton button)
|
||||||
|
{
|
||||||
|
super.actionPerformed(button);
|
||||||
|
if(button.id == changelogButton_id)
|
||||||
|
{
|
||||||
|
ChangelogScreen changelogScreen = new ChangelogScreen(this);
|
||||||
|
if (changelogScreen.usable)
|
||||||
|
{
|
||||||
|
DhScreenUtil.setScreen(changelogScreen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.warn("Changelog was not able to open");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws java.io.IOException
|
||||||
|
{
|
||||||
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
|
if (mouseY >= this.configListWidget.top && mouseY <= this.configListWidget.bottom)
|
||||||
|
{
|
||||||
|
for (ClassicConfigGUI.DhButtonEntry entry : this.configListWidget.children)
|
||||||
|
{
|
||||||
|
if (entry.button instanceof GuiButton btn && btn.visible)
|
||||||
|
{
|
||||||
|
if (btn.mousePressed(this.mc, mouseX, mouseY))
|
||||||
|
{
|
||||||
|
btn.playPressSound(this.mc.getSoundHandler());
|
||||||
|
OnPressed handler = GuiHelper.HANDLER_BY_BUTTON.get(btn);
|
||||||
|
if (handler != null) handler.pressed(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (entry.button instanceof GuiTextField field && field.getVisible())
|
||||||
|
{
|
||||||
|
field.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.resetButton instanceof GuiButton reset && reset.visible)
|
||||||
|
{
|
||||||
|
if (reset.mousePressed(this.mc, mouseX, mouseY))
|
||||||
|
{
|
||||||
|
reset.playPressSound(this.mc.getSoundHandler());
|
||||||
|
OnPressed handler = GuiHelper.HANDLER_BY_BUTTON.get(reset);
|
||||||
|
if (handler != null) handler.pressed(reset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char typedChar, int keyCode) throws java.io.IOException
|
||||||
|
{
|
||||||
|
super.keyTyped(typedChar, keyCode);
|
||||||
|
for (ClassicConfigGUI.DhButtonEntry entry : this.configListWidget.children)
|
||||||
|
{
|
||||||
|
if (entry.button instanceof GuiTextField field)
|
||||||
|
{
|
||||||
|
field.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMouseInput() throws java.io.IOException
|
||||||
|
{
|
||||||
|
super.handleMouseInput();
|
||||||
|
this.configListWidget.handleMouseInput();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==========//
|
//==========//
|
||||||
// shutdown //
|
// shutdown //
|
||||||
//==========//
|
//==========//
|
||||||
|
//region
|
||||||
/** When you close it, it goes to the previous screen and saves */
|
/** When you close it, it goes to the previous screen and saves */
|
||||||
@Override
|
@Override
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public void onGuiClosed()
|
||||||
|
#else
|
||||||
public void onClose()
|
public void onClose()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
// Handled by button to avoid recursive loop
|
||||||
|
#else
|
||||||
DhScreenUtil.setScreen(this.parent);
|
DhScreenUtil.setScreen(this.parent);
|
||||||
|
#endif
|
||||||
ClassicConfigGUI.CONFIG_CORE_INTERFACE.onScreenChangeListenerList.forEach((listener) -> listener.run());
|
ClassicConfigGUI.CONFIG_CORE_INTERFACE.onScreenChangeListenerList.forEach((listener) -> listener.run());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -186,7 +186,7 @@ public class ChangelogScreen extends DhScreen
|
|||||||
this.addBtn( // Close
|
this.addBtn( // Close
|
||||||
MakeBtn(Translatable(ModInfo.ID + ".general.back"), 5, this.height - 25, 100, 20, (btn) -> {
|
MakeBtn(Translatable(ModInfo.ID + ".general.back"), 5, this.height - 25, 100, 20, (btn) -> {
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
Objects.requireNonNull(this.mc).displayGuiScreen(this.parent);
|
DhScreenUtil.setScreen(this.parent);
|
||||||
#else
|
#else
|
||||||
this.onClose();
|
this.onClose();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+25
-4
@@ -11,6 +11,7 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter;
|
|||||||
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
#else
|
#else
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
@@ -188,7 +189,7 @@ public class UpdateModScreen extends DhScreen
|
|||||||
MakeBtn(Translatable(ModInfo.ID + ".updater.update"), this.width / 2 - 75, this.height / 2 + 8, 150, 20, (btn) -> {
|
MakeBtn(Translatable(ModInfo.ID + ".updater.update"), this.width / 2 - 75, this.height / 2 + 8, 150, 20, (btn) -> {
|
||||||
SelfUpdater.updateMod();
|
SelfUpdater.updateMod();
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
Objects.requireNonNull(this.mc).displayGuiScreen(this.parent);
|
DhScreenUtil.setScreen(this.parent);
|
||||||
#else
|
#else
|
||||||
this.onClose();
|
this.onClose();
|
||||||
#endif
|
#endif
|
||||||
@@ -199,7 +200,7 @@ public class UpdateModScreen extends DhScreen
|
|||||||
Config.Client.Advanced.AutoUpdater.enableSilentUpdates.set(true);
|
Config.Client.Advanced.AutoUpdater.enableSilentUpdates.set(true);
|
||||||
SelfUpdater.updateMod();
|
SelfUpdater.updateMod();
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
Objects.requireNonNull(this.mc).displayGuiScreen(this.parent);
|
DhScreenUtil.setScreen(this.parent);
|
||||||
#else
|
#else
|
||||||
this.onClose();
|
this.onClose();
|
||||||
#endif
|
#endif
|
||||||
@@ -208,7 +209,7 @@ public class UpdateModScreen extends DhScreen
|
|||||||
this.addBtn( // Later (not now)
|
this.addBtn( // Later (not now)
|
||||||
MakeBtn(Translatable(ModInfo.ID + ".updater.later"), this.width / 2 + 2, this.height / 2 + 70, 100, 20, (btn) -> {
|
MakeBtn(Translatable(ModInfo.ID + ".updater.later"), this.width / 2 + 2, this.height / 2 + 70, 100, 20, (btn) -> {
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
Objects.requireNonNull(this.mc).displayGuiScreen(this.parent);
|
DhScreenUtil.setScreen(this.parent);
|
||||||
#else
|
#else
|
||||||
this.onClose();
|
this.onClose();
|
||||||
#endif
|
#endif
|
||||||
@@ -218,7 +219,7 @@ public class UpdateModScreen extends DhScreen
|
|||||||
MakeBtn(Translatable(ModInfo.ID + ".updater.never"), this.width / 2 - 102, this.height / 2 + 70, 100, 20, (btn) -> {
|
MakeBtn(Translatable(ModInfo.ID + ".updater.never"), this.width / 2 - 102, this.height / 2 + 70, 100, 20, (btn) -> {
|
||||||
Config.Client.Advanced.AutoUpdater.enableAutoUpdater.set(false);
|
Config.Client.Advanced.AutoUpdater.enableAutoUpdater.set(false);
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
Objects.requireNonNull(this.mc).displayGuiScreen(this.parent);
|
DhScreenUtil.setScreen(this.parent);
|
||||||
#else
|
#else
|
||||||
this.onClose();
|
this.onClose();
|
||||||
#endif
|
#endif
|
||||||
@@ -298,4 +299,24 @@ public class UpdateModScreen extends DhScreen
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(GuiButton button)
|
||||||
|
{
|
||||||
|
super.actionPerformed(button);
|
||||||
|
if(button.id == changelogButton_id)
|
||||||
|
{
|
||||||
|
ChangelogScreen changelogScreen = new ChangelogScreen(this);
|
||||||
|
if (changelogScreen.usable)
|
||||||
|
{
|
||||||
|
DhScreenUtil.setScreen(changelogScreen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.warn("Changelog was not able to open");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
+118
-33
@@ -1,5 +1,6 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.level;
|
package com.seibel.distanthorizons.common.wrappers.level;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.level.IServerKeyedClientLevel;
|
import com.seibel.distanthorizons.core.level.IServerKeyedClientLevel;
|
||||||
import com.seibel.distanthorizons.core.level.IKeyedClientLevelManager;
|
import com.seibel.distanthorizons.core.level.IKeyedClientLevelManager;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
@@ -8,29 +9,25 @@ import net.minecraft.client.multiplayer.WorldClient;
|
|||||||
#else
|
#else
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
#endif
|
#endif
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class KeyedClientLevelManager implements IKeyedClientLevelManager
|
public class KeyedClientLevelManager implements IKeyedClientLevelManager
|
||||||
{
|
{
|
||||||
public static final KeyedClientLevelManager INSTANCE = new KeyedClientLevelManager();
|
/** Stores the server-provided keys indexed by dimension name for persistence. */
|
||||||
|
private final Map<String, KeyInfo> keysByDimensionName = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/** Cache for already keyed level wrappers to maintain object identity. */
|
||||||
|
private final Map<#if MC_VER > MC_1_12_2 ClientLevel #else WorldClient #endif, IServerKeyedClientLevel>
|
||||||
|
keyedLevelsCache = Collections.synchronizedMap(new WeakHashMap<>());
|
||||||
|
|
||||||
/** This is set and managed by the ClientApi for servers with support for DH. */
|
|
||||||
@Nullable
|
|
||||||
private IServerKeyedClientLevel serverKeyedLevel = null;
|
|
||||||
/** Allows to keep level manager enabled between loading different keyed levels */
|
/** Allows to keep level manager enabled between loading different keyed levels */
|
||||||
private boolean enabled = false;
|
private volatile boolean enabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=============//
|
|
||||||
// constructor //
|
|
||||||
//=============//
|
|
||||||
//region
|
|
||||||
|
|
||||||
private KeyedClientLevelManager() { }
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -41,32 +38,120 @@ public class KeyedClientLevelManager implements IKeyedClientLevelManager
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public IServerKeyedClientLevel getServerKeyedLevel() { return this.serverKeyedLevel; }
|
public IServerKeyedClientLevel getServerKeyedLevel(IClientLevelWrapper levelWrapper)
|
||||||
|
|
||||||
@Override
|
|
||||||
public IServerKeyedClientLevel setServerKeyedLevel(IClientLevelWrapper clientLevel, String serverKey, String levelKey)
|
|
||||||
{
|
{
|
||||||
IServerKeyedClientLevel keyedLevel;
|
if (levelWrapper == null)
|
||||||
#if MC_VER <= MC_1_12_2
|
{
|
||||||
keyedLevel = new ServerKeyedClientLevelWrapper((WorldClient) clientLevel.getWrappedMcObject(), serverKey, levelKey);
|
return null;
|
||||||
#else
|
}
|
||||||
keyedLevel = new ServerKeyedClientLevelWrapper((ClientLevel) clientLevel.getWrappedMcObject(), serverKey, levelKey);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
this.serverKeyedLevel = keyedLevel;
|
// We synchronize on the cache map to ensure atomicity of the lookup-and-populate sequence.
|
||||||
this.enabled = true;
|
// This prevents multiple threads from creating duplicate wrappers for the same level.
|
||||||
return keyedLevel;
|
synchronized (this.keyedLevelsCache)
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
WorldClient level = (WorldClient) levelWrapper.getWrappedMcObject();
|
||||||
|
#else
|
||||||
|
ClientLevel level = (ClientLevel) levelWrapper.getWrappedMcObject();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Check the cache first
|
||||||
|
IServerKeyedClientLevel cached = this.keyedLevelsCache.get(level);
|
||||||
|
if (cached != null)
|
||||||
|
{
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine the dimension name for this level
|
||||||
|
// We use bypassLevelKeyManager=true to avoid recursion back into this manager
|
||||||
|
IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper(level, true);
|
||||||
|
if (wrappedLevel == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String dimensionName = wrappedLevel.getDimensionName();
|
||||||
|
KeyInfo info = this.keysByDimensionName.get(dimensionName);
|
||||||
|
if (info == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create and cache a new keyed wrapper
|
||||||
|
IServerKeyedClientLevel keyedLevel = new ServerKeyedClientLevelWrapper(level, info.serverKey, info.levelKey);
|
||||||
|
this.keyedLevelsCache.put(level, keyedLevel);
|
||||||
|
return keyedLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearKeyedLevel() { this.serverKeyedLevel = null; }
|
public IServerKeyedClientLevel setServerKeyedLevel(IClientLevelWrapper clientLevel, String dimensionResource, String serverKey, String levelKey)
|
||||||
|
{
|
||||||
|
this.keysByDimensionName.put(dimensionResource, new KeyInfo(serverKey, levelKey));
|
||||||
|
this.enabled = true;
|
||||||
|
|
||||||
|
synchronized (this.keyedLevelsCache)
|
||||||
|
{
|
||||||
|
this.keyedLevelsCache.keySet().removeIf(level -> {
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
String levelDim = level.provider.getDimensionType().getName() + ":" + level.provider.getDimension();
|
||||||
|
#elif MC_VER <= MC_1_21_10
|
||||||
|
String levelDim = level.dimension().location().toString();
|
||||||
|
#else
|
||||||
|
String levelDim = level.dimension().identifier().toString();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return levelDim.equals(dimensionResource);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clientLevel == null || !clientLevel.getDimensionName().equals(dimensionResource)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.getServerKeyedLevel(clientLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearKeyedLevel()
|
||||||
|
{
|
||||||
|
synchronized (this.keyedLevelsCache)
|
||||||
|
{
|
||||||
|
this.keyedLevelsCache.clear();
|
||||||
|
this.keysByDimensionName.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled() { return this.enabled; }
|
public boolean isEnabled() { return this.enabled; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() { this.enabled = false; }
|
public void disable()
|
||||||
|
{
|
||||||
|
this.enabled = false;
|
||||||
|
this.clearKeyedLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================//
|
||||||
|
// helper classes //
|
||||||
|
//================//
|
||||||
|
//region
|
||||||
|
|
||||||
|
private static class KeyInfo
|
||||||
|
{
|
||||||
|
public final String serverKey;
|
||||||
|
public final String levelKey;
|
||||||
|
|
||||||
|
public KeyInfo(String serverKey, String levelKey)
|
||||||
|
{
|
||||||
|
this.serverKey = serverKey;
|
||||||
|
this.levelKey = levelKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
package com.seibel.distanthorizons.common.wrappers.minecraft;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_12_2
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
#elif MC_VER <= MC_1_21_10
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
#else
|
||||||
|
import net.minecraft.resources.Identifier;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_19_2
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
#elif MC_VER > MC_1_12_2
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public abstract class AbstractMinecraftSharedWrapper implements IMinecraftSharedWrapper
|
||||||
|
{
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
protected Integer deserializeDimensionResourceKey(String dimensionResourceLocation)
|
||||||
|
#else
|
||||||
|
protected ResourceKey<Level> deserializeDimensionResourceKey(String dimensionResourceLocation)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Integer.parseInt(dimensionResourceLocation.substring(dimensionResourceLocation.indexOf(":")+1));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ignored)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#if MC_VER <= MC_1_21_10
|
||||||
|
ResourceLocation dimResourceLocation = ResourceLocation.tryParse(dimensionResourceLocation);
|
||||||
|
#else
|
||||||
|
Identifier dimResourceLocation = Identifier.tryParse(dimensionResourceLocation);
|
||||||
|
#endif
|
||||||
|
if (dimResourceLocation == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_19_2
|
||||||
|
ResourceKey<Level> dimensionKey = ResourceKey.create(Registries.DIMENSION, dimResourceLocation);
|
||||||
|
#else
|
||||||
|
ResourceKey<Level> dimensionKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, dimResourceLocation);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return dimensionKey;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+82
-2
@@ -26,9 +26,13 @@ import com.mojang.blaze3d.platform.Window;
|
|||||||
#endif
|
#endif
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.NativeDialogUtil;
|
import com.seibel.distanthorizons.common.wrappers.gui.NativeDialogUtil;
|
||||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||||
import com.seibel.distanthorizons.core.file.structure.ClientOnlySaveStructure;
|
import com.seibel.distanthorizons.core.file.structure.ClientOnlySaveStructure;
|
||||||
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IImmersivePortalsAccessor;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
@@ -48,14 +52,20 @@ import net.minecraft.profiler.Profiler;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.world.DimensionType;
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
#else
|
#else
|
||||||
import net.minecraft.CrashReport;
|
import net.minecraft.CrashReport;
|
||||||
import net.minecraft.client.CloudStatus;
|
import net.minecraft.client.CloudStatus;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.util.profiling.ProfilerFiller;
|
import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -74,13 +84,25 @@ import net.minecraft.client.GraphicsStatus;
|
|||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
#elif MC_VER <= MC_1_21_10
|
||||||
|
#else
|
||||||
|
import net.minecraft.resources.Identifier;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_19_2
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
#elif MC_VER > MC_1_12_2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A singleton that wraps the Minecraft object.
|
* A singleton that wraps the Minecraft object.
|
||||||
*
|
*
|
||||||
* @author James Seibel
|
* @author James Seibel
|
||||||
*/
|
*/
|
||||||
public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecraftSharedWrapper
|
public class MinecraftClientWrapper extends AbstractMinecraftSharedWrapper implements IMinecraftClientWrapper
|
||||||
{
|
{
|
||||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
|
|
||||||
@@ -95,6 +117,12 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
|||||||
|
|
||||||
private ProfilerWrapper profilerWrapper;
|
private ProfilerWrapper profilerWrapper;
|
||||||
|
|
||||||
|
/** Delayed accessing is necessary since this object will be created before the mod accessors are bound. */
|
||||||
|
private static class DelayedAccessors
|
||||||
|
{
|
||||||
|
public static final IImmersivePortalsAccessor IMMERSIVE_PORTALS = ModAccessorInjector.INSTANCE.get(IImmersivePortalsAccessor.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//======================//
|
//======================//
|
||||||
@@ -232,6 +260,15 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
|||||||
return new DhBlockPos(0, 0, 0);
|
return new DhBlockPos(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DelayedAccessors.IMMERSIVE_PORTALS != null)
|
||||||
|
{
|
||||||
|
DhBlockPos pos = DelayedAccessors.IMMERSIVE_PORTALS.getActualPlayerBlockPos();
|
||||||
|
if (pos != null)
|
||||||
|
{
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
BlockPos playerPos = player.getPosition();
|
BlockPos playerPos = player.getPosition();
|
||||||
#else
|
#else
|
||||||
@@ -253,7 +290,16 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
|||||||
return new DhChunkPos(0, 0);
|
return new DhChunkPos(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
if (DelayedAccessors.IMMERSIVE_PORTALS != null)
|
||||||
|
{
|
||||||
|
DhChunkPos pos = DelayedAccessors.IMMERSIVE_PORTALS.getActualPlayerChunkPos();
|
||||||
|
if (pos != null)
|
||||||
|
{
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
ChunkPos playerPos = new ChunkPos(player.getPosition());
|
ChunkPos playerPos = new ChunkPos(player.getPosition());
|
||||||
#elif MC_VER < MC_1_17_1
|
#elif MC_VER < MC_1_17_1
|
||||||
ChunkPos playerPos = new ChunkPos(player.blockPosition());
|
ChunkPos playerPos = new ChunkPos(player.blockPosition());
|
||||||
@@ -285,6 +331,16 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
|||||||
@Nullable
|
@Nullable
|
||||||
public IClientLevelWrapper getWrappedClientLevel(boolean bypassLevelKeyManager)
|
public IClientLevelWrapper getWrappedClientLevel(boolean bypassLevelKeyManager)
|
||||||
{
|
{
|
||||||
|
if (!bypassLevelKeyManager
|
||||||
|
&& DelayedAccessors.IMMERSIVE_PORTALS != null)
|
||||||
|
{
|
||||||
|
IClientLevelWrapper level = DelayedAccessors.IMMERSIVE_PORTALS.getActualClientLevelWrapper();
|
||||||
|
if (level != null)
|
||||||
|
{
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
WorldClient level = MINECRAFT.world;
|
WorldClient level = MINECRAFT.world;
|
||||||
#else
|
#else
|
||||||
@@ -583,6 +639,30 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public IServerLevelWrapper getLevelWrapper(String dimensionResourceLocation)
|
||||||
|
{
|
||||||
|
if (!this.hasSinglePlayerServer())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
Integer dimensionKey = this.deserializeDimensionResourceKey(dimensionResourceLocation);
|
||||||
|
if (dimensionKey == null || MINECRAFT.getIntegratedServer() == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
WorldServer mcLevel = MINECRAFT.getIntegratedServer().getWorld(dimensionKey);
|
||||||
|
#else
|
||||||
|
ResourceKey<Level> dimensionKey = this.deserializeDimensionResourceKey(dimensionResourceLocation);
|
||||||
|
ServerLevel mcLevel = MINECRAFT.getSingleplayerServer().getLevel(dimensionKey);
|
||||||
|
#endif
|
||||||
|
return ServerLevelWrapper.getWrapper(mcLevel);
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
@@ -126,6 +126,7 @@ public class MinecraftGLWrapper
|
|||||||
GlStateManager._depthFunc(func);
|
GlStateManager._depthFunc(func);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
public int getActiveDepthFunc() { return GL32.glGetInteger(GL32.GL_DEPTH_FUNC); }
|
||||||
|
|
||||||
/** @see GL32#glDepthMask(boolean) */
|
/** @see GL32#glDepthMask(boolean) */
|
||||||
public void enableDepthMask()
|
public void enableDepthMask()
|
||||||
|
|||||||
+98
-68
@@ -22,28 +22,35 @@ package com.seibel.distanthorizons.common.wrappers.minecraft;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
#if MC_VER > MC_1_12_2
|
#if MC_VER > MC_1_12_2
|
||||||
import com.mojang.blaze3d.pipeline.RenderTarget;
|
import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||||
import com.mojang.blaze3d.platform.NativeImage;
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
#endif
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
#endif
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading;
|
||||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
|
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingApi;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingApi;
|
||||||
import com.seibel.distanthorizons.coreapi.util.ColorUtil;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
|
||||||
|
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
|
#elif MC_VER < MC_1_21_3
|
||||||
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
#elif MC_VER < MC_1_21_6
|
#elif MC_VER < MC_1_21_6
|
||||||
|
import com.seibel.distanthorizons.coreapi.util.ColorUtil;
|
||||||
import net.minecraft.client.renderer.FogRenderer;
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
#else
|
#else
|
||||||
|
import com.seibel.distanthorizons.coreapi.util.ColorUtil;
|
||||||
import net.minecraft.client.renderer.fog.FogData;
|
import net.minecraft.client.renderer.fog.FogData;
|
||||||
import net.minecraft.client.renderer.fog.FogRenderer;
|
import net.minecraft.client.renderer.fog.FogRenderer;
|
||||||
#endif
|
#endif
|
||||||
@@ -57,9 +64,10 @@ import org.joml.Vector3f;
|
|||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IDimensionTypeWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IDimensionTypeWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
import com.seibel.distanthorizons.core.util.math.DhVec3f;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IImmersivePortalsAccessor;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
@@ -112,6 +120,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
public static final MinecraftRenderWrapper INSTANCE = new MinecraftRenderWrapper();
|
public static final MinecraftRenderWrapper INSTANCE = new MinecraftRenderWrapper();
|
||||||
|
|
||||||
private static final IOptifineAccessor OPTIFINE_ACCESSOR = ModAccessorInjector.INSTANCE.get(IOptifineAccessor.class);
|
private static final IOptifineAccessor OPTIFINE_ACCESSOR = ModAccessorInjector.INSTANCE.get(IOptifineAccessor.class);
|
||||||
|
private static final IMinecraftClientWrapper MC_CLIENT = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||||
|
|
||||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
|
|
||||||
@@ -121,6 +130,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
private static final Minecraft MC = Minecraft.getInstance();
|
private static final Minecraft MC = Minecraft.getInstance();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Delayed accessing is necessary since this object will be created before the mod accessors are bound. */
|
||||||
|
private static class DelayedAccessors
|
||||||
|
{
|
||||||
|
public static final IImmersivePortalsAccessor IMMERSIVE_PORTALS = ModAccessorInjector.INSTANCE.get(IImmersivePortalsAccessor.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In the case of immersive portals multiple levels may be active at once, causing conflicting lightmaps. <br>
|
* In the case of immersive portals multiple levels may be active at once, causing conflicting lightmaps. <br>
|
||||||
* Requiring the use of multiple {@link LightMapWrapper}.
|
* Requiring the use of multiple {@link LightMapWrapper}.
|
||||||
@@ -148,20 +163,20 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
//=========//
|
//=========//
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3f getLookAtVector()
|
public DhVec3f getLookAtVector()
|
||||||
{
|
{
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
net.minecraft.util.math.Vec3d lookVector = (MC.getRenderViewEntity().getLook(MC.getRenderPartialTicks()));
|
net.minecraft.util.math.Vec3d lookVector = (MC.getRenderViewEntity().getLook(MC.getRenderPartialTicks()));
|
||||||
return new Vec3f((float) lookVector.x, (float) lookVector.y, (float) lookVector.z);
|
return new DhVec3f((float) lookVector.x, (float) lookVector.y, (float) lookVector.z);
|
||||||
#elif MC_VER <= MC_1_21_10
|
#elif MC_VER <= MC_1_21_10
|
||||||
Camera camera = MC.gameRenderer.getMainCamera();
|
Camera camera = MC.gameRenderer.getMainCamera();
|
||||||
return new Vec3f(camera.getLookVector().x(), camera.getLookVector().y(), camera.getLookVector().z());
|
return new DhVec3f(camera.getLookVector().x(), camera.getLookVector().y(), camera.getLookVector().z());
|
||||||
#elif MC_VER <= MC_26_1_2
|
#elif MC_VER <= MC_26_1_2
|
||||||
Camera camera = MC.gameRenderer.getMainCamera();
|
Camera camera = MC.gameRenderer.getMainCamera();
|
||||||
return new Vec3f(camera.forwardVector().x(), camera.forwardVector().y(), camera.forwardVector().z());
|
return new DhVec3f(camera.forwardVector().x(), camera.forwardVector().y(), camera.forwardVector().z());
|
||||||
#else
|
#else
|
||||||
Camera camera = MC.gameRenderer.mainCamera();
|
Camera camera = MC.gameRenderer.mainCamera();
|
||||||
return new Vec3f(camera.forwardVector().x(), camera.forwardVector().y(), camera.forwardVector().z());
|
return new DhVec3f(camera.forwardVector().x(), camera.forwardVector().y(), camera.forwardVector().z());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,12 +215,30 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3d getCameraExactPosition()
|
public DhVec3d getCameraExactPosition()
|
||||||
{
|
{
|
||||||
|
// When immersive portals is enabled getting the camera position
|
||||||
|
// outside the render thread means you may get the camera for any one of the dimensions
|
||||||
|
// immersive portals is currently rendering, which isn't what DH wants.
|
||||||
|
// We want the camera that the player is currently looking through.
|
||||||
|
if (DelayedAccessors.IMMERSIVE_PORTALS != null
|
||||||
|
&& !RenderThreadTaskHandler.INSTANCE.isCurrentThread())
|
||||||
|
{
|
||||||
|
// this camera position will likely be delayed by 1 frame, so it shouldn't
|
||||||
|
// be used for rendering,
|
||||||
|
// but anything else that doesn't require that level of percision is fine.
|
||||||
|
DhVec3d cameraPos = DelayedAccessors.IMMERSIVE_PORTALS.getActualCameraPos();
|
||||||
|
if (cameraPos != null)
|
||||||
|
{
|
||||||
|
return cameraPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
RenderManager rm = MC.getRenderManager();
|
RenderManager rm = MC.getRenderManager();
|
||||||
return new Vec3d(rm.viewerPosX, rm.viewerPosY, rm.viewerPosZ);
|
return new DhVec3d(rm.viewerPosX, rm.viewerPosY, rm.viewerPosZ);
|
||||||
#elif MC_VER <= MC_26_1_2
|
#else
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
Camera camera = MC.gameRenderer.getMainCamera();
|
Camera camera = MC.gameRenderer.getMainCamera();
|
||||||
#else
|
#else
|
||||||
Camera camera = MC.gameRenderer.mainCamera();
|
Camera camera = MC.gameRenderer.mainCamera();
|
||||||
@@ -216,7 +249,8 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
#else
|
#else
|
||||||
Vec3 projectedView = camera.position();
|
Vec3 projectedView = camera.position();
|
||||||
#endif
|
#endif
|
||||||
return new Vec3d(projectedView.x, projectedView.y, projectedView.z);
|
return new DhVec3d(projectedView.x, projectedView.y, projectedView.z);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -368,8 +402,11 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
float frameTime = this.getPartialTickTime();
|
float frameTime = this.getPartialTickTime();
|
||||||
int argbColorInt = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), frameTime);
|
int argbColorInt = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), frameTime);
|
||||||
return ColorUtil.toColorObjARGB(argbColorInt);
|
return ColorUtil.toColorObjARGB(argbColorInt);
|
||||||
|
#elif MC_VER <= MC_26_1_2
|
||||||
|
int argbColor = MC.level.environmentAttributes().getValue(EnvironmentAttributes.SKY_COLOR, MC.gameRenderer.getMainCamera().position());
|
||||||
|
return new Color(ColorUtil.getRed(argbColor), ColorUtil.getGreen(argbColor), ColorUtil.getBlue(argbColor), 255 /* ignore alpha since DH clouds don't render correctly with transparency */);
|
||||||
#else
|
#else
|
||||||
int argbColor = MC.level.environmentAttributes().getValue(EnvironmentAttributes.SKY_COLOR, BlockPos.ZERO);
|
int argbColor = MC.level.environmentAttributes().getValue(EnvironmentAttributes.SKY_COLOR, MC.gameRenderer.mainCamera().position());
|
||||||
return new Color(ColorUtil.getRed(argbColor), ColorUtil.getGreen(argbColor), ColorUtil.getBlue(argbColor), 255 /* ignore alpha since DH clouds don't render correctly with transparency */);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
@@ -571,9 +608,6 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILightMapWrapper getLightmapWrapper(@NotNull ILevelWrapper level) { return this.lightmapByDimensionType.get(level.getDimensionType()); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFogStateSpecial()
|
public boolean isFogStateSpecial()
|
||||||
{
|
{
|
||||||
@@ -598,94 +632,90 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==========//
|
||||||
|
// lightmap //
|
||||||
|
//==========//
|
||||||
|
//region
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILightMapWrapper getLightmapWrapper(@NotNull ILevelWrapper level) { return this.lightmapByDimensionType.get(level.getDimensionType()); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It's better to use {@link MinecraftRenderWrapper#setLightmapId(int, IClientLevelWrapper)} if possible,
|
* It's better to use {@link MinecraftRenderWrapper#setLightmapId(int)} if possible,
|
||||||
* however old MC versions don't support it.
|
* however old MC versions don't support it.
|
||||||
*/
|
*/
|
||||||
#if MC_VER > MC_1_12_2
|
#if MC_VER > MC_1_12_2
|
||||||
public void updateLightmap(NativeImage lightPixels, IClientLevelWrapper level)
|
public void updateLightmap(NativeImage lightPixels)
|
||||||
{
|
{
|
||||||
|
IClientLevelWrapper clientLevel = getLightmapClientLevelWrapper();
|
||||||
|
if (clientLevel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same
|
// Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same
|
||||||
// object for the same MC level and/or the same hash,
|
// object for the same MC level and/or the same hash,
|
||||||
// so this will have to do for now
|
// so this will have to do for now
|
||||||
IDimensionTypeWrapper dimensionType = level.getDimensionType();
|
IDimensionTypeWrapper dimensionType = clientLevel.getDimensionType();
|
||||||
|
|
||||||
LightMapWrapper wrapper = this.lightmapByDimensionType.computeIfAbsent(dimensionType, (dimType) -> new LightMapWrapper());
|
LightMapWrapper wrapper = this.lightmapByDimensionType.computeIfAbsent(dimensionType, (dimType) -> new LightMapWrapper());
|
||||||
wrapper.uploadLightmap(lightPixels);
|
wrapper.uploadLightmap(lightPixels);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public void setLightmapId(int tetxureId, IClientLevelWrapper level)
|
public void setLightmapId(int textureId)
|
||||||
{
|
{
|
||||||
|
IClientLevelWrapper clientLevel = getLightmapClientLevelWrapper();
|
||||||
|
if (clientLevel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same
|
// Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same
|
||||||
// object for the same MC level and/or the same hash,
|
// object for the same MC level and/or the same hash,
|
||||||
// so this will have to do for now
|
// so this will have to do for now
|
||||||
IDimensionTypeWrapper dimensionType = level.getDimensionType();
|
IDimensionTypeWrapper dimensionType = clientLevel.getDimensionType();
|
||||||
|
|
||||||
LightMapWrapper wrapper = this.lightmapByDimensionType.computeIfAbsent(dimensionType, (dimType) -> new LightMapWrapper());
|
LightMapWrapper wrapper = this.lightmapByDimensionType.computeIfAbsent(dimensionType, (dimType) -> new LightMapWrapper());
|
||||||
wrapper.setLightmapId(tetxureId);
|
wrapper.setLightmapId(textureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_21_10
|
||||||
#else
|
#else
|
||||||
public void setLightmapGpuTexture(GpuTexture gpuTexture, IClientLevelWrapper level)
|
public void setLightmapGpuTexture(GpuTexture gpuTexture)
|
||||||
{
|
{
|
||||||
|
IClientLevelWrapper clientLevel = getLightmapClientLevelWrapper();
|
||||||
|
if (clientLevel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same
|
// Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same
|
||||||
// object for the same MC level and/or the same hash,
|
// object for the same MC level and/or the same hash,
|
||||||
// so this will have to do for now
|
// so this will have to do for now
|
||||||
IDimensionTypeWrapper dimensionType = level.getDimensionType();
|
IDimensionTypeWrapper dimensionType = clientLevel.getDimensionType();
|
||||||
|
|
||||||
LightMapWrapper wrapper = this.lightmapByDimensionType.computeIfAbsent(dimensionType, (dimType) -> new LightMapWrapper());
|
LightMapWrapper wrapper = this.lightmapByDimensionType.computeIfAbsent(dimensionType, (dimType) -> new LightMapWrapper());
|
||||||
wrapper.setLightmapGpuTexture(gpuTexture);
|
wrapper.setLightmapGpuTexture(gpuTexture);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@Override
|
/** special logic is necessary in order for Immersive Portals to work correctly */
|
||||||
public float getShade(EDhDirection lodDirection)
|
private static @Nullable IClientLevelWrapper getLightmapClientLevelWrapper()
|
||||||
{
|
{
|
||||||
EDhApiLodShading lodShading = Config.Client.Advanced.Graphics.Quality.lodShading.get();
|
IClientLevelWrapper clientLevel = ClientApi.RENDER_STATE.clientLevelWrapper;
|
||||||
switch (lodShading)
|
if (clientLevel == null)
|
||||||
{
|
{
|
||||||
default:
|
clientLevel = MC_CLIENT.getWrappedClientLevel();
|
||||||
case AUTO:
|
|
||||||
#if MC_VER <= MC_1_12_2
|
|
||||||
// 1.12.2 has no getShade, fall through to ENABLED
|
|
||||||
#else
|
|
||||||
if (MC.level != null)
|
|
||||||
{
|
|
||||||
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
|
||||||
#if MC_VER <= MC_1_21_11
|
|
||||||
return MC.level.getShade(mcDir, true);
|
|
||||||
#else
|
|
||||||
return MC.level.cardinalLighting().byFace(mcDir);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return clientLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+46
-2
@@ -1,12 +1,34 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.minecraft;
|
package com.seibel.distanthorizons.common.wrappers.minecraft;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
|
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||||
import net.minecraft.server.dedicated.DedicatedServer;
|
import net.minecraft.server.dedicated.DedicatedServer;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_12_2
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
#elif MC_VER <= MC_1_21_10
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
#else
|
||||||
|
import net.minecraft.resources.Identifier;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_19_2
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
#elif MC_VER > MC_1_12_2
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
#endif
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class MinecraftServerWrapper implements IMinecraftSharedWrapper
|
public class MinecraftServerWrapper extends AbstractMinecraftSharedWrapper
|
||||||
{
|
{
|
||||||
public static final MinecraftServerWrapper INSTANCE = new MinecraftServerWrapper();
|
public static final MinecraftServerWrapper INSTANCE = new MinecraftServerWrapper();
|
||||||
|
|
||||||
@@ -64,5 +86,27 @@ public class MinecraftServerWrapper implements IMinecraftSharedWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public IServerLevelWrapper getLevelWrapper(String dimensionResourceLocation)
|
||||||
|
{
|
||||||
|
if (this.dedicatedServer == null)
|
||||||
|
{
|
||||||
|
throw new IllegalStateException("Trying to get the server mcLevel before dedicated server completed initialization!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
Integer dimensionKey = this.deserializeDimensionResourceKey(dimensionResourceLocation);
|
||||||
|
if (dimensionKey == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
WorldServer mcLevel = dedicatedServer.getWorld(dimensionKey);
|
||||||
|
#else
|
||||||
|
ResourceKey<Level> dimensionKey = this.deserializeDimensionResourceKey(dimensionResourceLocation);
|
||||||
|
ServerLevel mcLevel = dedicatedServer.getLevel(dimensionKey);
|
||||||
|
#endif
|
||||||
|
return ServerLevelWrapper.getWrapper(mcLevel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -5,7 +5,7 @@ import com.google.common.collect.MapMaker;
|
|||||||
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.network.NetHandlerPlayServer;
|
import net.minecraft.network.NetHandlerPlayServer;
|
||||||
@@ -19,7 +19,6 @@ import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import java.net.SocketAddress;
|
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
@@ -126,14 +125,14 @@ public class ServerPlayerWrapper implements IServerPlayerWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3d getPosition()
|
public DhVec3d getPosition()
|
||||||
{
|
{
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
BlockPos position = this.getServerPlayer().getPosition();
|
BlockPos position = this.getServerPlayer().getPosition();
|
||||||
return new Vec3d(position.getX(), position.getY(), position.getZ());
|
return new DhVec3d(position.getX(), position.getY(), position.getZ());
|
||||||
#else
|
#else
|
||||||
Vec3 position = this.getServerPlayer().position();
|
Vec3 position = this.getServerPlayer().position();
|
||||||
return new Vec3d(position.x, position.y, position.z);
|
return new DhVec3d(position.x, position.y, position.z);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+75
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod
|
||||||
|
* licensed under the GNU LGPL v3 License.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 James Seibel
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.seibel.distanthorizons.common.wrappers.modAccessor;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public abstract class AbstractImmersivePortalsAccessorCommon {}
|
||||||
|
|
||||||
|
#else
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||||
|
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||||
|
import com.seibel.distanthorizons.core.util.math.DhVec3d;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractImmersivePortalsAccessor;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
#if MC_VER > MC_1_19_2
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_17_1
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public abstract class AbstractImmersivePortalsAccessorCommon extends AbstractImmersivePortalsAccessor
|
||||||
|
{
|
||||||
|
// We don't use the fields in RenderStates because they are not volatile.
|
||||||
|
@Nullable
|
||||||
|
public static volatile ClientLevel actualLevel;
|
||||||
|
@Nullable
|
||||||
|
public static volatile DhBlockPos actualBlockPos;
|
||||||
|
@Nullable
|
||||||
|
public static volatile DhChunkPos actualChunkPos;
|
||||||
|
@Nullable
|
||||||
|
public static volatile DhVec3d actualCameraPos;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public DhBlockPos getActualPlayerBlockPos() { return actualBlockPos; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public DhChunkPos getActualPlayerChunkPos() { return actualChunkPos; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public IClientLevelWrapper getActualClientLevelWrapper() { return ClientLevelWrapper.getWrapper(actualLevel, false); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public DhVec3d getActualCameraPos() { return actualCameraPos; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
+178
-21
@@ -1,5 +1,6 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.world;
|
package com.seibel.distanthorizons.common.wrappers.world;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading;
|
||||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiLevelType;
|
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiLevelType;
|
||||||
import com.seibel.distanthorizons.api.interfaces.block.IDhApiBiomeWrapper;
|
import com.seibel.distanthorizons.api.interfaces.block.IDhApiBiomeWrapper;
|
||||||
import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper;
|
import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper;
|
||||||
@@ -9,13 +10,20 @@ import com.seibel.distanthorizons.api.objects.data.IDhApiFullDataSource;
|
|||||||
import com.seibel.distanthorizons.common.wrappers.block.BiomeWrapper;
|
import com.seibel.distanthorizons.common.wrappers.block.BiomeWrapper;
|
||||||
import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper;
|
import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper;
|
||||||
import com.seibel.distanthorizons.common.wrappers.block.ClientBlockStateColorCache;
|
import com.seibel.distanthorizons.common.wrappers.block.ClientBlockStateColorCache;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.level.KeyedClientLevelManager;
|
||||||
|
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||||
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
|
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||||
import com.seibel.distanthorizons.core.level.*;
|
import com.seibel.distanthorizons.core.level.*;
|
||||||
import com.seibel.distanthorizons.core.level.IServerKeyedClientLevel;
|
import com.seibel.distanthorizons.core.level.IServerKeyedClientLevel;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPosMutable;
|
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPosMutable;
|
||||||
|
import com.seibel.distanthorizons.core.util.TimerUtil;
|
||||||
|
import com.seibel.distanthorizons.core.world.AbstractDhWorld;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
@@ -32,6 +40,7 @@ import net.minecraft.block.state.IBlockState;
|
|||||||
#else
|
#else
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
#endif
|
#endif
|
||||||
@@ -44,9 +53,7 @@ import java.awt.*;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.WeakHashMap;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@@ -80,7 +87,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
private static final Map<
|
private static final Map<
|
||||||
#if MC_VER <= MC_1_12_2 WorldClient #else ClientLevel #endif,
|
#if MC_VER <= MC_1_12_2 WorldClient #else ClientLevel #endif,
|
||||||
WeakReference<ClientLevelWrapper>> LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL = Collections.synchronizedMap(new WeakHashMap<>());
|
WeakReference<ClientLevelWrapper>> LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL = Collections.synchronizedMap(new WeakHashMap<>());
|
||||||
private static final IKeyedClientLevelManager KEYED_CLIENT_LEVEL_MANAGER = SingletonInjector.INSTANCE.get(IKeyedClientLevelManager.class);
|
private static final KeyedClientLevelManager KEYED_CLIENT_LEVEL_MANAGER = (KeyedClientLevelManager) SingletonInjector.INSTANCE.get(IKeyedClientLevelManager.class);
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
private static final Minecraft MINECRAFT = Minecraft.getMinecraft();
|
private static final Minecraft MINECRAFT = Minecraft.getMinecraft();
|
||||||
@@ -90,6 +97,12 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
|
|
||||||
private static final ThreadLocal<DhBlockPosMutable> MUTABLE_BLOCK_POS_THREAD_LOCAL = ThreadLocal.withInitial(DhBlockPosMutable::new);
|
private static final ThreadLocal<DhBlockPosMutable> MUTABLE_BLOCK_POS_THREAD_LOCAL = ThreadLocal.withInitial(DhBlockPosMutable::new);
|
||||||
|
|
||||||
|
private static final Timer CLIENT_CLEANUP_TIMER = TimerUtil.CreateTimer("ClientLevelTickCleanup");
|
||||||
|
private static final TimerTask CLIENT_CLEANUP_TASK = TimerUtil.createTimerTask(ClientLevelWrapper::tickCleanup);
|
||||||
|
|
||||||
|
/** how long in milliseconds can a level be unused before it's automatically unloaded */
|
||||||
|
private static final long INACTIVE_TIME_BEFORE_UNLOADED_IN_MS = 30 * 1000;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
@@ -110,8 +123,9 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
|
|
||||||
private boolean cloudColorFailLogged = false;
|
private boolean cloudColorFailLogged = false;
|
||||||
|
|
||||||
private BlockStateWrapper dirtBlockWrapper;
|
private volatile BlockStateWrapper dirtBlockWrapper;
|
||||||
private IDhLevel dhLevel;
|
private volatile IDhLevel dhLevel;
|
||||||
|
private volatile long lastAccessTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -126,11 +140,88 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================//
|
//======================//
|
||||||
// instance methods //
|
// inactivity unloading //
|
||||||
//==================//
|
//======================//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void markAccessed() { this.lastAccessTime = System.currentTimeMillis(); }
|
||||||
|
public synchronized long getLastAccessTime() { return this.lastAccessTime; }
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
// fire 20 times per second (i.e. 50ms interval)
|
||||||
|
CLIENT_CLEANUP_TIMER.scheduleAtFixedRate(CLIENT_CLEANUP_TASK, 0, 1000 / 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void tickCleanup()
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
WorldClient clientLevel = MINECRAFT.world;
|
||||||
|
#else
|
||||||
|
ClientLevel clientLevel = MINECRAFT.level;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (clientLevel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
ArrayList<ClientLevelWrapper> levelsToUnload = new ArrayList<>();
|
||||||
|
synchronized(LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL) // should only be run on one thread at a time, but just in case
|
||||||
|
{
|
||||||
|
for (WeakReference<ClientLevelWrapper> ref : LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL.values())
|
||||||
|
{
|
||||||
|
ClientLevelWrapper levelWrapper = ref.get();
|
||||||
|
if (levelWrapper != null
|
||||||
|
&& levelWrapper.level != clientLevel)
|
||||||
|
{
|
||||||
|
// We use the synchronized getter to prevent race conditions with markAccessed()
|
||||||
|
long inactiveTimeMs = currentTime - levelWrapper.getLastAccessTime();
|
||||||
|
if (inactiveTimeMs > INACTIVE_TIME_BEFORE_UNLOADED_IN_MS)
|
||||||
|
{
|
||||||
|
levelsToUnload.add(levelWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ClientLevelWrapper wrapper : levelsToUnload)
|
||||||
|
{
|
||||||
|
// Re-verify all conditions inside a synchronized block on the wrapper
|
||||||
|
// to ensure atomicity with respect to markAccessed()
|
||||||
|
synchronized(wrapper)
|
||||||
|
{
|
||||||
|
long inactiveTimeMs = currentTime - wrapper.getLastAccessTime();
|
||||||
|
if (wrapper.level != clientLevel
|
||||||
|
&& inactiveTimeMs > INACTIVE_TIME_BEFORE_UNLOADED_IN_MS)
|
||||||
|
{
|
||||||
|
LOGGER.debug("Unloading level [" + wrapper.getDhIdentifier() + "] due to inactivity");
|
||||||
|
wrapper.tryUnloadFromWorld();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================//
|
||||||
|
// level handling //
|
||||||
|
//================//
|
||||||
|
//region
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDhLevel(IDhLevel dhLevel) { this.dhLevel = dhLevel; }
|
||||||
|
@Override
|
||||||
|
public IDhLevel getDhLevel() { return this.dhLevel; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* can be used when speed is important and the same level is likely to be passed in,
|
* can be used when speed is important and the same level is likely to be passed in,
|
||||||
* IE rendering.
|
* IE rendering.
|
||||||
@@ -140,9 +231,13 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
@Nullable IClientLevelWrapper levelWrapper,
|
@Nullable IClientLevelWrapper levelWrapper,
|
||||||
@NotNull #if MC_VER <= MC_1_12_2 WorldClient #else ClientLevel #endif level)
|
@NotNull #if MC_VER <= MC_1_12_2 WorldClient #else ClientLevel #endif level)
|
||||||
{
|
{
|
||||||
if (KEYED_CLIENT_LEVEL_MANAGER.isEnabled() && KEYED_CLIENT_LEVEL_MANAGER.getServerKeyedLevel() != levelWrapper)
|
if (KEYED_CLIENT_LEVEL_MANAGER.isEnabled())
|
||||||
{
|
{
|
||||||
return getWrapper(level);
|
IServerKeyedClientLevel keyedLevel = KEYED_CLIENT_LEVEL_MANAGER.getServerKeyedLevel(getWrapper(level, true));
|
||||||
|
if (keyedLevel != levelWrapper)
|
||||||
|
{
|
||||||
|
return getWrapper(level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientLevelWrapper clientLevelWrapper = (ClientLevelWrapper)levelWrapper;
|
ClientLevelWrapper clientLevelWrapper = (ClientLevelWrapper)levelWrapper;
|
||||||
@@ -172,9 +267,28 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// used if the client is connected to a server that defines the currently loaded level
|
// used if the client is connected to a server that defines the currently loaded level
|
||||||
IServerKeyedClientLevel overrideLevel = KEYED_CLIENT_LEVEL_MANAGER.getServerKeyedLevel();
|
IServerKeyedClientLevel overrideLevel = KEYED_CLIENT_LEVEL_MANAGER.getServerKeyedLevel(getWrapper(level, true));
|
||||||
if (overrideLevel != null)
|
if (overrideLevel != null)
|
||||||
{
|
{
|
||||||
|
// if the currently loaded level wrapper doesn't match what's incoming, unload it
|
||||||
|
WeakReference<ClientLevelWrapper> levelRef = LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL.get(level);
|
||||||
|
if (levelRef != null
|
||||||
|
&& levelRef.get() != overrideLevel)
|
||||||
|
{
|
||||||
|
ClientLevelWrapper levelWrapper = levelRef.get();
|
||||||
|
if (levelWrapper != null)
|
||||||
|
{
|
||||||
|
levelWrapper.tryUnloadFromWorld();
|
||||||
|
}
|
||||||
|
levelRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (levelRef == null
|
||||||
|
&& overrideLevel instanceof ClientLevelWrapper)
|
||||||
|
{
|
||||||
|
LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL.put(level, new WeakReference<>((ClientLevelWrapper) overrideLevel));
|
||||||
|
}
|
||||||
|
|
||||||
return overrideLevel;
|
return overrideLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,7 +451,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
this.dimensionName = this.level.provider.getDimensionType().getName();
|
this.dimensionName = this.level.provider.getDimensionType().getName() + ":" + this.level.provider.getDimension();
|
||||||
#elif MC_VER <= MC_1_21_10
|
#elif MC_VER <= MC_1_21_10
|
||||||
this.dimensionName = this.level.dimension().location().toString();
|
this.dimensionName = this.level.dimension().location().toString();
|
||||||
#else
|
#else
|
||||||
@@ -443,6 +557,15 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
@Override
|
@Override
|
||||||
public #if MC_VER <= MC_1_12_2 WorldClient #else ClientLevel #endif getWrappedMcObject() { return this.level; }
|
public #if MC_VER <= MC_1_12_2 WorldClient #else ClientLevel #endif getWrappedMcObject() { return this.level; }
|
||||||
|
|
||||||
|
private void tryUnloadFromWorld()
|
||||||
|
{
|
||||||
|
AbstractDhWorld world = SharedApi.getAbstractDhWorld();
|
||||||
|
if (world == null
|
||||||
|
|| !world.unloadLevel(this))
|
||||||
|
{
|
||||||
|
this.onUnload();
|
||||||
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onUnload()
|
public void onUnload()
|
||||||
{
|
{
|
||||||
@@ -504,16 +627,11 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===================//
|
//===========//
|
||||||
// generic rendering //
|
// rendering //
|
||||||
//===================//
|
//===========//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDhLevel(IDhLevel dhLevel) { this.dhLevel = dhLevel; }
|
|
||||||
@Override
|
|
||||||
public IDhLevel getDhLevel() { return this.dhLevel; }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDhApiCustomRenderRegister getRenderRegister()
|
public IDhApiCustomRenderRegister getRenderRegister()
|
||||||
{
|
{
|
||||||
@@ -604,6 +722,45 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getShade(EDhDirection lodDirection)
|
||||||
|
{
|
||||||
|
EDhApiLodShading lodShading = Config.Client.Advanced.Graphics.Quality.lodShading.get();
|
||||||
|
switch (lodShading)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case AUTO:
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
// 1.12.2 level doesn't have a getShade method, fall through to ENABLED
|
||||||
|
#else
|
||||||
|
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
return this.level.getShade(mcDir, true);
|
||||||
|
#else
|
||||||
|
return this.level.cardinalLighting().byFace(mcDir);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -83,7 +83,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper
|
|||||||
* this name is cached to prevent issues during shutdown where
|
* this name is cached to prevent issues during shutdown where
|
||||||
* the server variables needed may no longer be available.
|
* the server variables needed may no longer be available.
|
||||||
*/
|
*/
|
||||||
private final String KeyedLevelDimensionName;
|
private final String keyedLevelDimensionName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper
|
|||||||
public ServerLevelWrapper(#if MC_VER <= MC_1_12_2 WorldServer #else ServerLevel #endif level)
|
public ServerLevelWrapper(#if MC_VER <= MC_1_12_2 WorldServer #else ServerLevel #endif level)
|
||||||
{
|
{
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.KeyedLevelDimensionName = this.createKeyedLevelDimensionName();
|
this.keyedLevelDimensionName = this.createKeyedLevelDimensionName();
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
@@ -137,7 +137,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKeyedLevelDimensionName() { return this.KeyedLevelDimensionName; }
|
public String getKeyedLevelDimensionName() { return this.keyedLevelDimensionName; }
|
||||||
|
|
||||||
private String createKeyedLevelDimensionName()
|
private String createKeyedLevelDimensionName()
|
||||||
{
|
{
|
||||||
@@ -210,7 +210,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper
|
|||||||
public String getDimensionName()
|
public String getDimensionName()
|
||||||
{
|
{
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
return this.level.provider.getDimensionType().getName();
|
return this.level.provider.getDimensionType().getName() + ":" + this.level.provider.getDimension();
|
||||||
#elif MC_VER <= MC_1_21_10
|
#elif MC_VER <= MC_1_21_10
|
||||||
return this.level.dimension().location().toString();
|
return this.level.dimension().location().toString();
|
||||||
#else
|
#else
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,6 @@ import java.util.concurrent.*;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -78,6 +77,7 @@ import net.minecraft.world.level.chunk.*;
|
|||||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
||||||
import net.minecraft.world.level.levelgen.FlatLevelSource;
|
import net.minecraft.world.level.levelgen.FlatLevelSource;
|
||||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||||
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -437,14 +437,16 @@ public class InternalServerGenerator
|
|||||||
throw new IllegalStateException("No chunk chunkHolder for pos ["+chunkPos+"] after ticket has been added.");
|
throw new IllegalStateException("No chunk chunkHolder for pos ["+chunkPos+"] after ticket has been added.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: ChunkStatus.FEATURES would be slightly faster than FULL, but can cause issues
|
||||||
|
// with other mods where they need lighting/full chunk data.
|
||||||
#if MC_VER <= MC_1_20_4
|
#if MC_VER <= MC_1_20_4
|
||||||
return chunkHolder.getOrScheduleFuture(ChunkStatus.FEATURES, level.getChunkSource().chunkMap)
|
return chunkHolder.getOrScheduleFuture(ChunkStatus.FULL, level.getChunkSource().chunkMap)
|
||||||
.thenApply(result -> result.left().orElseThrow(() -> new RuntimeException(result.right().get().toString()))); // can throw if the server is shutting down
|
.thenApply(result -> result.left().orElseThrow(() -> new RuntimeException(result.right().get().toString()))); // can throw if the server is shutting down
|
||||||
#elif MC_VER <= MC_1_20_6
|
#elif MC_VER <= MC_1_20_6
|
||||||
return chunkHolder.getOrScheduleFuture(ChunkStatus.FEATURES, level.getChunkSource().chunkMap)
|
return chunkHolder.getOrScheduleFuture(ChunkStatus.FULL, level.getChunkSource().chunkMap)
|
||||||
.thenApply(result -> result.orElseThrow(() -> new RuntimeException(result.toString()))); // can throw if the server is shutting down
|
.thenApply(result -> result.orElseThrow(() -> new RuntimeException(result.toString()))); // can throw if the server is shutting down
|
||||||
#else
|
#else
|
||||||
return chunkHolder.scheduleChunkGenerationTask(ChunkStatus.FEATURES, level.getChunkSource().chunkMap)
|
return chunkHolder.scheduleChunkGenerationTask(ChunkStatus.FULL, level.getChunkSource().chunkMap)
|
||||||
.thenApply(result -> result.orElseThrow(() -> new RuntimeException(result.getError()))); // can throw if the server is shutting down
|
.thenApply(result -> result.orElseThrow(() -> new RuntimeException(result.getError()))); // can throw if the server is shutting down
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ public net.minecraft.client.renderer.ActiveRenderInfo MODELVIEW
|
|||||||
public net.minecraft.client.renderer.ActiveRenderInfo PROJECTION
|
public net.minecraft.client.renderer.ActiveRenderInfo PROJECTION
|
||||||
public net.minecraft.client.gui.GuiSlot amountScrolled
|
public net.minecraft.client.gui.GuiSlot amountScrolled
|
||||||
public net.minecraft.world.gen.ChunkProviderServer droppedChunks
|
public net.minecraft.world.gen.ChunkProviderServer droppedChunks
|
||||||
|
public net.minecraft.world.chunk.Chunk dirty
|
||||||
+1
-1
Submodule coreSubProjects updated: 9231a48998...0b802ca362
+1
-22
@@ -46,28 +46,7 @@ dependencies {
|
|||||||
addMod("com.github.quiqueck:BCLib:${rootProject.bclib_version}", rootProject.enable_bclib)
|
addMod("com.github.quiqueck:BCLib:${rootProject.bclib_version}", rootProject.enable_bclib)
|
||||||
|
|
||||||
// Canvas
|
// Canvas
|
||||||
addMod("io.vram:canvas-fabric-${rootProject.canvas_version}", rootProject.enable_canvas)
|
addMod("io.vram:canvas-fabric-${project.canvas_version}", rootProject.enable_canvas)
|
||||||
|
|
||||||
// Immersive Portals
|
|
||||||
if (rootProject.enable_immersive_portals == "1") {
|
|
||||||
modCompileOnly("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version}")
|
|
||||||
}
|
|
||||||
else if (rootProject.enable_immersive_portals == "2") {
|
|
||||||
modImplementation ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version}") {
|
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
|
||||||
transitive(false)
|
|
||||||
}
|
|
||||||
modImplementation("com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:${rootProject.immersive_portals_version}") {
|
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
|
||||||
transitive(false)
|
|
||||||
}
|
|
||||||
modImplementation("com.github.iPortalTeam.ImmersivePortalsMod:build:${rootProject.immersive_portals_version}") {
|
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
|
||||||
transitive(false)
|
|
||||||
}
|
|
||||||
api("com.github.LlamaLad7:MixinExtras:0.2.0-beta.4")
|
|
||||||
annotationProcessor("com.github.LlamaLad7:MixinExtras:0.2.0-beta.4")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
|||||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
|||||||
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
||||||
this.tryCreateModCompatAccessor("bclib", IBCLibAccessor.class, BCLibAccessor::new);
|
this.tryCreateModCompatAccessor("bclib", IBCLibAccessor.class, BCLibAccessor::new);
|
||||||
this.tryCreateModCompatAccessor("c2me", IC2meAccessor.class, C2meAccessor::new);
|
this.tryCreateModCompatAccessor("c2me", IC2meAccessor.class, C2meAccessor::new);
|
||||||
|
this.tryCreateModCompatAccessor("imm_ptl_core", IImmersivePortalsAccessor.class, ImmersivePortalsAccessorFabric::new);
|
||||||
#if MC_VER >= MC_1_19_4
|
#if MC_VER >= MC_1_19_4
|
||||||
// 1.19.4 is the lowest version Iris supports DH
|
// 1.19.4 is the lowest version Iris supports DH
|
||||||
this.tryCreateModCompatAccessor("iris", IIrisAccessor.class, IrisAccessor::new);
|
this.tryCreateModCompatAccessor("iris", IIrisAccessor.class, IrisAccessor::new);
|
||||||
|
|||||||
+4
-4
@@ -32,7 +32,6 @@ public class MixinClientPacketListener
|
|||||||
void onHandleLoginEnd(CallbackInfo ci)
|
void onHandleLoginEnd(CallbackInfo ci)
|
||||||
{
|
{
|
||||||
ClientApi.INSTANCE.onClientOnlyConnected();
|
ClientApi.INSTANCE.onClientOnlyConnected();
|
||||||
ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER < MC_1_19_4
|
#if MC_VER < MC_1_19_4
|
||||||
@@ -61,11 +60,12 @@ public class MixinClientPacketListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Important to get the level from the chunk because the client level might be different if Immersive Portals is present.
|
||||||
|
ClientLevel clientLevel = (ClientLevel) chunk.getLevel();
|
||||||
executor.execute(() ->
|
executor.execute(() ->
|
||||||
{
|
{
|
||||||
IClientLevelWrapper clientLevel = ClientLevelWrapper.getWrapper((ClientLevel) this.level);
|
IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel);
|
||||||
SharedApi.INSTANCE.applyChunkUpdate(new ChunkWrapper(chunk, clientLevel), clientLevel);
|
SharedApi.INSTANCE.applyChunkUpdate(new ChunkWrapper(chunk, clientLevelWrapper), clientLevelWrapper);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.seibel.distanthorizons.fabric.mixins.client;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.commonMixins.MixinImmersivePortalsRenderStatesCommon;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Pseudo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Pseudo
|
||||||
|
#if MC_VER > MC_1_16_5
|
||||||
|
@Mixin(targets = "qouteall.imm_ptl.core.render.context_management.RenderStates")
|
||||||
|
#else
|
||||||
|
@Mixin(targets = "com.qouteall.immersive_portals.render.context_management.RenderStates")
|
||||||
|
#endif
|
||||||
|
public class MixinImmersivePortalsRenderStates
|
||||||
|
{
|
||||||
|
|
||||||
|
@Inject(method = "updatePreRenderInfo", at = @At("HEAD"))
|
||||||
|
private static void preRender(CallbackInfo ci)
|
||||||
|
{ MixinImmersivePortalsRenderStatesCommon.saveVolatileOriginals(); }
|
||||||
|
|
||||||
|
}
|
||||||
+6
-7
@@ -20,14 +20,15 @@
|
|||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.fabric.mixins.client;
|
||||||
|
|
||||||
#if MC_VER < MC_1_19_4
|
#if MC_VER < MC_1_19_4
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
|
import com.seibel.distanthorizons.core.util.math.DhVec3f;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.math.Matrix4f;
|
import com.mojang.math.Matrix4f;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
#elif MC_VER < MC_1_21_6
|
#elif MC_VER < MC_1_21_6
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
@@ -36,7 +37,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||||
import com.mojang.blaze3d.framegraph.FrameGraphBuilder;
|
import com.mojang.blaze3d.framegraph.FrameGraphBuilder;
|
||||||
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
|
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
import net.minecraft.client.DeltaTracker;
|
import net.minecraft.client.DeltaTracker;
|
||||||
import net.minecraft.client.renderer.chunk.ChunkSectionsToRender;
|
import net.minecraft.client.renderer.chunk.ChunkSectionsToRender;
|
||||||
@@ -152,7 +153,7 @@ public class MixinLevelRenderer
|
|||||||
// get the matrices from the OpenGL fixed pipeline
|
// get the matrices from the OpenGL fixed pipeline
|
||||||
float[] mcProjMatrixRaw = new float[16];
|
float[] mcProjMatrixRaw = new float[16];
|
||||||
GL32.glGetFloatv(GL32.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
GL32.glGetFloatv(GL32.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix = new Mat4f(mcProjMatrixRaw);
|
ClientApi.RENDER_STATE.mcProjectionMatrix = new DhMat4f(mcProjMatrixRaw);
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix.transpose();
|
ClientApi.RENDER_STATE.mcProjectionMatrix.transpose();
|
||||||
|
|
||||||
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
||||||
@@ -164,7 +165,7 @@ public class MixinLevelRenderer
|
|||||||
#elif MC_VER < MC_1_21_9
|
#elif MC_VER < MC_1_21_9
|
||||||
// MC combined the model view and projection matricies
|
// MC combined the model view and projection matricies
|
||||||
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(projectionMatrix);
|
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix = new Mat4f();
|
ClientApi.RENDER_STATE.mcProjectionMatrix = new DhMat4f();
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix.setIdentity();
|
ClientApi.RENDER_STATE.mcProjectionMatrix.setIdentity();
|
||||||
#else
|
#else
|
||||||
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(positionMatrix);
|
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(positionMatrix);
|
||||||
@@ -174,8 +175,6 @@ public class MixinLevelRenderer
|
|||||||
ClientApi.RENDER_STATE.partialTickTime = MinecraftRenderWrapper.INSTANCE.getPartialTickTime();
|
ClientApi.RENDER_STATE.partialTickTime = MinecraftRenderWrapper.INSTANCE.getPartialTickTime();
|
||||||
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, this.level);
|
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, this.level);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_21_6
|
#if MC_VER < MC_1_21_6
|
||||||
if (renderType.equals(RenderType.translucent()))
|
if (renderType.equals(RenderType.translucent()))
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-19
@@ -20,6 +20,7 @@
|
|||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.fabric.mixins.client;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
@@ -85,18 +86,6 @@ public class MixinLightTexture
|
|||||||
public void render(LightmapRenderState renderState, CallbackInfo ci)
|
public void render(LightmapRenderState renderState, CallbackInfo ci)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
if (mc == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
if (clientLevel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// lazy initialization to make sure we don't call this too early
|
// lazy initialization to make sure we don't call this too early
|
||||||
if (this.renderWrapper == null)
|
if (this.renderWrapper == null)
|
||||||
{
|
{
|
||||||
@@ -105,29 +94,29 @@ public class MixinLightTexture
|
|||||||
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_21_3
|
#if MC_VER < MC_1_21_3
|
||||||
this.renderWrapper.updateLightmap(this.lightPixels, clientLevel);
|
this.renderWrapper.updateLightmap(this.lightPixels);
|
||||||
#elif MC_VER < MC_1_21_5
|
#elif MC_VER < MC_1_21_5
|
||||||
this.renderWrapper.setLightmapId(this.target.getColorTextureId(), clientLevel);
|
this.renderWrapper.setLightmapId(this.target.getColorTextureId());
|
||||||
#elif MC_VER <= MC_1_21_10
|
#elif MC_VER <= MC_1_21_10
|
||||||
GlTexture glTexture = (GlTexture) this.texture;
|
GlTexture glTexture = (GlTexture) this.texture;
|
||||||
this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
this.renderWrapper.setLightmapId(glTexture.glId());
|
||||||
#elif MC_VER <= MC_26_1_2
|
#elif MC_VER <= MC_26_1_2
|
||||||
// both options are available since the renderer can be changed to either Blaze3D or OpenGL
|
// both options are available since the renderer can be changed to either Blaze3D or OpenGL
|
||||||
GlTexture glTexture = (GlTexture) this.texture;
|
GlTexture glTexture = (GlTexture) this.texture;
|
||||||
this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
this.renderWrapper.setLightmapId(glTexture.glId());
|
||||||
|
|
||||||
this.renderWrapper.setLightmapGpuTexture(this.texture, clientLevel);
|
this.renderWrapper.setLightmapGpuTexture(this.texture);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// this will only be used when using native GL rendering
|
// this will only be used when using native GL rendering
|
||||||
if (this.texture instanceof GlTexture)
|
if (this.texture instanceof GlTexture)
|
||||||
{
|
{
|
||||||
GlTexture glTexture = (GlTexture) this.texture;
|
GlTexture glTexture = (GlTexture) this.texture;
|
||||||
this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
this.renderWrapper.setLightmapId(glTexture.glId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// this will be used for Blaze3D OpenGL and Vulkan
|
// this will be used for Blaze3D OpenGL and Vulkan
|
||||||
this.renderWrapper.setLightmapGpuTexture(this.texture, clientLevel);
|
this.renderWrapper.setLightmapGpuTexture(this.texture);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-18
@@ -3,8 +3,6 @@ package com.seibel.distanthorizons.fabric.mixins.client;
|
|||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
||||||
import com.seibel.distanthorizons.common.commonMixins.DhUpdateScreenBase;
|
import com.seibel.distanthorizons.common.commonMixins.DhUpdateScreenBase;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen;
|
||||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.jar.installer.GitlabGetter;
|
import com.seibel.distanthorizons.core.jar.installer.GitlabGetter;
|
||||||
@@ -107,22 +105,6 @@ public abstract class MixinMinecraft
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "updateLevelInEngines")
|
|
||||||
public void updateLevelInEngines(ClientLevel level, CallbackInfo ci)
|
|
||||||
{
|
|
||||||
if (this.lastLevel != null && level != this.lastLevel)
|
|
||||||
{
|
|
||||||
ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.lastLevel));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (level != null)
|
|
||||||
{
|
|
||||||
ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(level, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.lastLevel = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "close()V")
|
@Inject(at = @At("HEAD"), method = "close()V")
|
||||||
public void close(CallbackInfo ci) { SelfUpdater.onClose(); }
|
public void close(CallbackInfo ci) { SelfUpdater.onClose(); }
|
||||||
|
|
||||||
|
|||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod
|
||||||
|
* licensed under the GNU LGPL v3 License.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 James Seibel
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.seibel.distanthorizons.fabric.wrappers.modAccessor;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.modAccessor.AbstractImmersivePortalsAccessorCommon;
|
||||||
|
|
||||||
|
public class ImmersivePortalsAccessorFabric extends AbstractImmersivePortalsAccessorCommon
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
"client.MixinDebugScreenOverlay",
|
"client.MixinDebugScreenOverlay",
|
||||||
"client.MixinFogRenderer",
|
"client.MixinFogRenderer",
|
||||||
"client.MixinGameRenderer",
|
"client.MixinGameRenderer",
|
||||||
|
"client.MixinImmersivePortalsRenderStates",
|
||||||
"client.MixinLevelRenderer",
|
"client.MixinLevelRenderer",
|
||||||
"client.MixinChunkSectionsToRender",
|
"client.MixinChunkSectionsToRender",
|
||||||
"client.MixinLightTexture",
|
"client.MixinLightTexture",
|
||||||
|
|||||||
@@ -106,60 +106,6 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
|
||||||
// world events //
|
|
||||||
//==============//
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
public void clientLevelLoadEvent(WorldEvent.Load event)
|
|
||||||
#else
|
|
||||||
public void clientLevelLoadEvent(LevelEvent.Load event)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
LOGGER.info("level load");
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
LevelAccessor level = event.getWorld();
|
|
||||||
#else
|
|
||||||
LevelAccessor level = event.getLevel();
|
|
||||||
#endif
|
|
||||||
if (!(level instanceof ClientLevel))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientLevel clientLevel = (ClientLevel) level;
|
|
||||||
IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel, true);
|
|
||||||
ClientApi.INSTANCE.clientLevelLoadEvent(clientLevelWrapper);
|
|
||||||
}
|
|
||||||
@SubscribeEvent
|
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
public void clientLevelUnloadEvent(WorldEvent.Unload event)
|
|
||||||
#else
|
|
||||||
public void clientLevelUnloadEvent(LevelEvent.Unload event)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
LOGGER.info("level unload");
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
LevelAccessor level = event.getWorld();
|
|
||||||
#else
|
|
||||||
LevelAccessor level = event.getLevel();
|
|
||||||
#endif
|
|
||||||
if (!(level instanceof ClientLevel))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientLevel clientLevel = (ClientLevel) level;
|
|
||||||
IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel);
|
|
||||||
ClientApi.INSTANCE.clientLevelUnloadEvent(clientLevelWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
//==============//
|
||||||
// chunk events //
|
// chunk events //
|
||||||
//==============//
|
//==============//
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ package com.seibel.distanthorizons.forge;
|
|||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
||||||
|
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker;
|
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.forge.wrappers.modAccessor.ImmersivePortalsAccessorForge;
|
||||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker;
|
import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker;
|
||||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor;
|
import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor;
|
||||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.OculusAccessor;
|
import com.seibel.distanthorizons.forge.wrappers.modAccessor.OculusAccessor;
|
||||||
@@ -104,6 +104,18 @@ public class ForgeMain extends AbstractModInitializer
|
|||||||
{
|
{
|
||||||
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
||||||
this.tryCreateModCompatAccessor("oculus", IIrisAccessor.class, OculusAccessor::new);
|
this.tryCreateModCompatAccessor("oculus", IIrisAccessor.class, OculusAccessor::new);
|
||||||
|
IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class);
|
||||||
|
|
||||||
|
// We ideally want to detect imm_ptl_core, but 1.16.5 doesn't provide that mod id.
|
||||||
|
if (modChecker.isModLoaded("imm_ptl_core")
|
||||||
|
|| modChecker.isModLoaded("immersive_portals"))
|
||||||
|
{
|
||||||
|
ModAccessorInjector.INSTANCE.bind(IImmersivePortalsAccessor.class, new ImmersivePortalsAccessorForge());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.debug("Skipping mod compatibility accessor for: Immersive Portals");
|
||||||
|
}
|
||||||
|
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY,
|
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY,
|
||||||
|
|||||||
+1
-9
@@ -45,15 +45,7 @@ public class MixinFogRenderer
|
|||||||
remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge
|
remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge
|
||||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
|
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_21_6
|
if (MixinVanillaFogCommon.cancelFog(camera, fogMode))
|
||||||
boolean cancelFog = MixinVanillaFogCommon.cancelFog(camera, fogMode);
|
|
||||||
#elif MC_VER < MC_1_21_6
|
|
||||||
boolean cancelFog = MixinVanillaFogCommon.cancelFog(camera);
|
|
||||||
#else
|
|
||||||
boolean cancelFog = MixinVanillaFogCommon.cancelFog();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (cancelFog)
|
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.seibel.distanthorizons.forge.mixins.client;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.commonMixins.MixinImmersivePortalsRenderStatesCommon;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Pseudo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Pseudo
|
||||||
|
#if MC_VER > MC_1_16_5
|
||||||
|
@Mixin(targets = "qouteall.imm_ptl.core.render.context_management.RenderStates")
|
||||||
|
#else
|
||||||
|
@Mixin(targets = "com.qouteall.immersive_portals.render.context_management.RenderStates")
|
||||||
|
#endif
|
||||||
|
public class MixinImmersivePortalsRenderStates
|
||||||
|
{
|
||||||
|
|
||||||
|
@Inject(method = "updatePreRenderInfo", at = @At("HEAD"))
|
||||||
|
private static void preRender(CallbackInfo ci)
|
||||||
|
{ MixinImmersivePortalsRenderStatesCommon.saveVolatileOriginals(); }
|
||||||
|
|
||||||
|
}
|
||||||
+2
-2
@@ -40,7 +40,7 @@ import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
|||||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
import com.seibel.distanthorizons.core.util.math.DhMat4f;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.renderer.LevelRenderer;
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
@@ -126,7 +126,7 @@ public class MixinLevelRenderer
|
|||||||
// get the matrices from the OpenGL fixed pipeline
|
// get the matrices from the OpenGL fixed pipeline
|
||||||
float[] mcProjMatrixRaw = new float[16];
|
float[] mcProjMatrixRaw = new float[16];
|
||||||
GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix = new Mat4f(mcProjMatrixRaw);
|
ClientApi.RENDER_STATE.mcProjectionMatrix = new DhMat4f(mcProjMatrixRaw);
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix.transpose();
|
ClientApi.RENDER_STATE.mcProjectionMatrix.transpose();
|
||||||
|
|
||||||
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
||||||
|
|||||||
+1
-8
@@ -46,14 +46,7 @@ public class MixinLightTexture
|
|||||||
@Inject(method = "updateLightTexture(F)V", at = @At("RETURN"))
|
@Inject(method = "updateLightTexture(F)V", at = @At("RETURN"))
|
||||||
public void updateLightTexture(float partialTicks, CallbackInfo ci)
|
public void updateLightTexture(float partialTicks, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels);
|
||||||
if (mc == null || mc.getWrappedClientLevel() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod
|
||||||
|
* licensed under the GNU LGPL v3 License.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 James Seibel
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.seibel.distanthorizons.forge.wrappers.modAccessor;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.modAccessor.AbstractImmersivePortalsAccessorCommon;
|
||||||
|
|
||||||
|
public class ImmersivePortalsAccessorForge extends AbstractImmersivePortalsAccessorCommon
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
+6
-47
@@ -30,14 +30,12 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
|
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
|
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
import net.neoforged.neoforge.event.level.LevelEvent;
|
|
||||||
|
|
||||||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
@@ -52,13 +50,7 @@ import net.neoforged.neoforge.client.event.InputEvent;
|
|||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
#if MC_VER < MC_1_20_6
|
|
||||||
import net.neoforged.neoforge.event.TickEvent;
|
|
||||||
#else
|
|
||||||
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
|
||||||
|
|
||||||
import java.util.concurrent.AbstractExecutorService;
|
import java.util.concurrent.AbstractExecutorService;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||||
@@ -73,43 +65,6 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
|
||||||
// world events //
|
|
||||||
//==============//
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void clientLevelLoadEvent(LevelEvent.Load event)
|
|
||||||
{
|
|
||||||
LOGGER.info("level load");
|
|
||||||
|
|
||||||
LevelAccessor level = event.getLevel();
|
|
||||||
if (!(level instanceof ClientLevel))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientLevel clientLevel = (ClientLevel) level;
|
|
||||||
IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel, true);
|
|
||||||
ClientApi.INSTANCE.clientLevelLoadEvent(clientLevelWrapper);
|
|
||||||
}
|
|
||||||
@SubscribeEvent
|
|
||||||
public void clientLevelUnloadEvent(LevelEvent.Unload event)
|
|
||||||
{
|
|
||||||
LOGGER.info("level unload");
|
|
||||||
|
|
||||||
LevelAccessor level = event.getLevel();
|
|
||||||
if (!(level instanceof ClientLevel))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientLevel clientLevel = (ClientLevel) level;
|
|
||||||
IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel);
|
|
||||||
ClientApi.INSTANCE.clientLevelUnloadEvent(clientLevelWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
//==============//
|
||||||
// chunk events //
|
// chunk events //
|
||||||
//==============//
|
//==============//
|
||||||
@@ -163,11 +118,16 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
//LOGGER.trace("break or block attack at blockPos: " + event.getPos());
|
//LOGGER.trace("break or block attack at blockPos: " + event.getPos());
|
||||||
|
|
||||||
ChunkAccess chunk = level.getChunk(event.getPos());
|
ChunkAccess chunk = level.getChunk(event.getPos());
|
||||||
SharedApi.INSTANCE.applyChunkUpdate(new ChunkWrapper(chunk, wrappedLevel), wrappedLevel);
|
this.onBlockChangeEvent(level, chunk);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void onBlockChangeEvent(LevelAccessor level, ChunkAccess chunk)
|
||||||
|
{
|
||||||
|
ILevelWrapper wrappedLevel = ProxyUtil.getLevelWrapper(level);
|
||||||
|
SharedApi.INSTANCE.applyChunkUpdate(new ChunkWrapper(chunk, wrappedLevel), wrappedLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -261,7 +221,6 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
// handled via the same mixin as fabric for consistency
|
// handled via the same mixin as fabric for consistency
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// should generally only need to be set once per game session
|
// should generally only need to be set once per game session
|
||||||
|
|||||||
@@ -30,16 +30,10 @@ import com.seibel.distanthorizons.core.network.messages.AbstractNetworkMessage;
|
|||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IC2meAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.C2meAccessor;
|
import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.*;
|
||||||
import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.IrisAccessor;
|
|
||||||
import com.seibel.distanthorizons.neoforge.wrappers.NeoforgeMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.neoforge.wrappers.NeoforgeMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.ModChecker;
|
|
||||||
import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.OptifineAccessor;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.neoforged.bus.api.EventPriority;
|
import net.neoforged.bus.api.EventPriority;
|
||||||
@@ -148,6 +142,7 @@ public class NeoforgeMain extends AbstractModInitializer
|
|||||||
{
|
{
|
||||||
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
||||||
this.tryCreateModCompatAccessor("c2me", IC2meAccessor.class, C2meAccessor::new);
|
this.tryCreateModCompatAccessor("c2me", IC2meAccessor.class, C2meAccessor::new);
|
||||||
|
this.tryCreateModCompatAccessor("immersive_portals_core", IImmersivePortalsAccessor.class, ImmersivePortalsAccessorNeoForge::new);
|
||||||
|
|
||||||
#if MC_VER >= MC_1_20_6
|
#if MC_VER >= MC_1_20_6
|
||||||
// 1.20.6 is the lowest version Iris supports Neoforge
|
// 1.20.6 is the lowest version Iris supports Neoforge
|
||||||
|
|||||||
-7
@@ -1,11 +1,8 @@
|
|||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
package com.seibel.distanthorizons.neoforge.mixins.client;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
|
||||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
@@ -13,14 +10,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(ClientPacketListener.class)
|
@Mixin(ClientPacketListener.class)
|
||||||
public class MixinClientPacketListener
|
public class MixinClientPacketListener
|
||||||
{
|
{
|
||||||
@Shadow
|
|
||||||
private ClientLevel level;
|
|
||||||
|
|
||||||
@Inject(method = "handleLogin", at = @At("RETURN"))
|
@Inject(method = "handleLogin", at = @At("RETURN"))
|
||||||
void onHandleLoginEnd(CallbackInfo ci)
|
void onHandleLoginEnd(CallbackInfo ci)
|
||||||
{
|
{
|
||||||
ClientApi.INSTANCE.onClientOnlyConnected();
|
ClientApi.INSTANCE.onClientOnlyConnected();
|
||||||
ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER < MC_1_19_4
|
#if MC_VER < MC_1_19_4
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.seibel.distanthorizons.neoforge.mixins.client;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.commonMixins.MixinImmersivePortalsRenderStatesCommon;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Pseudo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Pseudo
|
||||||
|
@Mixin(targets = "qouteall.imm_ptl.core.render.context_management.RenderStates")
|
||||||
|
public class MixinImmersivePortalsRenderStates
|
||||||
|
{
|
||||||
|
|
||||||
|
@Inject(method = "updatePreRenderInfo", at = @At("HEAD"))
|
||||||
|
private static void preRender(CallbackInfo ci)
|
||||||
|
{ MixinImmersivePortalsRenderStatesCommon.saveVolatileOriginals(); }
|
||||||
|
|
||||||
|
}
|
||||||
+6
-18
@@ -90,18 +90,6 @@ public class MixinLightTexture
|
|||||||
public void render(LightmapRenderState renderState, CallbackInfo ci)
|
public void render(LightmapRenderState renderState, CallbackInfo ci)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
if (mc == null || mc.getWrappedClientLevel() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
if (clientLevel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// lazy initialization to make sure we don't call this too early
|
// lazy initialization to make sure we don't call this too early
|
||||||
if (this.renderWrapper == null)
|
if (this.renderWrapper == null)
|
||||||
{
|
{
|
||||||
@@ -110,21 +98,21 @@ public class MixinLightTexture
|
|||||||
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_21_3
|
#if MC_VER < MC_1_21_3
|
||||||
renderWrapper.updateLightmap(this.lightPixels, clientLevel);
|
renderWrapper.updateLightmap(this.lightPixels);
|
||||||
#elif MC_VER < MC_1_21_5
|
#elif MC_VER < MC_1_21_5
|
||||||
renderWrapper.setLightmapId(this.target.getColorTextureId(), clientLevel);
|
renderWrapper.setLightmapId(this.target.getColorTextureId());
|
||||||
#elif MC_VER < MC_1_21_9
|
#elif MC_VER < MC_1_21_9
|
||||||
GlTexture glTexture = (GlTexture) this.texture;
|
GlTexture glTexture = (GlTexture) this.texture;
|
||||||
renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
renderWrapper.setLightmapId(glTexture.glId());
|
||||||
#elif MC_VER <= MC_1_21_10
|
#elif MC_VER <= MC_1_21_10
|
||||||
GlTexture glTexture = (GlTexture) this.texture;
|
GlTexture glTexture = (GlTexture) this.texture;
|
||||||
renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
renderWrapper.setLightmapId(glTexture.glId());
|
||||||
#else
|
#else
|
||||||
// both options are available since the renderer can be changed to either Blaze3D or OpenGL
|
// both options are available since the renderer can be changed to either Blaze3D or OpenGL
|
||||||
int id = NeoforgeTextureUnwrapper.getGlTextureIdFromGpuTexture(this.texture);
|
int id = NeoforgeTextureUnwrapper.getGlTextureIdFromGpuTexture(this.texture);
|
||||||
renderWrapper.setLightmapId(id, clientLevel);
|
renderWrapper.setLightmapId(id);
|
||||||
|
|
||||||
renderWrapper.setLightmapGpuTexture(this.texture, clientLevel);
|
renderWrapper.setLightmapGpuTexture(this.texture);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod
|
||||||
|
* licensed under the GNU LGPL v3 License.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 James Seibel
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.seibel.distanthorizons.neoforge.wrappers.modAccessor;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.modAccessor.AbstractImmersivePortalsAccessorCommon;
|
||||||
|
|
||||||
|
public class ImmersivePortalsAccessorNeoForge extends AbstractImmersivePortalsAccessorCommon
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
"client.MixinFogRenderer",
|
"client.MixinFogRenderer",
|
||||||
"client.MixinChunkSectionsToRender",
|
"client.MixinChunkSectionsToRender",
|
||||||
"client.MixinGameRenderer",
|
"client.MixinGameRenderer",
|
||||||
|
"client.MixinImmersivePortalsRenderStates",
|
||||||
"client.MixinLevelRenderer",
|
"client.MixinLevelRenderer",
|
||||||
"client.MixinLightTexture",
|
"client.MixinLightTexture",
|
||||||
"client.MixinMinecraft",
|
"client.MixinMinecraft",
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ fabric_api_version=0.42.0+1.16
|
|||||||
sodium_version=mc1.16.5-0.2.0
|
sodium_version=mc1.16.5-0.2.0
|
||||||
iris_version=1.4.4+1.16.5
|
iris_version=1.4.4+1.16.5
|
||||||
bclib_version=
|
bclib_version=
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -44,7 +43,6 @@ fabric_api_version=0.42.0+1.16
|
|||||||
enable_iris=1
|
enable_iris=1
|
||||||
# not available via github, use curse.maven if necessary
|
# not available via github, use curse.maven if necessary
|
||||||
enable_bclib=0
|
enable_bclib=0
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# Forge loader
|
# Forge loader
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ fabric_api_version=0.46.1+1.17
|
|||||||
sodium_version=mc1.17.1-0.3.4
|
sodium_version=mc1.17.1-0.3.4
|
||||||
iris_version=1.17.x-v1.2.7
|
iris_version=1.17.x-v1.2.7
|
||||||
bclib_version=0.5.5
|
bclib_version=0.5.5
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -43,7 +42,6 @@ fabric_api_version=0.46.1+1.17
|
|||||||
enable_sodium=1
|
enable_sodium=1
|
||||||
enable_iris=0
|
enable_iris=0
|
||||||
enable_bclib=1
|
enable_bclib=1
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# Forge loader
|
# Forge loader
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ fabric_api_version=0.76.0+1.18.2
|
|||||||
sodium_version=mc1.18.2-0.4.1
|
sodium_version=mc1.18.2-0.4.1
|
||||||
iris_version=1.6.10+1.18.2
|
iris_version=1.6.10+1.18.2
|
||||||
bclib_version=1.4.6
|
bclib_version=1.4.6
|
||||||
immersive_portals_version=v1.4.11-1.18
|
|
||||||
canvas_version=mc118:1.0.2616
|
canvas_version=mc118:1.0.2616
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -44,7 +43,6 @@ fabric_api_version=0.76.0+1.18.2
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=1
|
enable_bclib=1
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
quilt_loader_version=0.19.1
|
quilt_loader_version=0.19.1
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ fabric_api_version=0.76.1+1.19.2
|
|||||||
sodium_version=mc1.19.2-0.4.4
|
sodium_version=mc1.19.2-0.4.4
|
||||||
iris_version=1.6.10+1.19.2
|
iris_version=1.6.10+1.19.2
|
||||||
bclib_version=2.1.6
|
bclib_version=2.1.6
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=mc119-1.0.2480
|
canvas_version=mc119-1.0.2480
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -42,7 +41,6 @@ fabric_api_version=0.76.1+1.19.2
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=1
|
enable_bclib=1
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# Forge loader
|
# Forge loader
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ fabric_api_version=0.87.1+1.19.4
|
|||||||
sodium_version=mc1.19.4-0.4.10
|
sodium_version=mc1.19.4-0.4.10
|
||||||
iris_version=1.6.10+1.19.4
|
iris_version=1.6.10+1.19.4
|
||||||
bclib_version=2.3.3
|
bclib_version=2.3.3
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -41,7 +40,6 @@ fabric_api_version=0.87.1+1.19.4
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=1
|
enable_bclib=1
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# Forge loader
|
# Forge loader
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ fabric_api_version=0.92.6+1.20.1
|
|||||||
sodium_version=mc1.20.1-0.5.3
|
sodium_version=mc1.20.1-0.5.3
|
||||||
iris_version=1.6.10+1.20.1
|
iris_version=1.6.10+1.20.1
|
||||||
bclib_version=3.0.13
|
bclib_version=3.0.13
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -42,7 +41,6 @@ fabric_api_version=0.92.6+1.20.1
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=1
|
enable_bclib=1
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# Forge loader
|
# Forge loader
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ fabric_api_version=0.90.4+1.20.2
|
|||||||
sodium_version=mc1.20.2-0.5.3
|
sodium_version=mc1.20.2-0.5.3
|
||||||
iris_version=1.6.10+1.20.2
|
iris_version=1.6.10+1.20.2
|
||||||
bclib_version=3.0.13
|
bclib_version=3.0.13
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -42,7 +41,6 @@ fabric_api_version=0.90.4+1.20.2
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=1
|
enable_bclib=1
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# Forge loader
|
# Forge loader
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ fabric_api_version=0.91.2+1.20.4
|
|||||||
sodium_version=mc1.20.3-0.5.4
|
sodium_version=mc1.20.3-0.5.4
|
||||||
iris_version=1.6.13+1.20.4
|
iris_version=1.6.13+1.20.4
|
||||||
bclib_version=
|
bclib_version=
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -43,7 +42,6 @@ fabric_api_version=0.91.2+1.20.4
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=0
|
enable_bclib=0
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# Forge loader
|
# Forge loader
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ fabric_api_version=0.97.8+1.20.6
|
|||||||
sodium_version=mc1.20.6-0.5.8
|
sodium_version=mc1.20.6-0.5.8
|
||||||
iris_version=1.7.0+1.20.6
|
iris_version=1.7.0+1.20.6
|
||||||
bclib_version=
|
bclib_version=
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -43,7 +42,6 @@ fabric_api_version=0.97.8+1.20.6
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=0
|
enable_bclib=0
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# NeoForge loader
|
# NeoForge loader
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ fabric_api_version=0.116.11+1.21.1
|
|||||||
sodium_version=mc1.21.1-0.6.2-fabric
|
sodium_version=mc1.21.1-0.6.2-fabric
|
||||||
iris_version=1.8.1+1.21.1-fabric
|
iris_version=1.8.1+1.21.1-fabric
|
||||||
bclib_version=
|
bclib_version=
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# iris - needs 1.7.4+ to support the DH API
|
# iris - needs 1.7.4+ to support the DH API
|
||||||
@@ -43,7 +42,6 @@ fabric_api_version=0.116.11+1.21.1
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=0
|
enable_bclib=0
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# NeoForge loader
|
# NeoForge loader
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ fabric_api_version=0.138.4+1.21.10
|
|||||||
sodium_version=mc1.21.10-0.7.2-fabric
|
sodium_version=mc1.21.10-0.7.2-fabric
|
||||||
iris_version=1.9.6+1.21.10-fabric
|
iris_version=1.9.6+1.21.10-fabric
|
||||||
bclib_version=
|
bclib_version=
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# vertigo - prevents DH from seeing the full chunk, causing holes
|
# vertigo - prevents DH from seeing the full chunk, causing holes
|
||||||
@@ -41,7 +40,6 @@ fabric_api_version=0.138.4+1.21.10
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=0
|
enable_bclib=0
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# NeoForge loader
|
# NeoForge loader
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ fabric_api_version=0.139.4+1.21.11
|
|||||||
sodium_version=mc1.21.11-0.8.0-fabric
|
sodium_version=mc1.21.11-0.8.0-fabric
|
||||||
iris_version=1.10.0+1.21.11-fabric
|
iris_version=1.10.0+1.21.11-fabric
|
||||||
bclib_version=
|
bclib_version=
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# vertigo - prevents DH from seeing the full chunk, causing holes
|
# vertigo - prevents DH from seeing the full chunk, causing holes
|
||||||
@@ -41,7 +40,6 @@ fabric_api_version=0.139.4+1.21.11
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=0
|
enable_bclib=0
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# NeoForge loader
|
# NeoForge loader
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ fabric_api_version=0.110.0+1.21.3
|
|||||||
sodium_version=mc1.21.3-0.6.0-fabric
|
sodium_version=mc1.21.3-0.6.0-fabric
|
||||||
iris_version=1.8.0+1.21.3-fabric
|
iris_version=1.8.0+1.21.3-fabric
|
||||||
bclib_version=
|
bclib_version=
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# fabric-api 0.110.0 fixed a bug in MC 1.21.3 with the rendering API DH relied on
|
# fabric-api 0.110.0 fixed a bug in MC 1.21.3 with the rendering API DH relied on
|
||||||
@@ -43,7 +42,6 @@ fabric_api_version=0.110.0+1.21.3
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=0
|
enable_bclib=0
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# NeoForge loader
|
# NeoForge loader
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ fabric_api_version=0.110.5+1.21.4
|
|||||||
sodium_version=mc1.21.4-0.6.2-fabric
|
sodium_version=mc1.21.4-0.6.2-fabric
|
||||||
iris_version=1.8.2+1.21.4-fabric
|
iris_version=1.8.2+1.21.4-fabric
|
||||||
bclib_version=
|
bclib_version=
|
||||||
immersive_portals_version=
|
|
||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
# vertigo - prevents DH from seeing the full chunk, causing holes
|
# vertigo - prevents DH from seeing the full chunk, causing holes
|
||||||
@@ -42,7 +41,6 @@ fabric_api_version=0.110.5+1.21.4
|
|||||||
enable_lithium=0
|
enable_lithium=0
|
||||||
enable_iris=1
|
enable_iris=1
|
||||||
enable_bclib=0
|
enable_bclib=0
|
||||||
enable_immersive_portals=0
|
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
# NeoForge loader
|
# NeoForge loader
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user