forked from GregTechCEu/GregTech
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change bloom layer to use mixin instead of enumHelper (GregTechCEu#2583)
- Loading branch information
Showing
9 changed files
with
111 additions
and
38 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/api/java/meldexun/nothirium/api/renderer/chunk/ChunkRenderPass.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,12 @@ | ||
package meldexun.nothirium.api.renderer.chunk; | ||
|
||
/** | ||
* Adapted and minimized from <a | ||
* href="https://github.com/Meldexun/Nothirium/blob/main/src/main/java/meldexun/nothirium/api/renderer/chunk/ChunkRenderPass.java">ChunkRenderPass.java</a> | ||
*/ | ||
public enum ChunkRenderPass { | ||
; | ||
|
||
public static final ChunkRenderPass[] ALL = ChunkRenderPass.values(); | ||
|
||
} |
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
31 changes: 31 additions & 0 deletions
31
src/main/java/gregtech/mixins/minecraft/BlockRenderLayerMixin.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,31 @@ | ||
package gregtech.mixins.minecraft; | ||
|
||
import net.minecraft.util.BlockRenderLayer; | ||
|
||
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.gen.Invoker; | ||
|
||
@Mixin(BlockRenderLayer.class) | ||
public class BlockRenderLayerMixin { | ||
|
||
@Final | ||
@Shadow | ||
@Mutable | ||
private static BlockRenderLayer[] $VALUES; | ||
|
||
@SuppressWarnings("all") | ||
@Invoker("<init>") | ||
private static BlockRenderLayer create(String name, int ordinal, String directoryName) { | ||
throw new IllegalStateException("Unreachable"); | ||
} | ||
|
||
static { | ||
BlockRenderLayer bloom = create("BLOOM", $VALUES.length, "Bloom"); | ||
|
||
$VALUES = ArrayUtils.add($VALUES, bloom); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/gregtech/mixins/nothirium/ChunkRenderPassMixin.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,35 @@ | ||
package gregtech.mixins.nothirium; | ||
|
||
import meldexun.nothirium.api.renderer.chunk.ChunkRenderPass; | ||
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.gen.Invoker; | ||
|
||
@Mixin(ChunkRenderPass.class) | ||
public class ChunkRenderPassMixin { | ||
|
||
@Final | ||
@Mutable | ||
@Shadow(remap = false) | ||
public static ChunkRenderPass[] $VALUES; | ||
|
||
@Final | ||
@Mutable | ||
@Shadow(remap = false) | ||
public static ChunkRenderPass[] ALL; | ||
|
||
@SuppressWarnings("all") | ||
@Invoker(value = "<init>") | ||
private static ChunkRenderPass create(String name, int ordinal) { | ||
throw new IllegalStateException("Unreachable"); | ||
} | ||
|
||
static { | ||
ChunkRenderPass bloom = create("BLOOM", $VALUES.length); | ||
$VALUES = ArrayUtils.add($VALUES, bloom); | ||
ALL = ChunkRenderPass.values(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"package": "gregtech.mixins.nothirium", | ||
"refmap": "mixins.gregtech.refmap.json", | ||
"target": "@env(DEFAULT)", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"ChunkRenderPassMixin" | ||
], | ||
"client": [], | ||
"server": [] | ||
} |