Skip to content

Commit

Permalink
This fixes it for good now
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Sep 20, 2023
1 parent 0767707 commit cccc033
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
],
"injectors": {
"defaultRequire": 1
}
},
"minVersion": "0.8.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Slice;

Expand All @@ -38,6 +40,9 @@ abstract class BlockDustParticleMixin extends SpriteBillboardParticle {
@Final
private BlockPos blockPos;

@Unique
private boolean fabric_disableTintCheck;

private BlockDustParticleMixin() {
super(null, 0, 0, 0);
}
Expand All @@ -48,10 +53,15 @@ private BlockDustParticleMixin() {
argsOnly = true,
slice = @Slice(
from = @At(value = "FIELD", target = "Lnet/minecraft/client/particle/BlockDustParticle;blue:F", ordinal = 0),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/color/block/BlockColors;getColor(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/util/math/BlockPos;I)I")
to = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z")
),
allow = 1
)
@Group(
name = "unintable_particles",
min = 1,
max = 1
)
private BlockState removeUntintableParticles(BlockState state) {
if (!ParticleRenderEvents.ALLOW_BLOCK_DUST_TINT.invoker().allowBlockDustTint(state, world, blockPos)) {
// As of 1.20.1, vanilla hardcodes grass block particles to not get tinted.
Expand All @@ -60,4 +70,44 @@ private BlockState removeUntintableParticles(BlockState state) {

return state;
}

@ModifyVariable(
method = "<init>(Lnet/minecraft/client/world/ClientWorld;DDDDDDLnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)V",
at = @At("LOAD"),
argsOnly = true,
slice = @Slice(
from = @At(value = "FIELD", target = "Lnet/minecraft/client/particle/BlockDustParticle;blue:F", ordinal = 0),
to = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/extensions/common/IClientBlockExtensions;of(Lnet/minecraft/block/BlockState;)Lnet/minecraftforge/client/extensions/common/IClientBlockExtensions;")
),
allow = 1
)
@Group(
name = "unintable_particles",
min = 1,
max = 1
)
private BlockState removeUntintableParticlesNewForge(BlockState state) {
if (!ParticleRenderEvents.ALLOW_BLOCK_DUST_TINT.invoker().allowBlockDustTint(state, world, blockPos)) {
// As of 1.20.1, vanilla hardcodes grass block particles to not get tinted.
fabric_disableTintCheck = true;
return Blocks.GRASS_BLOCK.getDefaultState();
}
fabric_disableTintCheck = false;
return state;
}

@ModifyVariable(
method = "<init>(Lnet/minecraft/client/world/ClientWorld;DDDDDDLnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)V",
at = @At("LOAD"),
argsOnly = true,
slice = @Slice(
from = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/extensions/common/IClientBlockExtensions;of(Lnet/minecraft/block/BlockState;)Lnet/minecraftforge/client/extensions/common/IClientBlockExtensions;"),
to = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/extensions/common/IClientBlockExtensions;areBreakingParticlesTinted(Lnet/minecraft/block/BlockState;Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/util/math/BlockPos;)Z")
),
allow = 1,
require = 0
)
private BlockState removeUntintableParticlesNewForgeSecondary(BlockState state) {
return fabric_disableTintCheck ? Blocks.GRASS_BLOCK.getDefaultState() : state;
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ fabric-client-tags-api-v1-version=1.1.1
loom.platform=forge
forge_version=1.20.1-47.1.3
pack_format=15
forgified_version=1.9.12
forgified_version=1.9.13
forge_fabric_loader_version=2.2.1+0.14.21+1.20.1

0 comments on commit cccc033

Please sign in to comment.