-
Notifications
You must be signed in to change notification settings - Fork 30
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
3f55cbf
commit e13125c
Showing
136 changed files
with
1,045 additions
and
42 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
55 changes: 55 additions & 0 deletions
55
src/main/java/net/frozenblock/wilderwild/mixin/client/mesoglea/LevelRendererMixin.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,55 @@ | ||
package net.frozenblock.wilderwild.mixin.client.mesoglea; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.frozenblock.wilderwild.block.MesogleaBlock; | ||
import net.minecraft.client.multiplayer.ClientLevel; | ||
import net.minecraft.client.particle.Particle; | ||
import net.minecraft.client.particle.ParticleEngine; | ||
import net.minecraft.client.renderer.LevelRenderer; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.particles.ParticleOptions; | ||
import net.minecraft.core.particles.ParticleTypes; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Mixin(LevelRenderer.class) | ||
public class LevelRendererMixin { | ||
|
||
@Shadow | ||
private @Nullable ClientLevel level; | ||
|
||
@WrapOperation( | ||
method = "addParticleInternal(Lnet/minecraft/core/particles/ParticleOptions;ZZDDDDDD)Lnet/minecraft/client/particle/Particle;", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/particle/ParticleEngine;createParticle(Lnet/minecraft/core/particles/ParticleOptions;DDDDDD)Lnet/minecraft/client/particle/Particle;" | ||
) | ||
) | ||
private Particle wilderWild$replaceWithMesogleaParticles( | ||
ParticleEngine instance, ParticleOptions particleOptions, double d, double e, double f, double g, double h, double i, Operation<Particle> original | ||
) { | ||
if (this.level != null) { | ||
if (particleOptions.equals(ParticleTypes.BUBBLE)) { | ||
BlockState state = this.level.getBlockState(BlockPos.containing(d, e, f)); | ||
if (state.getBlock() instanceof MesogleaBlock mesogleaBlock) { | ||
particleOptions = mesogleaBlock.getBubbleParticle(); | ||
} | ||
} else if (particleOptions.equals(ParticleTypes.SPLASH)) { | ||
BlockState state = this.level.getBlockState(BlockPos.containing(d, e, f)); | ||
if (state.getBlock() instanceof MesogleaBlock mesogleaBlock) { | ||
particleOptions = mesogleaBlock.getSplashParticle(); | ||
} | ||
} | ||
} | ||
|
||
return original.call(instance, particleOptions, d, e, f, g, h, i); | ||
} | ||
|
||
} |
Oops, something went wrong.