Fixed Alex's Caves compat
This commit is contained in:
+8
-7
@@ -8,6 +8,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftCli
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
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;
|
||||
@@ -15,24 +16,24 @@ 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)
|
||||
@Mixin(DynamicTexture.class)
|
||||
public class MixinLightmap
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
private NativeImage lightPixels;
|
||||
private NativeImage pixels;
|
||||
|
||||
@Inject(method = "updateLightTexture", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/texture/DynamicTexture;upload()V"))
|
||||
public void updateLightTexture(float f, CallbackInfo ci)
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/texture/DynamicTexture;upload()V", at = @At("HEAD"), cancellable = true)
|
||||
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.getWrappedClientLevel() == null)
|
||||
return;
|
||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||
|
||||
//ApiShared.LOGGER.info("Lightmap update");
|
||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel);
|
||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-7
@@ -8,6 +8,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftCli
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
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;
|
||||
@@ -15,24 +16,24 @@ 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)
|
||||
@Mixin(DynamicTexture.class)
|
||||
public class MixinLightmap
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
private NativeImage lightPixels;
|
||||
private NativeImage pixels;
|
||||
|
||||
@Inject(method = "updateLightTexture", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/texture/DynamicTexture;upload()V"))
|
||||
public void updateLightTexture(float f, CallbackInfo ci)
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/texture/DynamicTexture;upload()V", at = @At("HEAD"), cancellable = true)
|
||||
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.getWrappedClientLevel() == null)
|
||||
return;
|
||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||
|
||||
//ApiShared.LOGGER.info("Lightmap update");
|
||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel);
|
||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user