custom particles

This commit is contained in:
Jenny committed 2025-01-25 23:56:13 +01:00
1 parent 27e2c56cb9
commit 31306bb116
13 files changed
+140 -15

No files matched your search

@@ -230,7 +230,7 @@ public class baseArrow extends AbstractArrow {
}
public void spawnParticles() {
public void spawnParticles(float partialTicks) {
}
@@ -3,12 +3,13 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
public class concussiveArrow extends baseArrow{
@@ -43,12 +44,13 @@ public class concussiveArrow extends baseArrow{
}
@Override
public void spawnParticles() {
public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.arrowParticleCount; i++) {
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;
level().addParticle(ParticleTypes.WAX_ON, x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
Vec3 pos = getPosition(partialTicks);
double x = pos.x + (double) level().getRandom().nextInt(-5, 6) / 10;
double y = pos.y + (double) level().getRandom().nextInt(-5, 6) / 10;
double z = pos.z + (double) level().getRandom().nextInt(-5, 6) / 10;
level().addParticle(particles.CONCUSSIVE_ARROW_PARTICLE.get(), x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
}
}
}
@@ -4,11 +4,12 @@ import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.core.particles.ParticleTypes;
import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
public class tntArrow extends baseArrow {
@@ -44,12 +45,13 @@ public class tntArrow extends baseArrow {
}
@Override
public void spawnParticles() {
public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.arrowParticleCount; i++) {
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;
level().addParticle(ParticleTypes.WAX_ON, x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
Vec3 pos = getPosition(partialTicks);
double x = pos.x + (double) level().getRandom().nextInt(-5, 6) / 10;
double y = pos.y + (double) level().getRandom().nextInt(-5, 6) / 10;
double z = pos.z + (double) level().getRandom().nextInt(-5, 6) / 10;
level().addParticle(particles.TNT_ARROW_PARTICLE.get(), x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
}
}
}
@@ -35,7 +35,7 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
if (renderParticles) {
pEntity.spawnParticles();
pEntity.spawnParticles(pPartialTicks);
}
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
pPoseStack.popPose();