Skip to content

Commit

Permalink
fix slime particle quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed May 21, 2024
1 parent 6746201 commit d637d15
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/io/ix0rai/rainglow/mixin/SlimeEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,21 @@ public boolean spawnWithParentColour(World instance, Entity entity) {
*/
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V"),
slice = @Slice(
from = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/SlimeEntity;getSize()I"),
from = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/SlimeEntity;getDimensions(Lnet/minecraft/entity/EntityPose;)Lnet/minecraft/entity/EntityDimensions;"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/SlimeEntity;playSound(Lnet/minecraft/sound/SoundEvent;FF)V")
)
)
public void tick(CallbackInfo ci) {
int size = this.getSize();
float size = this.getDimensions(this.getPose()).width();
String colour = RainglowColour.get(Rainglow.getColour(RainglowEntity.SLIME, this.getDataTracker(), this.random)).getId();
int index = Rainglow.getColourIndex(colour);

for(int j = 0; j < size * 2; j ++) {
for(int j = 0; j < size / 4; j ++) {
float f = this.random.nextFloat() * 6.2831855F;
float g = this.random.nextFloat() * 0.5F + 0.5F;
float h = MathHelper.sin(f) * (float)size * 0.5F * g;
float k = MathHelper.cos(f) * (float)size * 0.5F * g;
float h = MathHelper.sin(f) * size * g;
float k = MathHelper.cos(f) * size * g;
// note: y velocity of 100 is a magic value
this.getWorld().addParticle(this.getParticles(), this.getX() + (double)h, this.getY(), this.getZ() + (double)k, index, 100.0, 0.0);
}
}
Expand Down

0 comments on commit d637d15

Please sign in to comment.