Skip to content

Commit

Permalink
Fix SmoothRotationTrait rotating towards 0 on respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jun 26, 2022
1 parent c6a1aba commit d761763
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 259 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void rotateToHave(float yaw, float pitch) {
@Override
public void run() {
if (!npc.isSpawned() || npc.getNavigator().isNavigating()) {
// npc.yHeadRot = Mth.rotateIfNecessary(npc.yHeadRot, npc.yBodyRot, 75);
// npc.yHeadRot = rotateIfNecessary(npc.yHeadRot, npc.yBodyRot, 75);
return;
}
if (!globalSession.hasTarget()) {
Expand All @@ -103,7 +103,7 @@ public void setDefaultPitch(float pitch) {
defaultPitch = pitch;
}

public static class EntityRotation {
private static class EntityRotation {
public float bodyYaw, headYaw, pitch;

public EntityRotation(Entity entity) {
Expand Down Expand Up @@ -200,7 +200,7 @@ public void save(DataKey key) {

public class SmoothRotationSession {
private final RotationParams params;
private int t;
private int t = -1;
private double tx, ty, tz;

public SmoothRotationSession(RotationParams params) {
Expand Down
7 changes: 0 additions & 7 deletions main/src/main/java/net/citizensnpcs/util/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,24 +353,17 @@ public class Messages {
public static final String TEXT_EDITOR_BEGIN = "citizens.editors.text.begin";
public static final String TEXT_EDITOR_CLOSE_TALKER_SET = "citizens.editors.text.close-talker-set";
public static final String TEXT_EDITOR_DELAY_SET = "citizens.editors.text.delay-set";
public static final String TEXT_EDITOR_EDIT_BEGIN_PROMPT = "citizens.editors.text.edit-begin-prompt";
public static final String TEXT_EDITOR_EDIT_PROMPT = "citizens.editors.text.edit-prompt";
public static final String TEXT_EDITOR_EDITED_TEXT = "citizens.editors.text.edited-text";
public static final String TEXT_EDITOR_END = "citizens.editors.text.end";
public static final String TEXT_EDITOR_INVALID_DELAY = "citizens.editors.text.invalid-delay";
public static final String TEXT_EDITOR_INVALID_EDIT_TYPE = "citizens.editors.text.invalid-edit-type";
public static final String TEXT_EDITOR_INVALID_INDEX = "citizens.editors.text.invalid-index";
public static final String TEXT_EDITOR_INVALID_INPUT = "citizens.editors.text.invalid-input";
public static final String TEXT_EDITOR_INVALID_PAGE = "citizens.editors.text.invalid-page";
public static final String TEXT_EDITOR_INVALID_RANGE = "citizens.editors.text.invalid-range";
public static final String TEXT_EDITOR_LIST = "citizens.editors.text.text-list-header";
public static final String TEXT_EDITOR_MISSING_ITEM_PATTERN = "citizens.editors.text.missing-item-set-pattern";
public static final String TEXT_EDITOR_PAGE_PROMPT = "citizens.editors.text.change-page-prompt";
public static final String TEXT_EDITOR_RANDOM_TALKER_SET = "citizens.editors.text.random-talker-set";
public static final String TEXT_EDITOR_RANGE_SET = "citizens.editors.text.range-set";
public static final String TEXT_EDITOR_REALISTIC_LOOKING_SET = "citizens.editors.text.realistic-looking-set";
public static final String TEXT_EDITOR_REMOVE_PROMPT = "citizens.editors.text.remove-prompt";
public static final String TEXT_EDITOR_REMOVED_ENTRY = "citizens.editors.text.removed-entry";
public static final String TEXT_EDITOR_SET_ITEM = "citizens.editors.text.talk-item-set";
public static final String TEXT_EDITOR_SPEECH_BUBBLES_SET = "citizens.editors.text.speech-bubbles-set";
public static final String TEXT_EDITOR_START_PROMPT = "citizens.editors.text.start-prompt";
Expand Down
11 changes: 3 additions & 8 deletions main/src/main/resources/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,7 @@ citizens.editors.text.add-prompt=Enter text to add to the NPC.
citizens.editors.text.added-entry=[[Added]] the entry [[{0}]].
citizens.editors.text.begin=<b>Entered the text editor! Type ''exit'' to leave the editor.
citizens.editors.text.change-page-prompt=Enter a page number to view more text entries.
citizens.editors.text.close-talker-set=[[Close talker]] set to [[{0}]].
citizens.editors.text.edit-begin-prompt=Enter the index of the entry you wish to edit or [[page]] to view more pages.
citizens.editors.text.edit-prompt=Enter text to edit the entry.
citizens.editors.text.edited-text=Changed entry at index [[{0}]] to [[{1}]].
citizens.editors.text.close-talker-set=[[Close talker]] set to [[{0}]].
citizens.editors.text.end=Exited the text editor.
citizens.editors.text.missing-item-set-pattern=Missing item in hand pattern.
citizens.editors.text.invalid-edit-type=Invalid edit type.
Expand All @@ -340,22 +337,20 @@ citizens.editors.text.range-set=[[Range]] set to [[{0}]].
citizens.editors.text.delay-set=[[Delay]] set to [[{0}]] seconds.
citizens.editors.text.realistic-looking-set=[[Realistic looking]] set to [[{0}]].
citizens.editors.text.speech-bubbles-set=[[Speech bubbles]] set to [[{0}]].
citizens.editors.text.remove-prompt=Enter the index of the entry you wish to remove or [[page]] to view more pages.
citizens.editors.text.removed-entry=[[Removed]] entry at index [[{0}]].
citizens.editors.text.start-prompt=<<[[add:command(add ):Add text>> | <<[[item:suggest(item ):Set the talk item in hand pattern (set to ''default'' to clear)>> | <<[[range:suggest(range ):Set the talking range in blocks>> | <<[[delay:suggest(delay ):Set the talking delay in seconds>><br><<{0}talk close:command(close):Toggle sending messages when players get close>> | <<{1}random:command(random):Toggle random talking>> | <<{2}speech bubbles:command(speech bubbles):Toggle showing text as holograms instead of messages>> | <<{3}realistic:command(realistic looking):Toggle requiring line of sight before speaking>>
citizens.editors.text.talk-item-set=[[Talk item pattern]] set to [[{0}]].
citizens.editors.text.text-list-header=Current text:
citizens.editors.waypoints.wander.editing-regions-stop=Exited the region editor.
citizens.editors.waypoints.wander.worldguard-region-not-found=WorldGuard region not found.
citizens.editors.waypoints.wander.worldguard-region-set=WorldGuard region set to [[{0}]].
citizens.editors.waypoints.wander.range-set=Wander range set to xrange [[{0}]] and yrange [[{1}]].
citizens.editors.waypoints.wander.begin=<b>Entered the wander waypoint editor.<br> Type [[xrange <number>]] or [[yrange <number>]] to modify the random wander range. Type [[regions]] to enter the region editor.<br>Type [[delay <ticks>]] to delay the NPC between wanders. Type [[worldguardregion <regionId>]] to restrict movement to a specific WorldGuard region.
citizens.editors.waypoints.wander.begin=<b>Entered the wander waypoint editor.<br><<x range:suggest(xrange ):Set the x range in blocks>> | <<y range:suggest(yrange ):Set the y range in blocks>> | <<delay:suggest(delay ):Ticks to wait in between wanders>><br><<Enter the region editor:command(regions)>> | <<Restrict wandering to WorldGuard regions:suggest(worldguardregion )>>
citizens.editors.waypoints.wander.end=Exited the wander waypoint editor.
citizens.editors.waypoints.wander.delay-set=Delay between wanders set to [[{0}]] ticks.
citizens.editors.waypoints.wander.invalid-delay=Invalid delay specified.
citizens.editors.waypoints.wander.added-region=[[Added]] wanderable region at ({0}) ([[{1}]]).
citizens.editors.waypoints.wander.removed-region=[[Removed]] wanderable region at ({0}) ([[{1}]] remaining).
citizens.editors.waypoints.wander.editing-regions=Now editing regions!<br> [[Left click]] to add a new wanderable region using the xrange/yrange box centred at that block.<br> [[Right click]] an existing marker to remove that region.<br> Type [[regions]] to stop or simply exit the editor. Regions should be overlapping with each other.
citizens.editors.waypoints.wander.editing-regions=Now editing regions!<br> [[Left click]] to add a new wanderable region using the xrange/yrange box centred at that block.<br> [[Right click]] an existing marker to remove that region.<br> Type [[regions]] to stop or simply exit the editor. Regions should be overlap or touch each other.
citizens.editors.waypoints.guided.end=Exited the guided waypoint editor.
citizens.editors.waypoints.guided.begin=<b>Entered the guided waypoint editor! The NPC will randomly walk to a [[destination]] waypoint following the nearest [[guide]] point. For example, try putting guide points on a road and destinations inside houses!<br> [[Left click]] to add a guide waypoint and [[right click]] to remove an existing waypoint.<br> [[Sneak]] while left clicking to add a destination waypoint.<br> Type [[toggle path]] to toggle showing entities at waypoints.<br> Type [[clear]] to clear all waypoints.
citizens.editors.waypoints.guided.added-guide=Added a [[guide]] waypoint which the NPC will follow on the way to their destination.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit d761763

Please sign in to comment.