mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 10:49:47 +00:00
Add Interpolation to Size of Energy Projectiles
This commit is contained in:
1 parent
30885683f2
commit
7b8ad7c6b5
7 files changed
+60
-11
No files matched your search
@@ -41,6 +41,8 @@ public class EntityAbilityBeam extends EntityEnergyProjectile {
|
||||
// Beam shape properties
|
||||
private float beamWidth = 0.3f;
|
||||
private float headSize = 0.5f;
|
||||
private float prevBeamWidth = 0.3f;
|
||||
private float prevHeadSize = 0.5f;
|
||||
|
||||
// Trail - list of points showing beam path (RELATIVE to origin!)
|
||||
private List<Vec3> trailPoints = new ArrayList<>();
|
||||
@@ -240,10 +242,12 @@ public class EntityAbilityBeam extends EntityEnergyProjectile {
|
||||
return;
|
||||
}
|
||||
|
||||
// Store previous head offset for interpolation
|
||||
// Store previous values for interpolation
|
||||
prevHeadOffsetX = headOffsetX;
|
||||
prevHeadOffsetY = headOffsetY;
|
||||
prevHeadOffsetZ = headOffsetZ;
|
||||
prevBeamWidth = beamWidth;
|
||||
prevHeadSize = headSize;
|
||||
|
||||
// Age trail points for fading effect
|
||||
if (isFadingMode()) {
|
||||
@@ -580,7 +584,12 @@ public class EntityAbilityBeam extends EntityEnergyProjectile {
|
||||
return beamWidth;
|
||||
}
|
||||
|
||||
public float getInterpolatedBeamWidth(float partialTicks) {
|
||||
return prevBeamWidth + (beamWidth - prevBeamWidth) * partialTicks;
|
||||
}
|
||||
|
||||
public void setBeamWidth(float beamWidth) {
|
||||
this.prevBeamWidth = this.beamWidth;
|
||||
this.beamWidth = beamWidth;
|
||||
}
|
||||
|
||||
@@ -588,7 +597,12 @@ public class EntityAbilityBeam extends EntityEnergyProjectile {
|
||||
return headSize;
|
||||
}
|
||||
|
||||
public float getInterpolatedHeadSize(float partialTicks) {
|
||||
return prevHeadSize + (headSize - prevHeadSize) * partialTicks;
|
||||
}
|
||||
|
||||
public void setHeadSize(float headSize) {
|
||||
this.prevHeadSize = this.headSize;
|
||||
this.headSize = headSize;
|
||||
}
|
||||
|
||||
@@ -747,6 +761,8 @@ public class EntityAbilityBeam extends EntityEnergyProjectile {
|
||||
|
||||
@Override
|
||||
protected void applyProjectileClientSyncData(NBTTagCompound nbt) {
|
||||
prevBeamWidth = beamWidth;
|
||||
prevHeadSize = headSize;
|
||||
beamWidth = nbt.getFloat("BeamWidth");
|
||||
headSize = nbt.getFloat("HeadSize");
|
||||
setAttachedToOwner(nbt.getBoolean("AttachedToOwner"));
|
||||
@@ -758,6 +774,8 @@ public class EntityAbilityBeam extends EntityEnergyProjectile {
|
||||
protected void readProjectileNBT(NBTTagCompound nbt) {
|
||||
this.beamWidth = sanitize(nbt.hasKey("BeamWidth") ? nbt.getFloat("BeamWidth") : 0.3f, 0.3f, MAX_ENTITY_SIZE);
|
||||
this.headSize = sanitize(nbt.hasKey("HeadSize") ? nbt.getFloat("HeadSize") : 0.5f, 0.5f, MAX_ENTITY_SIZE);
|
||||
this.prevBeamWidth = this.beamWidth;
|
||||
this.prevHeadSize = this.headSize;
|
||||
this.headOffsetX = nbt.hasKey("HeadOffsetX") ? nbt.getDouble("HeadOffsetX") : 0;
|
||||
this.headOffsetY = nbt.hasKey("HeadOffsetY") ? nbt.getDouble("HeadOffsetY") : 0;
|
||||
this.headOffsetZ = nbt.hasKey("HeadOffsetZ") ? nbt.getDouble("HeadOffsetZ") : 0;
|
||||
|
||||
Reference in new issue
Block a user