mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +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;
|
protected OrientedData hand;
|
||||||
|
|
||||||
AllBlockPartials currentHand;
|
AllBlockPartials currentHand;
|
||||||
float progress = Float.NaN;
|
float progress;
|
||||||
private boolean newHand = false;
|
private boolean newHand = false;
|
||||||
|
|
||||||
public DeployerInstance(InstancedTileRenderer<?> dispatcher, KineticTileEntity tile) {
|
public DeployerInstance(InstancedTileRenderer<?> dispatcher, KineticTileEntity tile) {
|
||||||
|
@ -50,9 +50,9 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
||||||
updateHandPose();
|
updateHandPose();
|
||||||
relight(pos, pole);
|
relight(pos, pole);
|
||||||
|
|
||||||
|
progress = getProgress(AnimationTickHolder.getPartialTicks());
|
||||||
updateRotation(pole, hand, yRot, zRot, zRotPole);
|
updateRotation(pole, hand, yRot, zRot, zRotPole);
|
||||||
|
updatePosition();
|
||||||
beginFrame();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,19 +70,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
||||||
progress = newProgress;
|
progress = newProgress;
|
||||||
newHand = false;
|
newHand = false;
|
||||||
|
|
||||||
float handLength = currentHand == AllBlockPartials.DEPLOYER_HAND_POINTING ? 0
|
updatePosition();
|
||||||
: 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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -110,6 +98,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
||||||
|
|
||||||
relight(pos, hand);
|
relight(pos, hand);
|
||||||
updateRotation(pole, hand, yRot, zRot, zRotPole);
|
updateRotation(pole, hand, yRot, zRot, zRotPole);
|
||||||
|
updatePosition();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -122,6 +111,21 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
||||||
return 0;
|
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) {
|
static void updateRotation(OrientedData pole, OrientedData hand, float yRot, float zRot, float zRotPole) {
|
||||||
|
|
||||||
Quaternion q = Direction.SOUTH.getUnitVector().getDegreesQuaternion(zRot);
|
Quaternion q = Direction.SOUTH.getUnitVector().getDegreesQuaternion(zRot);
|
||||||
|
|
Loading…
Reference in a new issue