mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 16:13:07 +00:00
Fix Rendering Glitches
This commit is contained in:
1 parent
08728efcdd
commit
abc34b3f6f
7 files changed
+71
-42
No files matched your search
@@ -24,6 +24,10 @@ public class EntityEnergySlicer extends EntityEnergyProjectile {
|
||||
private float sliceWidth = 3.0f;
|
||||
private float sliceThickness = 0.15f;
|
||||
|
||||
// Cached travel direction for smooth rendering when motion is near zero
|
||||
private float lastTravelYaw = 0.0f;
|
||||
private float lastTravelPitch = 0.0f;
|
||||
|
||||
public EntityEnergySlicer(World world) {
|
||||
super(world);
|
||||
}
|
||||
@@ -166,13 +170,16 @@ public class EntityEnergySlicer extends EntityEnergyProjectile {
|
||||
public float getTravelYaw() {
|
||||
if (isCharging()) {
|
||||
Entity owner = previewMode ? previewOwner : getOwnerEntity();
|
||||
if (owner != null) return owner.rotationYaw;
|
||||
if (owner != null) {
|
||||
lastTravelYaw = owner.rotationYaw;
|
||||
return lastTravelYaw;
|
||||
}
|
||||
}
|
||||
double speed = Math.sqrt(motionX * motionX + motionZ * motionZ);
|
||||
if (speed > 0.001) {
|
||||
return (float) (Math.atan2(-motionX, motionZ) * 180.0 / Math.PI);
|
||||
lastTravelYaw = (float) (Math.atan2(-motionX, motionZ) * 180.0 / Math.PI);
|
||||
}
|
||||
return 0.0f;
|
||||
return lastTravelYaw;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,9 +188,9 @@ public class EntityEnergySlicer extends EntityEnergyProjectile {
|
||||
public float getTravelPitch() {
|
||||
double horizSpeed = Math.sqrt(motionX * motionX + motionZ * motionZ);
|
||||
if (horizSpeed > 0.001 || Math.abs(motionY) > 0.001) {
|
||||
return (float) (-Math.atan2(motionY, horizSpeed) * 180.0 / Math.PI);
|
||||
lastTravelPitch = (float) (-Math.atan2(motionY, horizSpeed) * 180.0 / Math.PI);
|
||||
}
|
||||
return 0.0f;
|
||||
return lastTravelPitch;
|
||||
}
|
||||
|
||||
// ==================== GETTERS ====================
|
||||
|
||||
Reference in new issue
Block a user