Allow block breakers to work at center of bearing

This commit is contained in:
reidbhuntley 2021-05-28 23:27:44 -04:00
parent 0aaa09260b
commit 55abcde5d5

View file

@ -34,6 +34,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
protected Axis rotationAxis; protected Axis rotationAxis;
protected float prevAngle; protected float prevAngle;
protected float angle; protected float angle;
protected float angleDelta;
public ControlledContraptionEntity(EntityType<?> type, World world) { public ControlledContraptionEntity(EntityType<?> type, World world) {
super(type, world); super(type, world);
@ -130,6 +131,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
public void setPositionAndRotationDirect(double x, double y, double z, float yw, float pt, int inc, boolean t) {} public void setPositionAndRotationDirect(double x, double y, double z, float yw, float pt, int inc, boolean t) {}
protected void tickContraption() { protected void tickContraption() {
angleDelta = angle - prevAngle;
prevAngle = angle; prevAngle = angle;
tickActors(); tickActors();
@ -171,7 +173,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
return false; return false;
if (!VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) if (!VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis()))
return false; return false;
context.motion = Vector3d.of(facing.getDirectionVec()).scale(angle - prevAngle); context.motion = Vector3d.of(facing.getDirectionVec()).scale(angleDelta / 360.0);
context.relativeMotion = context.motion; context.relativeMotion = context.motion;
int timer = context.data.getInt("StationaryTimer"); int timer = context.data.getInt("StationaryTimer");
if (timer > 0) { if (timer > 0) {