-
Notifications
You must be signed in to change notification settings - Fork 68
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
Showing
15 changed files
with
289 additions
and
150 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
51 changes: 51 additions & 0 deletions
51
src/client/java/org/ladysnake/effective/core/index/EffectiveParticles.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,51 @@ | ||
package org.ladysnake.effective.core.index; | ||
|
||
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; | ||
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; | ||
import net.minecraft.particle.ParticleType; | ||
import net.minecraft.particle.SimpleParticleType; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Identifier; | ||
import org.ladysnake.effective.core.Effective; | ||
import org.ladysnake.effective.core.particle.*; | ||
import org.ladysnake.effective.core.particle.types.SplashParticleType; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public interface EffectiveParticles { | ||
|
||
Map<ParticleType<?>, Identifier> PARTICLES = new LinkedHashMap<>(); | ||
|
||
SplashParticleType SPLASH = create("splash", new SplashParticleType(true)); | ||
SplashParticleType GLOW_SPLASH = create("glow_splash", new SplashParticleType(true)); | ||
SimpleParticleType DROPLET = create("droplet", FabricParticleTypes.simple(true)); | ||
SimpleParticleType GLOW_DROPLET = create("glow_droplet", FabricParticleTypes.simple(true)); | ||
SimpleParticleType RIPPLE = create("ripple", FabricParticleTypes.simple(true)); | ||
SimpleParticleType GLOW_RIPPLE = create("glow_ripple", FabricParticleTypes.simple(true)); | ||
SimpleParticleType BUBBLE = create("bubble", FabricParticleTypes.simple(true)); | ||
SimpleParticleType END_BUBBLE = create("end_bubble", FabricParticleTypes.simple(true)); | ||
|
||
static void initialize() { | ||
PARTICLES.keySet().forEach(particle -> Registry.register(Registries.PARTICLE_TYPE, PARTICLES.get(particle), particle)); | ||
|
||
registerFactories(); | ||
} | ||
|
||
private static <T extends ParticleType<?>> T create(String name, T particle) { | ||
PARTICLES.put(particle, Effective.id(name)); | ||
return particle; | ||
} | ||
|
||
private static void registerFactories() { | ||
ParticleFactoryRegistry.getInstance().register(SPLASH, SplashParticle.Factory::new); | ||
ParticleFactoryRegistry.getInstance().register(GLOW_SPLASH, GlowSplashParticle.Factory::new); | ||
ParticleFactoryRegistry.getInstance().register(DROPLET, DropletParticle.Factory::new); | ||
ParticleFactoryRegistry.getInstance().register(GLOW_DROPLET, GlowDropletParticle.Factory::new); | ||
ParticleFactoryRegistry.getInstance().register(RIPPLE, RippleParticle.Factory::new); | ||
ParticleFactoryRegistry.getInstance().register(GLOW_RIPPLE, GlowRippleParticle.Factory::new); | ||
ParticleFactoryRegistry.getInstance().register(BUBBLE, BubbleParticle.Factory::new); | ||
ParticleFactoryRegistry.getInstance().register(END_BUBBLE, BubbleParticle.Factory::new); | ||
} | ||
} |
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
74 changes: 52 additions & 22 deletions
74
src/client/java/org/ladysnake/effective/core/particle/BubbleParticle.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 |
---|---|---|
@@ -1,22 +1,52 @@ | ||
//package org.ladysnake.effective.core.particle; | ||
// | ||
//import net.fabricmc.fabric.impl.client.particle.FabricSpriteProviderImpl; | ||
//import net.minecraft.client.world.ClientWorld; | ||
//import net.minecraft.util.math.BlockPos; | ||
//import team.lodestar.lodestone.systems.particle.world.FrameSetParticle; | ||
//import team.lodestar.lodestone.systems.particle.world.options.WorldParticleOptions; | ||
// | ||
//public class BubbleParticle extends FrameSetParticle { | ||
// public BubbleParticle(ClientWorld world, WorldParticleOptions data, FabricSpriteProviderImpl spriteSet, double x, double y, double z, double xd, double yd, double zd) { | ||
// super(world, data, spriteSet, x, y, z, xd, yd, zd); | ||
// } | ||
// | ||
// @Override | ||
// public void tick() { | ||
// super.tick(); | ||
// | ||
// if (!world.isWater(BlockPos.ofFloored(this.x, this.y, this.z))) { | ||
// this.markDead(); | ||
// } | ||
// } | ||
//} | ||
package org.ladysnake.effective.core.particle; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.particle.*; | ||
import net.minecraft.client.world.ClientWorld; | ||
import net.minecraft.particle.SimpleParticleType; | ||
import net.minecraft.util.math.BlockPos; | ||
|
||
public class BubbleParticle extends SpriteBillboardParticle { | ||
private final SpriteProvider spriteProvider; | ||
|
||
public BubbleParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) { | ||
super(world, x, y, z, velocityX, velocityY, velocityZ); | ||
|
||
this.velocityX = velocityX; | ||
this.velocityY = velocityY; | ||
this.velocityZ = velocityZ; | ||
|
||
this.spriteProvider = spriteProvider; | ||
this.maxAge = 500; | ||
this.scale = .05f; | ||
|
||
this.setSpriteForAge(spriteProvider); | ||
} | ||
|
||
public ParticleTextureSheet getType() { | ||
return ParticleTextureSheet.PARTICLE_SHEET_OPAQUE; | ||
} | ||
|
||
public void tick() { | ||
super.tick(); | ||
|
||
if (!world.isWater(BlockPos.ofFloored(this.x, this.y, this.z))) { | ||
this.markDead(); | ||
} | ||
} | ||
|
||
@Environment(EnvType.CLIENT) | ||
public static class Factory implements ParticleFactory<SimpleParticleType> { | ||
private final SpriteProvider spriteProvider; | ||
|
||
public Factory(SpriteProvider spriteProvider) { | ||
this.spriteProvider = spriteProvider; | ||
} | ||
|
||
@Override | ||
public Particle createParticle(SimpleParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { | ||
return new BubbleParticle(world, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider); | ||
} | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/client/java/org/ladysnake/effective/core/particle/EndBubbleParticle.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,33 @@ | ||
package org.ladysnake.effective.core.particle; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
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; | ||
|
||
public class EndBubbleParticle extends BubbleParticle { | ||
public EndBubbleParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) { | ||
super(world, x, y, z, velocityX, velocityY, velocityZ, spriteProvider); | ||
|
||
this.red = 0; | ||
this.green = 1; | ||
this.blue = 1; | ||
} | ||
|
||
@Environment(EnvType.CLIENT) | ||
public static class Factory implements ParticleFactory<SimpleParticleType> { | ||
private final SpriteProvider spriteProvider; | ||
|
||
public Factory(SpriteProvider spriteProvider) { | ||
this.spriteProvider = spriteProvider; | ||
} | ||
|
||
@Override | ||
public Particle createParticle(SimpleParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { | ||
return new EndBubbleParticle(world, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider); | ||
} | ||
} | ||
} |
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.