client desync fix (I think)
This commit is contained in:
parent
23942c9972
commit
55ee7fc999
@ -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.1
|
||||
mod_version=0.9.2
|
||||
# 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
|
||||
|
@ -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);
|
||||
@ -34,14 +35,17 @@ public class tunnelArrow extends baseArrow{
|
||||
@Override
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
explode();
|
||||
this.discard();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,4 +69,12 @@ public class tunnelArrow extends baseArrow{
|
||||
level().addParticle(particles.TUNNEL_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
|
||||
}
|
||||
}
|
||||
|
||||
public void sync() {
|
||||
if (!level().isClientSide) {
|
||||
setPos(position());
|
||||
setRot(getYRot(), getXRot());
|
||||
setDeltaMovement(getDeltaMovement());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user