-
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.
- Loading branch information
1 parent
12db275
commit 313cfb6
Showing
16 changed files
with
194 additions
and
53 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
69 changes: 69 additions & 0 deletions
69
src/main/java/fr/firstmegagame4/env/driven/assets/client/impl/env/json/EmptyVisitor.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,69 @@ | ||
package fr.firstmegagame4.env.driven.assets.client.impl.env.json; | ||
|
||
import fr.firstmegagame4.env.json.api.EnvJsonVisitor; | ||
import fr.firstmegagame4.env.json.api.rule.SkyEnvJsonRule; | ||
import fr.firstmegagame4.env.json.api.rule.VoidEnvJsonRule; | ||
import fr.firstmegagame4.env.json.api.rule.WaterEnvJsonRule; | ||
import it.unimi.dsi.fastutil.ints.Int2BooleanFunction; | ||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.registry.tag.TagKey; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.Biome; | ||
|
||
public class EmptyVisitor implements EnvJsonVisitor { | ||
|
||
@Override | ||
public boolean applyDimensionKey(RegistryKey<World> dimensionKey) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applyDimensionTag(TagKey<World> dimensionTag) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applyBiomeKey(RegistryKey<Biome> biomeKey) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applyBiomeTag(TagKey<Biome> biomeTag) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applyXCoord(Int2BooleanFunction operation) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applyYCoord(Int2BooleanFunction operation) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applyZCoord(Int2BooleanFunction operation) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applySubmerged(boolean submerged) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applySky(SkyEnvJsonRule.Localization localization) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applyWater(WaterEnvJsonRule.Localization localization) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean applyVoid(VoidEnvJsonRule.Localization localization) { | ||
return false; | ||
} | ||
} |
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/client/injected/BakedModelRedirection.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.client.injected; | ||
|
||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; | ||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.BlockRenderView; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public interface BakedModelRedirection extends FabricBakedModel { | ||
|
||
default boolean shouldAllowBlockRedirection(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context, boolean isAlreadyRedirected) { | ||
return true; | ||
} | ||
|
||
default boolean shouldAllowItemRedirection(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context, boolean isAlreadyRedirected) { | ||
return true; | ||
} | ||
|
||
default void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context, boolean isRedirected) { | ||
if (this.shouldAllowBlockRedirection(blockView, state, pos, randomSupplier, context, isRedirected)) { | ||
this.emitBlockQuads(blockView, state, pos, randomSupplier, context); | ||
} | ||
else { | ||
FabricBakedModel.super.emitBlockQuads(blockView, state, pos, randomSupplier, context); | ||
} | ||
} | ||
|
||
default void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context, boolean isRedirected) { | ||
if (this.shouldAllowItemRedirection(stack, randomSupplier, context, isRedirected)) { | ||
this.emitItemQuads(stack, randomSupplier, context); | ||
} | ||
else { | ||
FabricBakedModel.super.emitItemQuads(stack, randomSupplier, context); | ||
} | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/main/java/fr/firstmegagame4/env/driven/assets/mixin/client/BakedModelMixin.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 fr.firstmegagame4.env.driven.assets.mixin.client; | ||
|
||
import fr.firstmegagame4.env.driven.assets.client.injected.BakedModelRedirection; | ||
import net.minecraft.client.render.model.BakedModel; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(BakedModel.class) | ||
public interface BakedModelMixin extends BakedModelRedirection {} |
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
15 changes: 0 additions & 15 deletions
15
src/main/java/fr/firstmegagame4/env/driven/assets/mixin/client/ModelLoaderAccessor.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.