Skip to content

Commit

Permalink
My gradle broke so can't test
Browse files Browse the repository at this point in the history
  • Loading branch information
KekeCreations committed Aug 9, 2024
1 parent bceec66 commit d93415c
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.uraneptus.sullysmod.client.particles;

import com.uraneptus.sullysmod.core.registry.SMFluids;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.*;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jetbrains.annotations.NotNull;

public class SMDripParticle extends TextureSheetParticle {
private final Fluid type;
protected boolean isGlowing;

protected SMDripParticle(ClientLevel pLevel, double pX, double pY, double pZ, Fluid pType) {
super(pLevel, pX, pY, pZ);
type = pType;
this.setSize(0.01F, 0.01F);
this.gravity = 0.06F;
}

@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_OPAQUE;
}

public int getLightColor(float pPartialTick) {
return this.isGlowing ? 240 : super.getLightColor(pPartialTick);
}

public void tick() {
this.xo = this.x;
this.yo = this.y;
this.zo = this.z;
this.preMoveUpdate();
if (!this.removed) {
this.yd -= (double)this.gravity;
this.move(this.xd, this.yd, this.zd);
this.postMoveUpdate();
if (!this.removed) {
this.xd *= 0.9800000190734863;
this.yd *= 0.9800000190734863;
this.zd *= 0.9800000190734863;
if (this.type != Fluids.EMPTY) {
BlockPos $$0 = BlockPos.containing(this.x, this.y, this.z);
FluidState $$1 = this.level.getFluidState($$0);
if ($$1.getType() == this.type && this.y < (double)((float)$$0.getY() + $$1.getHeight(this.level, $$0))) {
this.remove();
}

}
}
}
}

protected void preMoveUpdate() {
if (this.lifetime-- <= 0) {
this.remove();
}

}

protected void postMoveUpdate() {
if (this.onGround) {
this.remove();
}
}

@OnlyIn(Dist.CLIENT)
public static class Factory implements ParticleProvider<SimpleParticleType> {
private final SpriteSet spriteProvider;

public Factory(SpriteSet spriteProvider) {
this.spriteProvider = spriteProvider;
}

public Particle createParticle(@NotNull SimpleParticleType defaultParticleType, @NotNull ClientLevel clientWorld, double d, double e, double f, double g, double h, double i) {
return new SMDripParticle(clientWorld, d, e, f, SMFluids.SOURCE_MOLTEN_AMBER.get());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.uraneptus.sullysmod.client.model.ancient_skulls.*;
import com.uraneptus.sullysmod.client.particles.BlotEyesParticle;
import com.uraneptus.sullysmod.client.particles.RicochetParticle;
import com.uraneptus.sullysmod.client.particles.SMDripParticle;
import com.uraneptus.sullysmod.client.renderer.be.AmberBER;
import com.uraneptus.sullysmod.client.renderer.be.ItemStandBER;
import com.uraneptus.sullysmod.client.renderer.entities.*;
Expand All @@ -18,6 +19,7 @@
import com.uraneptus.sullysmod.core.registry.SMItems;
import com.uraneptus.sullysmod.core.registry.SMParticleTypes;
import net.minecraft.Util;
import net.minecraft.client.particle.DripParticle;
import net.minecraft.client.renderer.blockentity.SkullBlockRenderer;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.item.ItemProperties;
Expand Down Expand Up @@ -76,6 +78,7 @@ public static void registerLayerLocation(EntityRenderersEvent.RegisterLayerDefin
public static void registerParticleProvider(RegisterParticleProvidersEvent event) {
event.registerSpriteSet(SMParticleTypes.RICOCHET.get(), RicochetParticle.RicochetParticleProvider::new);
event.registerSpriteSet(SMParticleTypes.BLOT_EYES.get(), BlotEyesParticle.Factory::new);
event.registerSpriteSet(SMParticleTypes.AMBER_DRIP.get(), SMDripParticle.Factory::new);
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.uraneptus.sullysmod.SullysMod;
import com.uraneptus.sullysmod.common.particletypes.ParticleWithDirectionType;
import net.minecraft.client.particle.DripParticle;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraftforge.fml.common.Mod;
Expand All @@ -16,4 +17,6 @@ public class SMParticleTypes {
public static final RegistryObject<ParticleWithDirectionType> RICOCHET = PARTICLES.register("ricochet", () -> new ParticleWithDirectionType(false));

public static final RegistryObject<SimpleParticleType> BLOT_EYES = PARTICLES.register("blot_eyes", () -> new SimpleParticleType(false));

public static final RegistryObject<SimpleParticleType> AMBER_DRIP = PARTICLES.register("amber_drip", () -> new SimpleParticleType(false));
}
5 changes: 5 additions & 0 deletions src/main/resources/assets/sullysmod/particles/amber_drip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"textures": [
"minecraft:drip_hang"
]
}

0 comments on commit d93415c

Please sign in to comment.