-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make eating/blocking rotation locking smooth. Fix rotation lock when …
…eating/blocking on a ladder. Fix #186
- Loading branch information
Showing
9 changed files
with
99 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...n/java/dev/tr7zw/notenoughanimations/animations/fullbody/ActionRotationLockAnimation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package dev.tr7zw.notenoughanimations.animations.fullbody; | ||
|
||
import dev.tr7zw.notenoughanimations.access.PlayerData; | ||
import dev.tr7zw.notenoughanimations.api.BasicAnimation; | ||
import dev.tr7zw.notenoughanimations.versionless.NEABaseMod; | ||
import dev.tr7zw.notenoughanimations.versionless.animations.BodyPart; | ||
import net.minecraft.client.model.PlayerModel; | ||
import net.minecraft.client.player.AbstractClientPlayer; | ||
import net.minecraft.world.item.ItemUseAnimation; | ||
|
||
public class ActionRotationLockAnimation extends BasicAnimation { | ||
|
||
private BodyPart[] target = new BodyPart[] { BodyPart.BODY }; | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return NEABaseMod.config.enableRotationLocking; | ||
} | ||
|
||
@Override | ||
public boolean isValid(AbstractClientPlayer entity, PlayerData data) { | ||
if (entity.getUseItemRemainingTicks() > 0) { | ||
ItemUseAnimation action = entity.getUseItem().getUseAnimation(); | ||
// Eating/Drinking | ||
if (action == ItemUseAnimation.EAT || action == ItemUseAnimation.DRINK || action == ItemUseAnimation.BLOCK) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public BodyPart[] getBodyParts(AbstractClientPlayer entity, PlayerData data) { | ||
return target; | ||
} | ||
|
||
@Override | ||
public int getPriority(AbstractClientPlayer entity, PlayerData data) { | ||
// lower than animations like ladder | ||
return 1250; | ||
} | ||
|
||
@Override | ||
public void apply(AbstractClientPlayer entity, PlayerData data, PlayerModel model, BodyPart part, float delta, | ||
float tickCounter) { | ||
data.setRotateBodyToHead(true); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters