Skip to content

Commit

Permalink
totem particles
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Nov 13, 2024
1 parent 55dd601 commit 3f00da5
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.particle.SimpleParticleType;
import net.minecraft.util.math.MathHelper;

@Environment(EnvType.CLIENT)
public class CherineFlameParticle extends AbstractSlowingParticle {
CherineFlameParticle(ClientWorld clientWorld, double d, double e, double f, double g, double h, double i) {
super(clientWorld, d, e, f, g, h, i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Basically just a SuspendParticle, but that particle isn't public :I
* These are bigger than normal suspend particles though
*/
@Environment(EnvType.CLIENT)
public class LevitaBloopParticle extends SpriteBillboardParticle {

LevitaBloopParticle(ClientWorld clientWorld, double d, double e, double f, double g, double h, double i) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package net.id.paradiselost.client.rendering.particle;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.particle.AnimatedParticle;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleFactory;
import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.SimpleParticleType;

@Environment(EnvType.CLIENT)
public class LevitationTotemParticle extends AnimatedParticle {
LevitationTotemParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) {
super(world, x, y, z, spriteProvider, 1.25F);
this.velocityMultiplier = 0.6F;
this.velocityX = velocityX;
this.velocityY = velocityY;
this.velocityZ = velocityZ;
this.scale *= 0.75F;
this.maxAge = 60 + this.random.nextInt(12);
this.setSpriteForAge(spriteProvider);
if (this.random.nextInt(4) == 0) {
this.setColor(0.6F + this.random.nextFloat() * 0.2F, 0.4F + this.random.nextFloat() * 0.3F, 0.7F + this.random.nextFloat() * 0.3F);
} else {
this.setColor(0.17F + this.random.nextFloat() * 0.2F, 0.25F + this.random.nextFloat() * 0.3F, 0.7F + this.random.nextFloat() * 0.2F);
}
}

@Environment(EnvType.CLIENT)
public static class DefaultFactory implements ParticleFactory<SimpleParticleType> {
private final SpriteProvider spriteProvider;

public DefaultFactory(SpriteProvider spriteProvider) {
this.spriteProvider = spriteProvider;
}

public Particle createParticle(SimpleParticleType simpleParticleType, ClientWorld clientWorld, double d, double e, double f, double g, double h, double i) {
return new LevitationTotemParticle(clientWorld, d, e, f, g, h, i, this.spriteProvider);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class ParadiseLostParticles {
public static SimpleParticleType FALLING_ORANGE_PETAL = register("falling_orange_petal");
public static SimpleParticleType CHERINE_FLAME = register("cherine_flame");
public static SimpleParticleType LEVITA_BLOOP = register("levita_bloop");
public static SimpleParticleType LEVITATION_TOTEM = register("levitation_totem");

/**
* Registers a simple particle type.
Expand Down Expand Up @@ -55,6 +56,7 @@ public static void init() {
register(FALLING_ORANGE_PETAL, FallingOrangePetalParticle.DefaultFactory::new);
register(CHERINE_FLAME, CherineFlameParticle.DefaultFactory::new);
register(LEVITA_BLOOP, LevitaBloopParticle.DefaultFactory::new);
register(LEVITATION_TOTEM, LevitationTotemParticle.DefaultFactory::new);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.id.paradiselost.mixin.client.network;

import net.id.paradiselost.client.rendering.particle.ParadiseLostParticles;
import net.id.paradiselost.client.rendering.util.ParadiseLostEvents;
import net.id.paradiselost.client.sound.LevitaMovingMinecartSoundInstance;
import net.id.paradiselost.items.ParadiseLostItems;
Expand Down Expand Up @@ -46,7 +47,7 @@ public void onEntityStatus(EntityStatusS2CPacket packet, CallbackInfo ci) {
Entity entity = packet.getEntity(this.world);
if (entity != null) {
if (packet.getStatus() == ParadiseLostEvents.LEVITATION_TOTEM_USED) {
this.client.particleManager.addEmitter(entity, ParticleTypes.TOTEM_OF_UNDYING, 30);
this.client.particleManager.addEmitter(entity, ParadiseLostParticles.LEVITATION_TOTEM, 30);
this.world.playSound(entity.getX(), entity.getY(), entity.getZ(), SoundEvents.ITEM_TOTEM_USE, entity.getSoundCategory(), 1.0F, 1.0F, false);
if (entity == this.client.player) {
this.client.gameRenderer.showFloatingItem(ParadiseLostItems.TOTEM_OF_LEVITATION.getDefaultStack());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"textures": [
"minecraft:glitter_7",
"minecraft:glitter_6",
"minecraft:glitter_5",
"minecraft:glitter_4",
"minecraft:glitter_3",
"minecraft:glitter_2",
"minecraft:glitter_1",
"minecraft:glitter_0"
]
}

0 comments on commit 3f00da5

Please sign in to comment.