mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Probably fix ghost hands appearing by the player
This commit is contained in:
parent
b845809b58
commit
ba91eaa4ef
1 changed files with 20 additions and 16 deletions
|
@ -30,7 +30,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
protected OrientedData hand;
|
||||
|
||||
AllBlockPartials currentHand;
|
||||
float progress = Float.NaN;
|
||||
float progress;
|
||||
private boolean newHand = false;
|
||||
|
||||
public DeployerInstance(InstancedTileRenderer<?> dispatcher, KineticTileEntity tile) {
|
||||
|
@ -50,9 +50,9 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
updateHandPose();
|
||||
relight(pos, pole);
|
||||
|
||||
progress = getProgress(AnimationTickHolder.getPartialTicks());
|
||||
updateRotation(pole, hand, yRot, zRot, zRotPole);
|
||||
|
||||
beginFrame();
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,19 +70,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
progress = newProgress;
|
||||
newHand = false;
|
||||
|
||||
float handLength = currentHand == AllBlockPartials.DEPLOYER_HAND_POINTING ? 0
|
||||
: currentHand == AllBlockPartials.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
|
||||
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (tile.reach + handLength), 21 / 16f);
|
||||
Vec3i facingVec = facing.getDirectionVec();
|
||||
BlockPos blockPos = getInstancePosition();
|
||||
|
||||
float x = blockPos.getX() + ((float) facingVec.getX()) * distance;
|
||||
float y = blockPos.getY() + ((float) facingVec.getY()) * distance;
|
||||
float z = blockPos.getZ() + ((float) facingVec.getZ()) * distance;
|
||||
|
||||
pole.setPosition(x, y, z);
|
||||
hand.setPosition(x, y, z);
|
||||
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,6 +98,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
|
||||
relight(pos, hand);
|
||||
updateRotation(pole, hand, yRot, zRot, zRotPole);
|
||||
updatePosition();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -122,6 +111,21 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
return 0;
|
||||
}
|
||||
|
||||
private void updatePosition() {
|
||||
float handLength = currentHand == AllBlockPartials.DEPLOYER_HAND_POINTING ? 0
|
||||
: currentHand == AllBlockPartials.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
|
||||
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (tile.reach + handLength), 21 / 16f);
|
||||
Vec3i facingVec = facing.getDirectionVec();
|
||||
BlockPos blockPos = getInstancePosition();
|
||||
|
||||
float x = blockPos.getX() + ((float) facingVec.getX()) * distance;
|
||||
float y = blockPos.getY() + ((float) facingVec.getY()) * distance;
|
||||
float z = blockPos.getZ() + ((float) facingVec.getZ()) * distance;
|
||||
|
||||
pole.setPosition(x, y, z);
|
||||
hand.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
static void updateRotation(OrientedData pole, OrientedData hand, float yRot, float zRot, float zRotPole) {
|
||||
|
||||
Quaternion q = Direction.SOUTH.getUnitVector().getDegreesQuaternion(zRot);
|
||||
|
|
Loading…
Reference in a new issue