mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Abort Mission
- Drills and other block breakers on contraptions now give up trying to destroy a block when their movement direction is reversed
This commit is contained in:
parent
d61e387916
commit
5b63f30df3
4 changed files with 16 additions and 4 deletions
|
@ -1,10 +1,11 @@
|
||||||
package com.simibubi.create.content.contraptions.components.actors;
|
package com.simibubi.create.content.contraptions.components.actors;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.RenderedContraption;
|
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
|
@ -17,8 +18,6 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
|
public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -101,6 +101,11 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
|
||||||
public void onSpeedChanged(float prevSpeed) {
|
public void onSpeedChanged(float prevSpeed) {
|
||||||
super.onSpeedChanged(prevSpeed);
|
super.onSpeedChanged(prevSpeed);
|
||||||
assembleNextTick = true;
|
assembleNextTick = true;
|
||||||
|
|
||||||
|
if (movedContraption != null && Math.signum(prevSpeed) != Math.signum(getSpeed()) && prevSpeed != 0) {
|
||||||
|
movedContraption.getContraption()
|
||||||
|
.stop(world);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getAngularSpeed() {
|
public float getAngularSpeed() {
|
||||||
|
|
|
@ -69,6 +69,8 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
|
||||||
if (!isStalled() && ticksExisted > 2)
|
if (!isStalled() && ticksExisted > 2)
|
||||||
move(movementVec.x, movementVec.y, movementVec.z);
|
move(movementVec.x, movementVec.y, movementVec.z);
|
||||||
|
|
||||||
|
if (Math.signum(prevAxisMotion) != Math.signum(axisMotion) && prevAxisMotion != 0)
|
||||||
|
contraption.stop(world);
|
||||||
if (!world.isRemote && (prevAxisMotion != axisMotion || ticksExisted % 3 == 0))
|
if (!world.isRemote && (prevAxisMotion != axisMotion || ticksExisted % 3 == 0))
|
||||||
sendPacket();
|
sendPacket();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public abstract class LinearActuatorTileEntity extends KineticTileEntity implements IControlContraption, IDisplayAssemblyExceptions {
|
public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
||||||
|
implements IControlContraption, IDisplayAssemblyExceptions {
|
||||||
|
|
||||||
public float offset;
|
public float offset;
|
||||||
public boolean running;
|
public boolean running;
|
||||||
|
@ -147,6 +148,11 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
|
||||||
super.onSpeedChanged(prevSpeed);
|
super.onSpeedChanged(prevSpeed);
|
||||||
assembleNextTick = true;
|
assembleNextTick = true;
|
||||||
waitingForSpeedChange = false;
|
waitingForSpeedChange = false;
|
||||||
|
|
||||||
|
if (movedContraption != null && Math.signum(prevSpeed) != Math.signum(getSpeed()) && prevSpeed != 0) {
|
||||||
|
movedContraption.getContraption()
|
||||||
|
.stop(world);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue