-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:enjarai/trickster
- Loading branch information
Showing
58 changed files
with
229 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/client/java/dev/enjarai/trickster/mixin/client/sodium/ChunkBuilderMeshingTaskMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package dev.enjarai.trickster.mixin.client.sodium; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.llamalad7.mixinextras.sugar.Share; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalRef; | ||
import dev.enjarai.trickster.cca.ModChunkComponents; | ||
import dev.enjarai.trickster.cca.ShadowDisguiseMapComponent; | ||
import dev.enjarai.trickster.pond.WorldlyRenderContextDuck; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.RenderSection; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.ChunkBuildContext; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.ChunkBuildOutput; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderTask; | ||
import net.caffeinemc.mods.sodium.client.util.task.CancellationToken; | ||
import net.caffeinemc.mods.sodium.client.world.LevelSlice; | ||
import net.caffeinemc.mods.sodium.client.world.cloned.ChunkRenderContext; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.world.World; | ||
import org.joml.Vector3dc; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(ChunkBuilderMeshingTask.class) | ||
public abstract class ChunkBuilderMeshingTaskMixin extends ChunkBuilderTask<ChunkBuildOutput> { | ||
@Shadow @Final private ChunkRenderContext renderContext; | ||
|
||
public ChunkBuilderMeshingTaskMixin(RenderSection render, int time, Vector3dc absoluteCameraPos) { | ||
super(render, time, absoluteCameraPos); | ||
} | ||
|
||
@Inject( | ||
method = "execute(Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/ChunkBuildContext;Lnet/caffeinemc/mods/sodium/client/util/task/CancellationToken;)Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/ChunkBuildOutput;", | ||
at = @At("HEAD"), | ||
remap = false | ||
) | ||
private void preGetComponent(ChunkBuildContext buildContext, CancellationToken cancellationToken, | ||
CallbackInfoReturnable<ChunkBuildOutput> cir, | ||
@Share("shadow_map") LocalRef<ShadowDisguiseMapComponent> shadowMap) { | ||
//noinspection resource | ||
var world = ((WorldlyRenderContextDuck) renderContext).trickster$getWorld(); | ||
shadowMap.set(ModChunkComponents.SHADOW_DISGUISE_MAP.get(world.getChunk(render.getChunkX(), render.getChunkZ()))); | ||
} | ||
|
||
@WrapOperation( | ||
method = "execute(Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/ChunkBuildContext;Lnet/caffeinemc/mods/sodium/client/util/task/CancellationToken;)Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/ChunkBuildOutput;", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/caffeinemc/mods/sodium/client/world/LevelSlice;getBlockState(III)Lnet/minecraft/block/BlockState;" | ||
), | ||
remap = false | ||
) | ||
private BlockState modifyBlockState(LevelSlice instance, int blockX, int blockY, int blockZ, Operation<BlockState> original, @Share("shadow_map") LocalRef<ShadowDisguiseMapComponent> shadowMap) { | ||
var customState = shadowMap.get().getFunnyState(blockX, blockY, blockZ); | ||
return customState != null ? customState : original.call(instance, blockX, blockY, blockZ); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/client/java/dev/enjarai/trickster/mixin/client/sodium/ChunkRenderContextMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dev.enjarai.trickster.mixin.client.sodium; | ||
|
||
import dev.enjarai.trickster.pond.WorldlyRenderContextDuck; | ||
import net.caffeinemc.mods.sodium.client.world.cloned.ChunkRenderContext; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
@Mixin(ChunkRenderContext.class) | ||
public class ChunkRenderContextMixin implements WorldlyRenderContextDuck { | ||
@Unique | ||
private World world; | ||
|
||
@Override | ||
public World trickster$getWorld() { | ||
return world; | ||
} | ||
|
||
@Override | ||
public void trickster$setWorld(World world) { | ||
this.world = world; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/client/java/dev/enjarai/trickster/mixin/client/sodium/LevelSliceMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package dev.enjarai.trickster.mixin.client.sodium; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import dev.enjarai.trickster.pond.WorldlyRenderContextDuck; | ||
import net.caffeinemc.mods.sodium.client.world.LevelSlice; | ||
import net.caffeinemc.mods.sodium.client.world.cloned.ChunkRenderContext; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.*; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(LevelSlice.class) | ||
public abstract class LevelSliceMixin { | ||
@ModifyReturnValue( | ||
method = "prepare", | ||
at = @At( | ||
value = "RETURN", | ||
ordinal = 1 | ||
), | ||
remap = false | ||
) | ||
private static ChunkRenderContext addWorldContext(ChunkRenderContext original, @Local(argsOnly = true) World world) { | ||
((WorldlyRenderContextDuck) original).trickster$setWorld(world); | ||
return original; | ||
} | ||
} |
54 changes: 0 additions & 54 deletions
54
src/client/java/dev/enjarai/trickster/mixin/client/sodium/WorldSliceMixin.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.