mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 07:19:05 +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
@@ -33,6 +33,8 @@ public class EntityAbilityDisc extends EntityEnergyProjectile {
|
||||
// Disc shape properties
|
||||
private float discRadius = 1.0f; // Width of disc
|
||||
private float discThickness = 0.2f; // Height of disc
|
||||
private float prevDiscRadius = 1.0f;
|
||||
private float prevDiscThickness = 0.2f;
|
||||
|
||||
// Boomerang owner-gone tracking
|
||||
private int returnOwnerNullTicks = 0;
|
||||
@@ -134,6 +136,10 @@ public class EntityAbilityDisc extends EntityEnergyProjectile {
|
||||
|
||||
@Override
|
||||
protected void updateProjectile() {
|
||||
// Store previous values for interpolation
|
||||
prevDiscRadius = discRadius;
|
||||
prevDiscThickness = discThickness;
|
||||
|
||||
// Handle charging state (windup phase)
|
||||
if (isCharging()) {
|
||||
updateCharging();
|
||||
@@ -347,7 +353,12 @@ public class EntityAbilityDisc extends EntityEnergyProjectile {
|
||||
return discRadius;
|
||||
}
|
||||
|
||||
public float getInterpolatedDiscRadius(float partialTicks) {
|
||||
return prevDiscRadius + (discRadius - prevDiscRadius) * partialTicks;
|
||||
}
|
||||
|
||||
public void setDiscRadius(float radius) {
|
||||
this.prevDiscRadius = this.discRadius;
|
||||
this.discRadius = radius;
|
||||
}
|
||||
|
||||
@@ -355,7 +366,12 @@ public class EntityAbilityDisc extends EntityEnergyProjectile {
|
||||
return discThickness;
|
||||
}
|
||||
|
||||
public float getInterpolatedDiscThickness(float partialTicks) {
|
||||
return prevDiscThickness + (discThickness - prevDiscThickness) * partialTicks;
|
||||
}
|
||||
|
||||
public void setDiscThickness(float thickness) {
|
||||
this.prevDiscThickness = this.discThickness;
|
||||
this.discThickness = thickness;
|
||||
}
|
||||
|
||||
@@ -443,6 +459,8 @@ public class EntityAbilityDisc extends EntityEnergyProjectile {
|
||||
|
||||
@Override
|
||||
protected void applyProjectileClientSyncData(NBTTagCompound nbt) {
|
||||
prevDiscRadius = discRadius;
|
||||
prevDiscThickness = discThickness;
|
||||
discRadius = nbt.getFloat("DiscRadius");
|
||||
discThickness = nbt.getFloat("DiscThickness");
|
||||
vertical = nbt.getBoolean("Vertical");
|
||||
@@ -456,6 +474,8 @@ public class EntityAbilityDisc extends EntityEnergyProjectile {
|
||||
this.boomerangDelay = nbt.hasKey("BoomerangDelay") ? nbt.getInteger("BoomerangDelay") : 40;
|
||||
this.discRadius = sanitize(nbt.hasKey("DiscRadius") ? nbt.getFloat("DiscRadius") : 1.0f, 1.0f, MAX_ENTITY_SIZE);
|
||||
this.discThickness = sanitize(nbt.hasKey("DiscThickness") ? nbt.getFloat("DiscThickness") : 0.2f, 0.2f, MAX_ENTITY_SIZE);
|
||||
this.prevDiscRadius = this.discRadius;
|
||||
this.prevDiscThickness = this.discThickness;
|
||||
this.vertical = nbt.hasKey("Vertical") ? nbt.getBoolean("Vertical") : false;
|
||||
this.returning = nbt.hasKey("Returning") && nbt.getBoolean("Returning");
|
||||
// Charging state (common fields handled by base)
|
||||
|
||||
Reference in new issue
Block a user