particles for homing tnt & toggle for tnt particles
This commit is contained in:
parent
129c27ba47
commit
0961e9654d
@ -95,11 +95,13 @@ public class enderTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
public static void spawnParticles(Level level, BlockPos blockPos) {
|
||||
for (int i = 1; i<=ConfigClient.calcPCount(30); i++) {
|
||||
float x = blockPos.getX() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10 + 0.5F;
|
||||
float y = blockPos.getY() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10;
|
||||
float z = blockPos.getZ() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10 + 0.5F;
|
||||
level.addParticle(ParticleTypes.GLOW, x, y, z, 0, 0, 0);
|
||||
if (ConfigClient.tntParticles) {
|
||||
for (int i = 1; i <= ConfigClient.calcPCount(30); i++) {
|
||||
float x = blockPos.getX() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10 + 0.5F;
|
||||
float y = blockPos.getY() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10;
|
||||
float z = blockPos.getZ() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10 + 0.5F;
|
||||
level.addParticle(ParticleTypes.GLOW, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,19 +15,24 @@ public class ConfigClient {
|
||||
BUILDER.comment("weather to spawn client-side particles for arrows")
|
||||
.define("arrowParticles", true);
|
||||
|
||||
private static final ForgeConfigSpec.ConfigValue<Boolean> C_TNT_PARTICLES =
|
||||
BUILDER.comment("weather to spawn client-side particles for tnt")
|
||||
.define("tntParticles", true);
|
||||
|
||||
private static final ForgeConfigSpec.ConfigValue<Float> C_PARTICLE_PERCENT =
|
||||
BUILDER.comment("amount of particles to spawn (0.0 = None, 1.0 = normal, values higher are valid too)")
|
||||
.define("arrowParticleCount", 1.0f);
|
||||
|
||||
public static final ForgeConfigSpec SPEC = BUILDER.build();
|
||||
|
||||
public static boolean arrowParticles;
|
||||
public static boolean arrowParticles, tntParticles;
|
||||
public static float particlePercent;
|
||||
|
||||
@SubscribeEvent
|
||||
static void onLoad(final ModConfigEvent event)
|
||||
{
|
||||
arrowParticles = C_ARROW_PARTICLES.get();
|
||||
tntParticles = C_TNT_PARTICLES.get();
|
||||
particlePercent = C_PARTICLE_PERCENT.get();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.jenny.enhancedexplosives.entities.client;
|
||||
|
||||
import com.jenny.enhancedexplosives.blocks.blocks;
|
||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||
import com.jenny.enhancedexplosives.entities.tnt.basePrimedTNT;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
@ -35,7 +35,10 @@ public class BaseTNTRenderer<T extends basePrimedTNT> extends EntityRenderer<T>
|
||||
float f1 = 1.0F + f * 0.3F;
|
||||
pPoseStack.scale(f1, f1, f1);
|
||||
}
|
||||
|
||||
if (ConfigClient.tntParticles) {
|
||||
pEntity.spawnParticles(pPartialTicks);
|
||||
}
|
||||
pEntity.spawnParticles(pPartialTicks);
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
|
||||
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
|
||||
|
@ -134,4 +134,6 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
public int defaultFuse() {
|
||||
return this.fuse;
|
||||
}
|
||||
|
||||
public void spawnParticles(float partialTicks) {}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.jenny.enhancedexplosives.entities.tnt;
|
||||
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
@ -8,8 +11,6 @@ import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.entity.*;
|
||||
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
@ -90,4 +91,11 @@ public class homingPrimedTNT extends basePrimedTNT {
|
||||
this.entityData.define(DATA_SPEED_ID, 4.0f);
|
||||
super.defineSynchedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticles(float partialTicks) {
|
||||
for (int i = 1; i <= ConfigClient.calcPCount(30); i++) {
|
||||
level().addParticle(ParticleTypes.FALLING_OBSIDIAN_TEAR, getX(), getY(), getZ(), this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user