mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-16 17:44:23 +01:00
Fixed bow positioning and orientation, and make the spyglass slign better to ponies' eye. Fixes #193
This commit is contained in:
parent
f2bd8bb3b3
commit
73cc5ecc54
2 changed files with 35 additions and 13 deletions
|
@ -1,6 +1,8 @@
|
||||||
package com.minelittlepony.client.render.entity.feature;
|
package com.minelittlepony.client.render.entity.feature;
|
||||||
|
|
||||||
import com.minelittlepony.api.model.IUnicorn;
|
import com.minelittlepony.api.model.IUnicorn;
|
||||||
|
import com.minelittlepony.api.pony.meta.Size;
|
||||||
|
import com.minelittlepony.api.pony.meta.Sizes;
|
||||||
import com.minelittlepony.client.MineLittlePony;
|
import com.minelittlepony.client.MineLittlePony;
|
||||||
import com.minelittlepony.client.model.IPonyModel;
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||||
|
@ -29,24 +31,41 @@ public class GlowingItemFeature<T extends LivingEntity, M extends EntityModel<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preItemRender(T entity, ItemStack drop, ModelTransformation.Mode transform, Arm hand, MatrixStack stack) {
|
protected void preItemRender(T entity, ItemStack drop, ModelTransformation.Mode transform, Arm arm, MatrixStack stack) {
|
||||||
super.preItemRender(entity, drop, transform, hand, stack);
|
super.preItemRender(entity, drop, transform, arm, stack);
|
||||||
|
|
||||||
float left = hand == Arm.LEFT ? 1 : -1;
|
if (!isUnicorn()) {
|
||||||
|
return;
|
||||||
if (isUnicorn()) {
|
|
||||||
stack.translate(-0.3F - (0.3F * left), 0.375F, 0.6F);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float left = arm == Arm.LEFT ? 1 : -1;
|
||||||
|
|
||||||
|
stack.translate(-0.3F - (0.3F * left), 0.375F, 0.6F);
|
||||||
|
|
||||||
UseAction action = drop.getUseAction();
|
UseAction action = drop.getUseAction();
|
||||||
|
|
||||||
if (isUnicorn() && (action == UseAction.SPYGLASS || action == UseAction.BOW) && entity.getItemUseTimeLeft() > 0) {
|
if ((action == UseAction.SPYGLASS || action == UseAction.BOW) && entity.getItemUseTimeLeft() > 0) {
|
||||||
Arm main = entity.getMainArm();
|
Arm main = entity.getMainArm();
|
||||||
if (entity.getActiveHand() == Hand.OFF_HAND) {
|
if (entity.getActiveHand() == Hand.OFF_HAND) {
|
||||||
main = main.getOpposite();
|
main = main.getOpposite();
|
||||||
}
|
}
|
||||||
if (main == hand) {
|
if (main == arm) {
|
||||||
stack.translate(-0.1F + (0.3F * left), -0.1F, -1.1F);
|
if (action == UseAction.SPYGLASS) {
|
||||||
|
Size size = getContextModel().getSize();
|
||||||
|
float x = 0.4F;
|
||||||
|
float z = -0.8F;
|
||||||
|
|
||||||
|
if (size == Sizes.TALL || size == Sizes.YEARLING) {
|
||||||
|
z += 0.05F;
|
||||||
|
} else if (size == Sizes.FOAL) {
|
||||||
|
x -= 0.1F;
|
||||||
|
z -= 0.1F;
|
||||||
|
}
|
||||||
|
|
||||||
|
stack.translate(x * left, -0.2, z);
|
||||||
|
} else {
|
||||||
|
stack.translate(0, 0.2, -0.6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,18 +78,21 @@ public class HeldItemFeature<T extends LivingEntity, M extends EntityModel<T> &
|
||||||
|
|
||||||
UseAction action = drop.getUseAction();
|
UseAction action = drop.getUseAction();
|
||||||
|
|
||||||
if ((action == UseAction.SPYGLASS || action == UseAction.BOW) && entity.getItemUseTimeLeft() > 0) {
|
if (action == UseAction.SPYGLASS && entity.getItemUseTimeLeft() > 0) {
|
||||||
Arm main = entity.getMainArm();
|
Arm main = entity.getMainArm();
|
||||||
if (entity.getActiveHand() == Hand.OFF_HAND) {
|
if (entity.getActiveHand() == Hand.OFF_HAND) {
|
||||||
main = main.getOpposite();
|
main = main.getOpposite();
|
||||||
}
|
}
|
||||||
if (main == arm) {
|
if (main == arm) {
|
||||||
stack.translate(left * -0.05F, 0.5F, 0.7F);
|
stack.translate(left * -0.05F, 0.5F, 0.7F);
|
||||||
float incline = -60;
|
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-60));
|
||||||
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(incline));
|
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-90));
|
||||||
}
|
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(left * 180));
|
||||||
}
|
stack.translate(left * -0.2F, 0.125F, -1);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (entity.hasVehicle()) {
|
if (entity.hasVehicle()) {
|
||||||
stack.translate(left / 10, -0.2F, -0.5F);
|
stack.translate(left / 10, -0.2F, -0.5F);
|
||||||
|
|
Loading…
Reference in a new issue