-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a Crash for DimensionEnvJsonRule Work a Bit More on Axiom Compat
- Loading branch information
1 parent
8c2e69f
commit e209555
Showing
18 changed files
with
214 additions
and
28 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
11 changes: 11 additions & 0 deletions
11
.../firstmegagame4/env/driven/assets/client/impl/axiom/MappedBlockAndTintGetterInstance.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,11 @@ | ||
package fr.firstmegagame4.env.driven.assets.client.impl.axiom; | ||
|
||
import net.minecraft.world.BlockRenderView; | ||
import net.minecraft.world.World; | ||
|
||
public interface MappedBlockAndTintGetterInstance { | ||
|
||
BlockRenderView getView(); | ||
|
||
World getWorld(); | ||
} |
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
40 changes: 40 additions & 0 deletions
40
src/main/java/fr/firstmegagame4/env/driven/assets/mixin/client/ChunkedBlockRegionMixin.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,40 @@ | ||
package fr.firstmegagame4.env.driven.assets.mixin.client; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.moulberry.axiom.render.regions.ChunkedBlockRegion; | ||
import fr.firstmegagame4.env.driven.assets.client.EDAEnvJsonVisitors; | ||
import fr.firstmegagame4.env.driven.assets.client.duck.BakedModelDuckInterface; | ||
import fr.firstmegagame4.env.driven.assets.client.injected.ModelManagerContainer; | ||
import fr.firstmegagame4.env.driven.assets.client.model.ModelManager; | ||
import fr.firstmegagame4.env.json.api.EnvJson; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.render.BufferBuilder; | ||
import net.minecraft.client.render.block.BlockRenderManager; | ||
import net.minecraft.client.render.model.BakedModel; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.BlockRenderView; | ||
import org.joml.Matrix4f; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(ChunkedBlockRegion.class) | ||
public class ChunkedBlockRegionMixin { | ||
|
||
@ModifyExpressionValue(method = "renderBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/BlockRenderManager;getModel(Lnet/minecraft/block/BlockState;)Lnet/minecraft/client/render/model/BakedModel;")) | ||
private static BakedModel mutateBakedModel(BakedModel original, BufferBuilder blockBuilder, BlockRenderManager renderManager, BlockPos.Mutable blockPos, Random rand, MatrixStack matrices, BlockRenderView blockAndTintGetter, Matrix4f currentPoseMatrix, Matrix4f basePoseMatrix, int x, int y, int z, BlockState dataState, boolean useAmbientOcclusion) { | ||
BakedModelDuckInterface ducked = (BakedModelDuckInterface) original; | ||
if (ducked.env_driven_assets$getEnvJson() != null) { | ||
EnvJson envJson = ducked.env_driven_assets$getEnvJson(); | ||
Identifier identifier = envJson.apply(EDAEnvJsonVisitors.blockVisitor(blockAndTintGetter, new BlockPos(blockPos))); | ||
if (identifier != null) { | ||
ModelManager manager = ((ModelManagerContainer) MinecraftClient.getInstance().getBakedModelManager()).getModelManager(); | ||
return manager.changeModelWithoutSettings(identifier); | ||
} | ||
} | ||
return original; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../java/fr/firstmegagame4/env/driven/assets/mixin/client/MappedBlockAndTintGetterMixin.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,28 @@ | ||
package fr.firstmegagame4.env.driven.assets.mixin.client; | ||
|
||
import fr.firstmegagame4.env.driven.assets.client.impl.axiom.MappedBlockAndTintGetterInstance; | ||
import net.minecraft.world.BlockRenderView; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Pseudo | ||
@Mixin(targets = "com.moulberry.axiom.render.ChunkRenderOverrider$MappedBlockAndTintGetter") | ||
public class MappedBlockAndTintGetterMixin implements MappedBlockAndTintGetterInstance { | ||
|
||
@Shadow | ||
@Final | ||
private World level; | ||
|
||
@Override | ||
public BlockRenderView getView() { | ||
return (BlockRenderView) this; | ||
} | ||
|
||
@Override | ||
public World getWorld() { | ||
return this.level; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
accessWidener v1 named | ||
|
||
accessible class com/moulberry/axiom/render/ChunkRenderOverrider$MappedBlockAndTintGetter | ||
accessible class net/minecraft/client/render/model/BakedModelManager$BakingResult | ||
accessible class net/minecraft/client/render/model/ModelLoader$BakedModelCacheKey | ||
accessible class net/minecraft/client/render/model/ModelLoader$BakerImpl |
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