mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Minorly tweak the floating animation/item position and remove the stutter
This commit is contained in:
parent
107f08321f
commit
2a2f08b939
1 changed files with 13 additions and 8 deletions
|
@ -120,22 +120,27 @@ public class LevitatingItemRenderer {
|
||||||
boolean doNormal = entity.getItemUseTime() <= 0 || action == UseAction.NONE || action == UseAction.CROSSBOW;
|
boolean doNormal = entity.getItemUseTime() <= 0 || action == UseAction.NONE || action == UseAction.CROSSBOW;
|
||||||
|
|
||||||
if (doNormal) { // eating, blocking, and drinking are not transformed. Only held items.
|
if (doNormal) { // eating, blocking, and drinking are not transformed. Only held items.
|
||||||
float ticks = MinecraftClient.getInstance().getTickDelta() - entity.age;
|
int sign = left ? 1 : -1;
|
||||||
|
float ticks = entity.age * sign;
|
||||||
|
|
||||||
float floatAmount = (float)Math.sin(ticks / 9) / 40;
|
float floatAmount = -(float)Math.sin(ticks / 9F) / 40F;
|
||||||
float driftAmount = (float)Math.cos(ticks / 6) / 40;
|
float driftAmount = -(float)Math.cos(ticks / 6F) / 40F;
|
||||||
|
|
||||||
boolean handHeldTool =
|
boolean handHeldTool =
|
||||||
action == UseAction.BOW
|
action == UseAction.BOW
|
||||||
|| action == UseAction.CROSSBOW
|
|| action == UseAction.CROSSBOW
|
||||||
|| action == UseAction.BLOCK;
|
|| action == UseAction.BLOCK;
|
||||||
|
|
||||||
stack.translate(driftAmount - floatAmount / 4, floatAmount, handHeldTool ? -0.3F : -0.6F);
|
float distanceChange = handHeldTool ? -0.3F : -0.6F;
|
||||||
|
|
||||||
if (/*!renderer.hasDepthInGui(item) && */!handHeldTool) { // bows have to point forwards
|
stack.translate(
|
||||||
int sign = left ? 1 : -1;
|
driftAmount - floatAmount / 4F + distanceChange / 1.5F * sign,
|
||||||
stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(sign * -60));
|
floatAmount,
|
||||||
stack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(sign * 30));
|
distanceChange);
|
||||||
|
|
||||||
|
if (!handHeldTool) { // bows have to point forwards
|
||||||
|
stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(sign * -60 + floatAmount));
|
||||||
|
stack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(sign * 30 + driftAmount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue