Merge branch 'master' of https://github.com/paulevsGitch/BetterEnd
|
@ -1,56 +0,0 @@
|
||||||
package ru.betterend.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.DefaultParticleType;
|
|
||||||
import ru.betterend.util.MHelper;
|
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public class AnimatedTestParticle extends AnimatedParticle {
|
|
||||||
private int ticks;
|
|
||||||
|
|
||||||
protected AnimatedTestParticle(ClientWorld world, double x, double y, double z, SpriteProvider sprites) {
|
|
||||||
super(world, x, y, z, sprites, 0);
|
|
||||||
setSprite(sprites.getSprite(random));
|
|
||||||
this.maxAge = MHelper.randRange(20, 80, random);
|
|
||||||
this.scale = MHelper.randRange(0.1F, 0.3F, random);
|
|
||||||
this.setTargetColor(15916745);
|
|
||||||
this.setSpriteForAge(spriteProvider);
|
|
||||||
this.velocityX = random.nextGaussian() * 0.1F;
|
|
||||||
this.velocityY = random.nextGaussian() * 0.1F;
|
|
||||||
this.velocityZ = random.nextGaussian() * 0.1F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tick() {
|
|
||||||
ticks ++;
|
|
||||||
if (ticks > 10) {
|
|
||||||
this.velocityX = random.nextGaussian() * 0.1F;
|
|
||||||
this.velocityY = random.nextGaussian() * 0.1F;
|
|
||||||
this.velocityZ = random.nextGaussian() * 0.1F;
|
|
||||||
ticks = 0;
|
|
||||||
}
|
|
||||||
super.tick();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public static class Factory implements ParticleFactory<DefaultParticleType> {
|
|
||||||
|
|
||||||
private final SpriteProvider sprites;
|
|
||||||
|
|
||||||
public Factory(SpriteProvider sprites) {
|
|
||||||
this.sprites = sprites;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z,
|
|
||||||
double vX, double vY, double vZ) {
|
|
||||||
return new AnimatedTestParticle(world, x, y, z, sprites);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package ru.betterend.particle;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import net.minecraft.network.PacketByteBuf;
|
||||||
|
import net.minecraft.particle.ParticleEffect;
|
||||||
|
import net.minecraft.particle.ParticleType;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import ru.betterend.registry.ParticleRegistry;
|
||||||
|
|
||||||
|
public class GlowingSphereParticleEffect implements ParticleEffect {
|
||||||
|
private final float red;
|
||||||
|
private final float green;
|
||||||
|
private final float blue;
|
||||||
|
|
||||||
|
public GlowingSphereParticleEffect(float red, float green, float blue) {
|
||||||
|
this.red = red;
|
||||||
|
this.green = green;
|
||||||
|
this.blue = blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ParticleType<?> getType() {
|
||||||
|
return ParticleRegistry.GLOWING_SPHERE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(PacketByteBuf buf) {
|
||||||
|
buf.writeFloat(this.red);
|
||||||
|
buf.writeFloat(this.green);
|
||||||
|
buf.writeFloat(this.blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String asString() {
|
||||||
|
return String.format(Locale.ROOT, "%s %.2f %.2f %.2f", Registry.PARTICLE_TYPE.getId(this.getType()), this.red, this.green, this.blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getRed() {
|
||||||
|
return this.red;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getGreen() {
|
||||||
|
return this.green;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getBlue() {
|
||||||
|
return this.blue;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package ru.betterend.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.DefaultParticleType;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import ru.betterend.util.MHelper;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public class ParticleGlowingSphere extends AnimatedParticle {
|
||||||
|
private int ticks;
|
||||||
|
private double preVX;
|
||||||
|
private double preVY;
|
||||||
|
private double preVZ;
|
||||||
|
private double nextVX;
|
||||||
|
private double nextVY;
|
||||||
|
private double nextVZ;
|
||||||
|
|
||||||
|
protected ParticleGlowingSphere(ClientWorld world, double x, double y, double z, SpriteProvider sprites, double r, double g, double b) {
|
||||||
|
super(world, x, y, z, sprites, 0);
|
||||||
|
setSprite(sprites.getSprite(random));
|
||||||
|
this.maxAge = MHelper.randRange(150, 300, random);
|
||||||
|
this.scale = MHelper.randRange(0.05F, 0.15F, random);
|
||||||
|
this.setTargetColor(15916745);
|
||||||
|
this.setSpriteForAge(spriteProvider);
|
||||||
|
|
||||||
|
preVX = random.nextGaussian() * 0.02;
|
||||||
|
preVY = random.nextGaussian() * 0.02;
|
||||||
|
preVZ = random.nextGaussian() * 0.02;
|
||||||
|
|
||||||
|
nextVX = random.nextGaussian() * 0.02;
|
||||||
|
nextVY = random.nextGaussian() * 0.02;
|
||||||
|
nextVZ = random.nextGaussian() * 0.02;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
ticks ++;
|
||||||
|
if (ticks > 30) {
|
||||||
|
preVX = nextVX;
|
||||||
|
preVY = nextVY;
|
||||||
|
preVZ = nextVZ;
|
||||||
|
nextVX = random.nextGaussian() * 0.02;
|
||||||
|
nextVY = random.nextGaussian() * 0.02;
|
||||||
|
nextVZ = random.nextGaussian() * 0.02;
|
||||||
|
ticks = 0;
|
||||||
|
}
|
||||||
|
double delta = (double) ticks / 30.0;
|
||||||
|
|
||||||
|
this.velocityX = MathHelper.lerp(delta, preVX, nextVX);
|
||||||
|
this.velocityY = MathHelper.lerp(delta, preVY, nextVY);
|
||||||
|
this.velocityZ = MathHelper.lerp(delta, preVZ, nextVZ);
|
||||||
|
|
||||||
|
super.tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public static class FactoryGlowingSphere implements ParticleFactory<DefaultParticleType> {
|
||||||
|
|
||||||
|
private final SpriteProvider sprites;
|
||||||
|
|
||||||
|
public FactoryGlowingSphere(SpriteProvider sprites) {
|
||||||
|
this.sprites = sprites;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double vX, double vY, double vZ) {
|
||||||
|
return new ParticleGlowingSphere(world, x, y, z, sprites, 1, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,13 +5,13 @@ import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
|
||||||
import net.minecraft.particle.DefaultParticleType;
|
import net.minecraft.particle.DefaultParticleType;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.particle.AnimatedTestParticle;
|
import ru.betterend.particle.ParticleGlowingSphere;
|
||||||
|
|
||||||
public class ParticleRegistry {
|
public class ParticleRegistry {
|
||||||
public static final DefaultParticleType TEST = register("test");
|
public static final DefaultParticleType GLOWING_SPHERE = register("glowing_sphere");
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
ParticleFactoryRegistry.getInstance().register(TEST, AnimatedTestParticle.Factory::new);
|
ParticleFactoryRegistry.getInstance().register(GLOWING_SPHERE, ParticleGlowingSphere.FactoryGlowingSphere::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DefaultParticleType register(String name) {
|
private static DefaultParticleType register(String name) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class BiomeFoggyMushroomland extends EndBiome {
|
||||||
.setWaterColor(119, 227, 250)
|
.setWaterColor(119, 227, 250)
|
||||||
.setWaterFogColor(119, 227, 250)
|
.setWaterFogColor(119, 227, 250)
|
||||||
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
|
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
|
||||||
.setParticles(ParticleRegistry.TEST, 0.001F)
|
.setParticles(ParticleRegistry.GLOWING_SPHERE, 0.001F)
|
||||||
.addFeature(FeatureRegistry.ENDER_ORE)
|
.addFeature(FeatureRegistry.ENDER_ORE)
|
||||||
.addFeature(FeatureRegistry.END_LAKE)
|
.addFeature(FeatureRegistry.END_LAKE)
|
||||||
.addFeature(FeatureRegistry.MOSSY_GLOWSHROOM)
|
.addFeature(FeatureRegistry.MOSSY_GLOWSHROOM)
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"textures": [
|
||||||
|
"betterend:glowing_sphere_0",
|
||||||
|
"betterend:glowing_sphere_1",
|
||||||
|
"betterend:glowing_sphere_2",
|
||||||
|
"betterend:glowing_sphere_3",
|
||||||
|
"betterend:glowing_sphere_4",
|
||||||
|
|
||||||
|
"betterend:glowing_sphere_5",
|
||||||
|
"betterend:glowing_sphere_6",
|
||||||
|
"betterend:glowing_sphere_7",
|
||||||
|
"betterend:glowing_sphere_6",
|
||||||
|
"betterend:glowing_sphere_5",
|
||||||
|
|
||||||
|
"betterend:glowing_sphere_4",
|
||||||
|
|
||||||
|
"betterend:glowing_sphere_5",
|
||||||
|
"betterend:glowing_sphere_6",
|
||||||
|
"betterend:glowing_sphere_7",
|
||||||
|
"betterend:glowing_sphere_6",
|
||||||
|
"betterend:glowing_sphere_5",
|
||||||
|
|
||||||
|
"betterend:glowing_sphere_4",
|
||||||
|
|
||||||
|
"betterend:glowing_sphere_5",
|
||||||
|
"betterend:glowing_sphere_6",
|
||||||
|
"betterend:glowing_sphere_7",
|
||||||
|
"betterend:glowing_sphere_6",
|
||||||
|
"betterend:glowing_sphere_5",
|
||||||
|
|
||||||
|
"betterend:glowing_sphere_4",
|
||||||
|
|
||||||
|
"betterend:glowing_sphere_3",
|
||||||
|
"betterend:glowing_sphere_2",
|
||||||
|
"betterend:glowing_sphere_1",
|
||||||
|
"betterend:glowing_sphere_0"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"textures": [
|
|
||||||
"minecraft:spell_0",
|
|
||||||
"minecraft:spell_1",
|
|
||||||
"minecraft:spell_2",
|
|
||||||
"minecraft:spell_3",
|
|
||||||
"minecraft:spell_4",
|
|
||||||
"minecraft:spell_5",
|
|
||||||
"minecraft:spell_6",
|
|
||||||
"minecraft:spell_7",
|
|
||||||
"minecraft:spell_6",
|
|
||||||
"minecraft:spell_5",
|
|
||||||
"minecraft:spell_4",
|
|
||||||
"minecraft:spell_3",
|
|
||||||
"minecraft:spell_2",
|
|
||||||
"minecraft:spell_1",
|
|
||||||
"minecraft:spell_0"
|
|
||||||
]
|
|
||||||
}
|
|
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.5 KiB |