Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
Add prismarine aura and crown
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Nov 9, 2021
1 parent 6baefa9 commit 16e2fe0
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public class Illuminations implements ClientModInitializer {
public static DefaultParticleType GOLDENROD_AURA;
public static DefaultParticleType CONFETTI_AURA;
public static DefaultParticleType PRISMATIC_CONFETTI_AURA;
public static DefaultParticleType PRISMARINE_AURA;
// pets
public static DefaultParticleType PRIDE_PET;
public static DefaultParticleType GAY_PRIDE_PET;
Expand Down Expand Up @@ -259,6 +260,8 @@ public Codec<WispTrailParticleEffect> getCodec() {
ParticleFactoryRegistry.getInstance().register(Illuminations.CONFETTI_AURA, ConfettiParticle.DefaultFactory::new);
PRISMATIC_CONFETTI_AURA = Registry.register(Registry.PARTICLE_TYPE, "illuminations:prismatic_confetti", FabricParticleTypes.simple(true));
ParticleFactoryRegistry.getInstance().register(Illuminations.PRISMATIC_CONFETTI_AURA, PrismaticConfettiParticle.DefaultFactory::new);
PRISMARINE_AURA = Registry.register(Registry.PARTICLE_TYPE, "illuminations:prismarine_aura", FabricParticleTypes.simple(true));
ParticleFactoryRegistry.getInstance().register(Illuminations.PRISMARINE_AURA, PrismarineAuraParticle.DefaultFactory::new);

/*
PRIDE PETS
Expand Down Expand Up @@ -366,6 +369,7 @@ public Codec<WispTrailParticleEffect> getCodec() {
.put("goldenrod", new AuraData(GOLDENROD_AURA, () -> DefaultConfig.getAuraSettings("goldenrod")))
.put("confetti", new AuraData(CONFETTI_AURA, () -> DefaultConfig.getAuraSettings("confetti")))
.put("prismatic_confetti", new AuraData(PRISMATIC_CONFETTI_AURA, () -> DefaultConfig.getAuraSettings("prismatic_confetti")))
.put("prismarine", new AuraData(PRISMARINE_AURA, () -> DefaultConfig.getAuraSettings("prismarine")))
.build();

OVERHEADS_DATA = ImmutableMap.<String, OverheadData>builder()
Expand All @@ -383,6 +387,7 @@ public Codec<WispTrailParticleEffect> getCodec() {
.put("summerbreeze_wreath", new OverheadData(WreathModel::new, "summerbreeze_wreath"))
.put("glowsquid_cult_crown", new OverheadData(TiaraModel::new, "glowsquid_cult_crown"))
.put("timeaspect_cult_crown", new OverheadData(TiaraModel::new, "timeaspect_cult_crown"))
.put("prismarine_crown", new OverheadData(CrownModel::new, "prismarine_crown"))
.build();

PETS_DATA = ImmutableMap.<String, DefaultParticleType>builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public final class DefaultConfig {
.put("goldenrod", new AuraSettings(0.4f, 1))
.put("confetti", new AuraSettings(0.1f, 1))
.put("prismatic_confetti", new AuraSettings(0.1f, 1))
.put("prismarine", new AuraSettings(0.1f, 1))
.build();

public static BiomeSettings getBiomeSettings(BiomeCategory biome) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float ti
float maxV = this.getMaxV();
int l = 15728880;

this.colorRed = 0.8f + (float) Math.sin(this.age / 100f) * 0.2f;
// this.colorBlue = 0.9f + (float) Math.cos(this.age/100f) * 0.1f;

vertexConsumer.vertex(Vec3fs[0].getX(), Vec3fs[0].getY(), Vec3fs[0].getZ()).texture(maxU, maxV).color(colorRed, colorGreen, colorBlue, colorAlpha).light(l).next();
vertexConsumer.vertex(Vec3fs[1].getX(), Vec3fs[1].getY(), Vec3fs[1].getZ()).texture(maxU, minV).color(colorRed, colorGreen, colorBlue, colorAlpha).light(l).next();
vertexConsumer.vertex(Vec3fs[2].getX(), Vec3fs[2].getY(), Vec3fs[2].getZ()).texture(minU, minV).color(colorRed, colorGreen, colorBlue, colorAlpha).light(l).next();
Expand Down Expand Up @@ -119,6 +116,9 @@ public void tick() {
}
}

this.colorRed = 0.8f + (float) Math.sin(this.age / 100f) * 0.2f;
// this.colorBlue = 0.9f + (float) Math.cos(this.age/100f) * 0.1f;

this.prevAngle = this.angle;
if (this.onGround) {
this.velocityX = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package ladysnake.illuminations.client.particle.aura;

import ladysnake.illuminations.client.particle.PrismarineCrystalParticle;
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.DefaultParticleType;

import java.util.concurrent.ThreadLocalRandom;

public class PrismarineAuraParticle extends PrismarineCrystalParticle {
public PrismarineAuraParticle(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.setPos(this.x + TwilightFireflyParticle.getWanderingDistance(this.random), this.y + random.nextFloat() * 2d, this.z + TwilightFireflyParticle.getWanderingDistance(this.random));

this.maxAge = ThreadLocalRandom.current().nextInt(100, 400);
}

public void tick() {
if (this.age++ < this.maxAge) {
this.colorAlpha = Math.min(1f, this.colorAlpha + 0.1f);
}

this.prevPosX = this.x;
this.prevPosY = this.y;
this.prevPosZ = this.z;

this.move(this.velocityX, this.velocityY, this.velocityZ);

if (this.age >= this.maxAge) {
this.colorAlpha = Math.max(0f, this.colorAlpha - 0.1f);

if (this.colorAlpha <= 0f) {
this.markDead();
}
}

this.colorRed = 0.8f + (float) Math.sin(this.age / 10f) * 0.2f;
// this.colorBlue = 0.9f + (float) Math.cos(this.age/10f) * 0.1f;

this.prevAngle = this.angle;
if (this.onGround) {
this.velocityX = 0;
this.velocityY = 0;
this.velocityZ = 0;
}

if (this.velocityY != 0) {
this.angle += Math.PI * Math.sin(rotationFactor * this.age) / 2;
}
}

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

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

public Particle createParticle(DefaultParticleType defaultParticleType, ClientWorld clientWorld, double d, double e, double f, double g, double h, double i) {
return new PrismarineAuraParticle(clientWorld, d, e, f, g, h, i, this.spriteProvider);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"material": "canvas:emissive_no_diffuse"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"textures": [
"illuminations:prismarine_crystal_0",
"illuminations:prismarine_crystal_1",
"illuminations:prismarine_crystal_2"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 16e2fe0

Please sign in to comment.