-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6468b0
commit 1ccd387
Showing
9 changed files
with
158 additions
and
1 deletion.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/main/java/dev/dubhe/anvilcraft/integration/embeddium/ModEmbeddiumMaterials.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,9 @@ | ||
package dev.dubhe.anvilcraft.integration.embeddium; | ||
|
||
|
||
import org.embeddedt.embeddium.impl.render.chunk.terrain.material.Material; | ||
import org.embeddedt.embeddium.impl.render.chunk.terrain.material.parameters.AlphaCutoffParameter; | ||
|
||
public class ModEmbeddiumMaterials { | ||
public static final Material LASER = new Material(ModEmbeddiumTerrainRenderPasses.LASER, AlphaCutoffParameter.ZERO, true); | ||
} |
9 changes: 9 additions & 0 deletions
9
...main/java/dev/dubhe/anvilcraft/integration/embeddium/ModEmbeddiumTerrainRenderPasses.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,9 @@ | ||
package dev.dubhe.anvilcraft.integration.embeddium; | ||
|
||
|
||
import dev.dubhe.anvilcraft.client.init.ModRenderTypes; | ||
import org.embeddedt.embeddium.impl.render.chunk.terrain.TerrainRenderPass; | ||
|
||
public class ModEmbeddiumTerrainRenderPasses { | ||
public static final TerrainRenderPass LASER = new TerrainRenderPass(ModRenderTypes.LASER, true, true); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/dev/dubhe/anvilcraft/integration/sodium/ModSodiumMaterials.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,8 @@ | ||
package dev.dubhe.anvilcraft.integration.sodium; | ||
|
||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.material.Material; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.material.parameters.AlphaCutoffParameter; | ||
|
||
public class ModSodiumMaterials { | ||
public static final Material LASER = new Material(ModSodiumTerrainRenderPasses.LASER, AlphaCutoffParameter.ZERO, true); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/dev/dubhe/anvilcraft/integration/sodium/ModSodiumTerrainRenderPasses.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,9 @@ | ||
package dev.dubhe.anvilcraft.integration.sodium; | ||
|
||
|
||
import dev.dubhe.anvilcraft.client.init.ModRenderTypes; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.TerrainRenderPass; | ||
|
||
public class ModSodiumTerrainRenderPasses { | ||
public static final TerrainRenderPass LASER = new TerrainRenderPass(ModRenderTypes.LASER, true, true); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/dev/dubhe/anvilcraft/mixin/compat/EmbeddiumDefaultMaterialsMixin.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.dubhe.anvilcraft.mixin.compat; | ||
|
||
import dev.dubhe.anvilcraft.client.init.ModRenderTypes; | ||
import dev.dubhe.anvilcraft.integration.embeddium.ModEmbeddiumMaterials; | ||
import net.minecraft.client.renderer.RenderType; | ||
import org.embeddedt.embeddium.impl.render.chunk.terrain.material.DefaultMaterials; | ||
import org.embeddedt.embeddium.impl.render.chunk.terrain.material.Material; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(DefaultMaterials.class) | ||
public class EmbeddiumDefaultMaterialsMixin { | ||
@Inject( | ||
method = "forRenderLayer", | ||
at = @At("HEAD"), | ||
cancellable = true | ||
) | ||
private static void anvilcraft$forRenderLayer(RenderType layer, CallbackInfoReturnable<Material> cir){ | ||
if (layer == ModRenderTypes.LASER){ | ||
cir.setReturnValue(ModEmbeddiumMaterials.LASER); | ||
cir.cancel(); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...main/java/dev/dubhe/anvilcraft/mixin/compat/EmbeddiumDefaultTerrainRenderPassesMixin.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,34 @@ | ||
package dev.dubhe.anvilcraft.mixin.compat; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import dev.dubhe.anvilcraft.integration.embeddium.ModEmbeddiumTerrainRenderPasses; | ||
import org.apache.commons.lang3.ArrayUtils; | ||
import org.embeddedt.embeddium.impl.render.chunk.terrain.DefaultTerrainRenderPasses; | ||
import org.embeddedt.embeddium.impl.render.chunk.terrain.TerrainRenderPass; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Mutable; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(DefaultTerrainRenderPasses.class) | ||
public class EmbeddiumDefaultTerrainRenderPassesMixin { | ||
|
||
@Shadow | ||
@Final | ||
@Mutable | ||
public static TerrainRenderPass[] ALL; | ||
|
||
@WrapOperation( | ||
method = "<clinit>", | ||
at = @At( | ||
value = "FIELD", | ||
target = "Lorg/embeddedt/embeddium/impl/render/chunk/terrain/DefaultTerrainRenderPasses;ALL:[Lorg/embeddedt/embeddium/impl/render/chunk/terrain/TerrainRenderPass;" | ||
) | ||
) | ||
private static void wrapAllClinit(TerrainRenderPass[] value, Operation<Void> original) { | ||
original.call((Object) ArrayUtils.add(value, ModEmbeddiumTerrainRenderPasses.LASER)); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/dev/dubhe/anvilcraft/mixin/compat/SodiumDefaultMaterialsMixin.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.dubhe.anvilcraft.mixin.compat; | ||
|
||
import dev.dubhe.anvilcraft.client.init.ModRenderTypes; | ||
import dev.dubhe.anvilcraft.integration.sodium.ModSodiumMaterials; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.material.DefaultMaterials; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.material.Material; | ||
import net.minecraft.client.renderer.RenderType; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(DefaultMaterials.class) | ||
public class SodiumDefaultMaterialsMixin { | ||
@Inject( | ||
method = "forRenderLayer", | ||
at = @At("HEAD"), | ||
cancellable = true | ||
) | ||
private static void anvilcraft$forRenderLayer(RenderType layer, CallbackInfoReturnable<Material> cir){ | ||
if (layer == ModRenderTypes.LASER){ | ||
cir.setReturnValue(ModSodiumMaterials.LASER); | ||
cir.cancel(); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/dev/dubhe/anvilcraft/mixin/compat/SodiumDefaultTerrainRenderPassesMixin.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,32 @@ | ||
package dev.dubhe.anvilcraft.mixin.compat; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import dev.dubhe.anvilcraft.integration.sodium.ModSodiumTerrainRenderPasses; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.TerrainRenderPass; | ||
import org.apache.commons.lang3.ArrayUtils; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Mutable; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(DefaultTerrainRenderPasses.class) | ||
public class SodiumDefaultTerrainRenderPassesMixin { | ||
|
||
@Shadow @Final @Mutable | ||
public static TerrainRenderPass[] ALL; | ||
|
||
@WrapOperation( | ||
method = "<clinit>", | ||
at = @At( | ||
value = "FIELD", | ||
target = "Lnet/caffeinemc/mods/sodium/client/render/chunk/terrain/DefaultTerrainRenderPasses;ALL:[Lnet/caffeinemc/mods/sodium/client/render/chunk/terrain/TerrainRenderPass;" | ||
) | ||
) | ||
private static void wrapAllClinit(TerrainRenderPass[] value, Operation<Void> original) { | ||
original.call((Object) ArrayUtils.add(value, ModSodiumTerrainRenderPasses.LASER)); | ||
} | ||
|
||
} |
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