Compare commits

...

4 Commits

6 changed files with 25 additions and 17 deletions

View File

@ -38,7 +38,7 @@ mod_name=Enhanced Explosives
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=0.9.0
mod_version=0.9.4
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -11,8 +11,9 @@ import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
public class tunnelArrow extends baseArrow{
public static int explosionCount = 16;
public static int spacing = 2;
protected static int explosionCount = 12;
protected static int spacing = 2;
protected static float power = 8;
public tunnelArrow(EntityType<tunnelArrow> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
@ -26,22 +27,29 @@ public class tunnelArrow extends baseArrow{
public void tick() {
super.tick();
if (inGround) {
explode();
if (!level().isClientSide) {
explode();
}
discard();
}
}
@Override
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
explode();
this.discard();
if (!level().isClientSide) {
explode();
}
discard();
}
protected void explode() {
// sync();
Vec3 rot = getTargetVec( - getXRot(), - getYRot(), 0);
for (int i = 0; i < explosionCount; i++) {
Vec3 pos = position().add(rot.multiply(i * spacing, i * spacing, i * spacing));
this.level().explode(this, pos.x, pos.y, pos.z, 8.0f, Level.ExplosionInteraction.TNT);
System.out.println(level().isClientSide + "|" + i + "|" + pos + "|" + getXRot() + "|" + getYRot());
level().explode(this, pos.x, pos.y, pos.z,
power, Level.ExplosionInteraction.TNT);
}
}

View File

@ -46,7 +46,7 @@ public class dynamite extends basePrimedTNT {
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level().isClientSide) {
this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
spawnParticles();
}
}
}

View File

@ -1,6 +1,5 @@
package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;

View File

@ -1,5 +1,6 @@
package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.config.ConfigClient;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
@ -66,7 +67,9 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
public void tick() {
if (level().isClientSide) {
spawnParticles(0);
if (ConfigClient.tntParticles) {
spawnParticles();
}
}
if (!this.isNoGravity()) {
this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.04D, 0.0D));
@ -87,9 +90,6 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
}
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level().isClientSide) {
this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
@ -138,5 +138,7 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
return this.fuse;
}
public void spawnParticles(float partialTicks) {}
public void spawnParticles() {
level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), 0, 0, 0);
}
}

View File

@ -96,10 +96,9 @@ public class homingPrimedTNT extends basePrimedTNT {
}
@Override
public void spawnParticles(float partialTicks) {
Vec3 pos = getPosition(partialTicks);
public void spawnParticles() {
for (int i = 1; i <= ConfigClient.calcPCount(1); i++) {
level().addParticle(ParticleTypes.FLAME, pos.x, pos.y, pos.z, 0, 0, 0);
level().addParticle(ParticleTypes.FLAME, getX(), getY(), getZ(), 0, 0, 0);
}
}