mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 16:37:45 +00:00
Better Telegraph Tracking
This commit is contained in:
1 parent
5e24a0cf36
commit
077fc3cb1d
2 files changed
+26
-7
No files matched your search
@@ -33,6 +33,7 @@ public class TelegraphInstance {
|
||||
private int entityIdToFollow = -1;
|
||||
private int casterEntityId = -1;
|
||||
private int targetEntityId = -1; // For LINE telegraphs: entity to face (yaw tracking)
|
||||
private boolean trackFollowedEntityYaw = false; // Track followed entity's rotationYaw when no targetEntity
|
||||
|
||||
// Timing
|
||||
private int remainingTicks;
|
||||
@@ -96,6 +97,11 @@ public class TelegraphInstance {
|
||||
this.z = entity.posZ;
|
||||
// Find ground level below the entity for proper telegraph placement
|
||||
this.y = Ability.findGroundLevel(world, entity.posX, entity.posY, entity.posZ);
|
||||
|
||||
// Track followed entity's yaw for directional telegraphs (player casters)
|
||||
if (trackFollowedEntityYaw && targetEntityId < 0) {
|
||||
this.yaw = entity.rotationYaw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +224,7 @@ public class TelegraphInstance {
|
||||
nbt.setInteger("entityIdToFollow", entityIdToFollow);
|
||||
nbt.setInteger("casterEntityId", casterEntityId);
|
||||
nbt.setInteger("targetEntityId", targetEntityId);
|
||||
nbt.setBoolean("trackFollowedYaw", trackFollowedEntityYaw);
|
||||
|
||||
nbt.setInteger("remainingTicks", remainingTicks);
|
||||
nbt.setInteger("totalTicks", totalTicks);
|
||||
@@ -243,6 +250,7 @@ public class TelegraphInstance {
|
||||
this.entityIdToFollow = nbt.getInteger("entityIdToFollow");
|
||||
this.casterEntityId = nbt.getInteger("casterEntityId");
|
||||
this.targetEntityId = nbt.getInteger("targetEntityId");
|
||||
this.trackFollowedEntityYaw = nbt.hasKey("trackFollowedYaw") && nbt.getBoolean("trackFollowedYaw");
|
||||
|
||||
this.remainingTicks = nbt.getInteger("remainingTicks");
|
||||
this.totalTicks = nbt.getInteger("totalTicks");
|
||||
@@ -335,6 +343,14 @@ public class TelegraphInstance {
|
||||
this.targetEntityId = targetEntityId;
|
||||
}
|
||||
|
||||
public boolean isTrackFollowedEntityYaw() {
|
||||
return trackFollowedEntityYaw;
|
||||
}
|
||||
|
||||
public void setTrackFollowedEntityYaw(boolean track) {
|
||||
this.trackFollowedEntityYaw = track;
|
||||
}
|
||||
|
||||
public int getRemainingTicks() {
|
||||
return remainingTicks;
|
||||
}
|
||||
|
||||
@@ -154,6 +154,16 @@ public class ClientTickHandler {
|
||||
renderCNPCPlayer.itemRenderer.updateEquippedItem();
|
||||
}
|
||||
}
|
||||
|
||||
// Tick telegraph manager AFTER entity updates so telegraph positions
|
||||
// match entity interpolation (Phase.END runs after world tick)
|
||||
if (TelegraphManager.ClientInstance != null) {
|
||||
TelegraphManager.ClientInstance.tick(mc.theWorld);
|
||||
}
|
||||
|
||||
// Update lightning bolts for ability effects
|
||||
LightningBolt.updateAll();
|
||||
|
||||
return;
|
||||
}
|
||||
if (mc.thePlayer != null && mc.thePlayer.openContainer instanceof ContainerPlayer) {
|
||||
@@ -179,13 +189,6 @@ public class ClientTickHandler {
|
||||
MusicController.Instance.onUpdate();
|
||||
ScriptSoundController.Instance.onUpdate();
|
||||
|
||||
// Tick telegraph manager for ability warnings
|
||||
if (TelegraphManager.ClientInstance != null) {
|
||||
TelegraphManager.ClientInstance.tick(mc.theWorld);
|
||||
}
|
||||
|
||||
// Update lightning bolts for ability effects
|
||||
LightningBolt.updateAll();
|
||||
if (Minecraft.getMinecraft().thePlayer != null && (prevWidth != mc.displayWidth || prevHeight != mc.displayHeight)) {
|
||||
prevWidth = mc.displayWidth;
|
||||
prevHeight = mc.displayHeight;
|
||||
|
||||
Reference in new issue
Block a user