Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1787d2c6d9 | |||
| 1a07fb83b6 | |||
| 4d2ee292bb | |||
| 0fdde61fe5 | |||
| ae8a4912a6 | |||
| ffd8ea8751 | |||
| 4cd10a82fd | |||
| 4955d22649 | |||
| 425b761f8e | |||
| ab3bfd457f | |||
| 0faa64112a | |||
| 46519b096c | |||
| cb7d980e15 | |||
| 6c1562ac33 | |||
| 5e17e4ea8c | |||
| b8e7b14fbb | |||
| 5d8eb185bc | |||
| 7325cedba6 | |||
| e5043d6d9b | |||
| 13e53a18e3 | |||
| dd60c7620f | |||
| 83c01cabfb | |||
| a95171dbbe | |||
| 10d542ed14 | |||
| 7e1c55a0c5 | |||
| 4e25d318ec | |||
| c4228f4e63 | |||
| 1411091f60 | |||
| 6a2278949e | |||
| 374b859882 | |||
| a98bdb94b8 | |||
| de390f5d70 | |||
| 9d4968351b | |||
| e99fbb76bf | |||
| fd175d2f36 | |||
| 0db862e42b | |||
| 58f5d64f91 | |||
| bb54a94acd |
@@ -1,4 +1,4 @@
|
||||
## Chcek off each item in this list before submitting:
|
||||
## Check off each item in this list before submitting:
|
||||
|
||||
<!--
|
||||
To mark a section as complete either put an "x" in between the square brackets, example: "[x]"
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LodCommonMain
|
||||
|
||||
public static void initConfig()
|
||||
{
|
||||
ConfigBase.INSTANCE = new ConfigBase(ModInfo.ID, ModInfo.NAME, Config.class, 1);
|
||||
ConfigBase.INSTANCE = new ConfigBase(ModInfo.ID, ModInfo.NAME, Config.class, 2);
|
||||
Config.completeDelayedSetup();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 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.util;
|
||||
|
||||
/**
|
||||
* Added to MC's dynamic textures via mixins
|
||||
* in order to denote whether a texture is a lightmap or not. <br><br>
|
||||
*
|
||||
* If not done any dynamic texture could be used as the lightmap
|
||||
* which causes some weird rendering bugs.
|
||||
*/
|
||||
public interface ILightTextureMarker
|
||||
{
|
||||
void markLightTexture();
|
||||
}
|
||||
+34
-6
@@ -41,6 +41,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
#else
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -79,6 +80,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
public final BlockState blockState;
|
||||
/** technically final, but since it requires a method call to generate it can't be marked as such */
|
||||
private String serialString;
|
||||
/**
|
||||
* Cached opacity value, -1 if not populated. <br>
|
||||
* Should be between {@link IBlockStateWrapper#FULLY_OPAQUE} and {@link IBlockStateWrapper#FULLY_OPAQUE}
|
||||
*/
|
||||
private int opacity = -1;
|
||||
|
||||
|
||||
|
||||
@@ -173,17 +179,39 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
@Override
|
||||
public int getOpacity()
|
||||
{
|
||||
// this method isn't perfect, but works well enough for our use case
|
||||
if (this.isAir() || !this.blockState.canOcclude())
|
||||
// use the cached opacity value if possible
|
||||
if (this.opacity != -1)
|
||||
{
|
||||
// completely transparent
|
||||
return 0;
|
||||
return this.opacity;
|
||||
}
|
||||
|
||||
|
||||
// this method isn't perfect, but works well enough for our use case
|
||||
int opacity;
|
||||
if (this.isAir())
|
||||
{
|
||||
opacity = FULLY_TRANSPARENT;
|
||||
}
|
||||
else if (this.isLiquid() && !this.blockState.canOcclude())
|
||||
{
|
||||
// probably not a waterlogged block (which should block light entirely)
|
||||
|
||||
// +1 to indicate that the block is translucent (in between transparent and opaque)
|
||||
opacity = FULLY_TRANSPARENT + 1;
|
||||
}
|
||||
else if (this.blockState.propagatesSkylightDown(EmptyBlockGetter.INSTANCE, BlockPos.ZERO))
|
||||
{
|
||||
opacity = FULLY_TRANSPARENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// completely opaque
|
||||
return 16;
|
||||
// default for all other blocks
|
||||
opacity = FULLY_OPAQUE;
|
||||
}
|
||||
|
||||
|
||||
this.opacity = opacity;
|
||||
return this.opacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-3
@@ -31,6 +31,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import net.minecraft.client.multiplayer.ClientChunkCache;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -77,7 +78,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
|
||||
/** useful for debugging, but can slow down chunk operations quite a bit due to being called every time. */
|
||||
private static final boolean RUN_RELATIVE_POS_INDEX_VALIDATION = false;
|
||||
private static final boolean RUN_RELATIVE_POS_INDEX_VALIDATION = ModInfo.IS_DEV_BUILD;
|
||||
|
||||
/** can be used for interactions with the underlying chunk where creating new BlockPos objects could cause issues for the garbage collector. */
|
||||
private static final ThreadLocal<BlockPos.MutableBlockPos> MUTABLE_BLOCK_POS_REF = ThreadLocal.withInitial(() -> new BlockPos.MutableBlockPos());
|
||||
@@ -387,7 +388,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
{
|
||||
this.blockLightPosList.add(new DhBlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||
});
|
||||
#elif MC_1_20_1
|
||||
#else
|
||||
this.chunk.findBlockLightSources((blockPos, blockState) ->
|
||||
{
|
||||
this.blockLightPosList.add(new DhBlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||
@@ -432,6 +433,8 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public IBlockStateWrapper getBlockState(int relX, int relY, int relZ)
|
||||
{
|
||||
this.throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(relX, relY, relZ);
|
||||
|
||||
BlockPos.MutableBlockPos blockPos = MUTABLE_BLOCK_POS_REF.get();
|
||||
|
||||
blockPos.setX(relX);
|
||||
@@ -511,7 +514,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
/** used to prevent accidentally attempting to get/set values outside this chunk's boundaries */
|
||||
private void throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(int x, int y, int z) throws IndexOutOfBoundsException
|
||||
{
|
||||
if (RUN_RELATIVE_POS_INDEX_VALIDATION)
|
||||
if (!RUN_RELATIVE_POS_INDEX_VALIDATION)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
+9
-5
@@ -27,6 +27,7 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkSource;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -54,8 +55,14 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
||||
// wrapper logic //
|
||||
//===============//
|
||||
|
||||
public static IClientLevelWrapper getWrapper(ClientLevel level)
|
||||
@Nullable
|
||||
public static IClientLevelWrapper getWrapper(@Nullable ClientLevel level)
|
||||
{
|
||||
if (level == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// used if the client is connected to a server that defines the currently loaded level
|
||||
if (KEYED_CLIENT_LEVEL_MANAGER.getUseOverrideWrapper())
|
||||
{
|
||||
@@ -64,10 +71,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
||||
|
||||
return getWrapperIgnoringOverride(level);
|
||||
}
|
||||
public static IClientLevelWrapper getWrapperIgnoringOverride(ClientLevel level)
|
||||
{
|
||||
return LEVEL_WRAPPER_BY_CLIENT_LEVEL.computeIfAbsent(level, ClientLevelWrapper::new);
|
||||
}
|
||||
public static IClientLevelWrapper getWrapperIgnoringOverride(@NotNull ClientLevel level) { return LEVEL_WRAPPER_BY_CLIENT_LEVEL.computeIfAbsent(level, ClientLevelWrapper::new); }
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
+1
-1
Submodule coreSubProjects updated: 773f17ddfe...f32e25f52f
@@ -37,6 +37,8 @@ import com.seibel.distanthorizons.fabric.wrappers.modAccessor.*;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Initialize and setup the Mod. <br>
|
||||
* If you are looking for the real start of the mod
|
||||
@@ -92,6 +94,11 @@ public class FabricMain
|
||||
// If sodium is installed Indium is also necessary in order to use the Fabric rendering API
|
||||
if (!modChecker.isModLoaded("indium"))
|
||||
{
|
||||
// People don't read the crash logs!!!
|
||||
// So, just put a notification, so they hopefully realise what's the problem (and dont just open issues)
|
||||
System.setProperty("java.awt.headless", "false"); // Required to make it work
|
||||
JOptionPane.showMessageDialog(null, ModInfo.READABLE_NAME + " now relies on Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium", ModInfo.READABLE_NAME, JOptionPane.INFORMATION_MESSAGE);
|
||||
|
||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
String errorMessage = "loading Distant Horizons. Distant Horizons requires Indium in order to run with Sodium.";
|
||||
String exceptionError = "Distant Horizons conditional mod Exception";
|
||||
|
||||
+4
-5
@@ -27,9 +27,9 @@ public class MixinClientPacketListener
|
||||
void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); }
|
||||
|
||||
@Inject(method = "handleRespawn", at = @At("HEAD"))
|
||||
void onHandleRespawnStart(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(level)); }
|
||||
void onHandleRespawnStart(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.level)); }
|
||||
@Inject(method = "handleRespawn", at = @At("RETURN"))
|
||||
void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(level)); }
|
||||
void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level)); }
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
@Inject(method = "cleanup", at = @At("HEAD"))
|
||||
@@ -38,10 +38,9 @@ public class MixinClientPacketListener
|
||||
#endif
|
||||
void onCleanupStart(CallbackInfo ci)
|
||||
{
|
||||
// TODO Is this even needed here?
|
||||
if (level != null)
|
||||
if (this.level != null)
|
||||
{
|
||||
ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(level));
|
||||
ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.level));
|
||||
}
|
||||
ClientApi.INSTANCE.onClientOnlyDisconnected();
|
||||
}
|
||||
|
||||
+36
-9
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 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.mixins.client;
|
||||
|
||||
|
||||
@@ -6,37 +25,45 @@ import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapp
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
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 net.minecraft.client.renderer.LightTexture;
|
||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(DynamicTexture.class)
|
||||
public class MixinLightmap
|
||||
public class MixinDynamicTexture implements ILightTextureMarker
|
||||
{
|
||||
/** Used to prevent accidentally using other dynamic textures as a lightmap */
|
||||
@Unique
|
||||
private boolean isLightTexture = false;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private NativeImage pixels;
|
||||
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/texture/DynamicTexture;upload()V", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "upload()V", at = @At("HEAD"))
|
||||
public void updateLightTexture(CallbackInfo ci)
|
||||
{
|
||||
// since the light map is always updated on the client render thread we should be able to access the client level at the same time
|
||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
if (
|
||||
mc == null ||
|
||||
mc.getWrappedClientLevel() == null
|
||||
)
|
||||
if (!this.isLightTexture
|
||||
|| mc == null
|
||||
|| mc.getWrappedClientLevel() == null
|
||||
)
|
||||
{
|
||||
return;
|
||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||
}
|
||||
|
||||
//ApiShared.LOGGER.info("Lightmap update");
|
||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel);
|
||||
}
|
||||
|
||||
public void markLightTexture() { this.isLightTexture = true; }
|
||||
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 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.mixins.client;
|
||||
|
||||
|
||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(LightTexture.class)
|
||||
public class MixinLightTexture
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
private DynamicTexture lightTexture;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
public void markLightTexture(CallbackInfo ci)
|
||||
{
|
||||
//
|
||||
((ILightTextureMarker) this.lightTexture).markLightTexture();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,8 @@
|
||||
"client.MixinFogRenderer",
|
||||
"client.MixinGameRenderer",
|
||||
"client.MixinLevelRenderer",
|
||||
"client.MixinLightmap",
|
||||
"client.MixinDynamicTexture",
|
||||
"client.MixinLightTexture",
|
||||
"client.MixinOptionsScreen",
|
||||
"client.MixinMinecraft",
|
||||
"client.MixinTextureUtil"
|
||||
|
||||
+39
-9
@@ -1,42 +1,72 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 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.mixins.client;
|
||||
|
||||
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
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 net.minecraft.client.renderer.LightTexture;
|
||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
||||
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(DynamicTexture.class)
|
||||
public class MixinLightmap
|
||||
public class MixinDynamicTexture implements ILightTextureMarker
|
||||
{
|
||||
/** Used to prevent accidentally using other dynamic textures as a lightmap */
|
||||
@Unique
|
||||
private boolean isLightTexture = false;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private NativeImage pixels;
|
||||
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/texture/DynamicTexture;upload()V", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "upload()V", at = @At("HEAD"))
|
||||
public void updateLightTexture(CallbackInfo ci)
|
||||
{
|
||||
// since the light map is always updated on the client render thread we should be able to access the client level at the same time
|
||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
if (
|
||||
mc == null ||
|
||||
mc.getWrappedClientLevel() == null
|
||||
)
|
||||
if (!this.isLightTexture
|
||||
|| mc == null
|
||||
|| mc.getWrappedClientLevel() == null
|
||||
)
|
||||
{
|
||||
return;
|
||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||
}
|
||||
|
||||
//ApiShared.LOGGER.info("Lightmap update");
|
||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel);
|
||||
}
|
||||
|
||||
public void markLightTexture() { this.isLightTexture = true; }
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 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.mixins.client;
|
||||
|
||||
|
||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
||||
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(LightTexture.class)
|
||||
public class MixinLightTexture
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
private DynamicTexture lightTexture;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
public void markLightTexture(CallbackInfo ci) { ((ILightTextureMarker) this.lightTexture).markLightTexture(); }
|
||||
|
||||
}
|
||||
@@ -14,7 +14,8 @@
|
||||
"client.MixinFogRenderer",
|
||||
"client.MixinGameRenderer",
|
||||
"client.MixinLevelRenderer",
|
||||
"client.MixinLightmap",
|
||||
"client.MixinDynamicTexture",
|
||||
"client.MixinLightTexture",
|
||||
"client.MixinOptionsScreen",
|
||||
"client.MixinTextureUtil"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "",
|
||||
"pack_format": 7
|
||||
"pack_format": 7,
|
||||
"supported_formats": {
|
||||
"min_inclusive": 16,
|
||||
"max_inclusive": 90000
|
||||
},
|
||||
"description": "Distant Horizons"
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ org.gradle.caching=true
|
||||
|
||||
# Mod Info
|
||||
mod_name=DistantHorizons
|
||||
mod_version=2.0.0-a
|
||||
mod_version=2.0.1-a
|
||||
api_version=1.0.0
|
||||
maven_group=com.seibel.distanthorizons
|
||||
mod_readable_name=Distant Horizons
|
||||
@@ -13,8 +13,8 @@ mod_description=This mod generates and renders simplified terrain beyond the nor
|
||||
# Note: In forge's mods.toml this is hard coded because Architectury throws an error with setting it as a varuable
|
||||
mod_authors=["James Seibel", "Leonardo Amato", "Cola", "coolGi", "Ran", "Leetom"]
|
||||
mod_homepage=https://modrinth.com/mod/distanthorizons
|
||||
mod_source=https://gitlab.com/jeseibel/minecraft-lod-mod/
|
||||
mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues
|
||||
mod_source=https://gitlab.com/jeseibel/distant-horizons
|
||||
mod_issues=https://gitlab.com/jeseibel/distant-horizons/-/issues
|
||||
mod_discord=https://discord.gg/xAB8G4cENx
|
||||
|
||||
# Global Plugin Versions
|
||||
@@ -44,7 +44,7 @@ versionStr=
|
||||
|
||||
# This defines what MC version Intellij will use for the preprocessor
|
||||
# and what version is used automatically by build and run commands
|
||||
mcVer=1.20.1
|
||||
mcVer=1.20.2
|
||||
|
||||
# Defines the maximum amount of memory Minecraft is allowed when run in a developement environment
|
||||
minecraftMemoryJavaArg="-Xmx4G"
|
||||
|
||||
Reference in New Issue
Block a user