Fix bad block breaking that NCP doesn't agree with
This commit is contained in:
parent
c4eb6be0fe
commit
c324f11a96
@ -452,10 +452,6 @@ public class Settings {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code true}: can mine blocks when in inventory, chat, or tabbed away in ESC menu
|
* {@code true}: can mine blocks when in inventory, chat, or tabbed away in ESC menu
|
||||||
* <p>
|
|
||||||
* {@code false}: works on cosmic prisons
|
|
||||||
* <p>
|
|
||||||
* LOL
|
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> leftClickWorkaround = new Setting<>(true);
|
public Setting<Boolean> leftClickWorkaround = new Setting<>(true);
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@ import net.minecraft.world.GameType;
|
|||||||
*/
|
*/
|
||||||
public interface IPlayerController {
|
public interface IPlayerController {
|
||||||
|
|
||||||
boolean clickBlock(BlockPos pos, EnumFacing side);
|
|
||||||
|
|
||||||
boolean onPlayerDamageBlock(BlockPos pos, EnumFacing side);
|
boolean onPlayerDamageBlock(BlockPos pos, EnumFacing side);
|
||||||
|
|
||||||
void resetBlockRemoving();
|
void resetBlockRemoving();
|
||||||
|
@ -31,11 +31,6 @@ import net.minecraft.util.math.RayTraceResult;
|
|||||||
*/
|
*/
|
||||||
public final class BlockBreakHelper implements Helper {
|
public final class BlockBreakHelper implements Helper {
|
||||||
|
|
||||||
/**
|
|
||||||
* The last block that we tried to break, if this value changes
|
|
||||||
* between attempts, then we re-initialize the breaking process.
|
|
||||||
*/
|
|
||||||
private BlockPos lastBlock;
|
|
||||||
private boolean didBreakLastTick;
|
private boolean didBreakLastTick;
|
||||||
|
|
||||||
private IPlayerContext playerContext;
|
private IPlayerContext playerContext;
|
||||||
@ -45,13 +40,9 @@ public final class BlockBreakHelper implements Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void tryBreakBlock(BlockPos pos, EnumFacing side) {
|
public void tryBreakBlock(BlockPos pos, EnumFacing side) {
|
||||||
if (!pos.equals(lastBlock)) {
|
|
||||||
playerContext.playerController().clickBlock(pos, side);
|
|
||||||
}
|
|
||||||
if (playerContext.playerController().onPlayerDamageBlock(pos, side)) {
|
if (playerContext.playerController().onPlayerDamageBlock(pos, side)) {
|
||||||
playerContext.player().swingArm(EnumHand.MAIN_HAND);
|
playerContext.player().swingArm(EnumHand.MAIN_HAND);
|
||||||
}
|
}
|
||||||
lastBlock = pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopBreakingBlock() {
|
public void stopBreakingBlock() {
|
||||||
@ -59,7 +50,6 @@ public final class BlockBreakHelper implements Helper {
|
|||||||
if (playerContext.player() != null) {
|
if (playerContext.player() != null) {
|
||||||
playerContext.playerController().resetBlockRemoving();
|
playerContext.playerController().resetBlockRemoving();
|
||||||
}
|
}
|
||||||
lastBlock = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean fakeBreak() {
|
private boolean fakeBreak() {
|
||||||
|
@ -34,11 +34,6 @@ public enum PrimaryPlayerController implements IPlayerController, Helper {
|
|||||||
|
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean clickBlock(BlockPos pos, EnumFacing side) {
|
|
||||||
return mc.playerController.clickBlock(pos, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPlayerDamageBlock(BlockPos pos, EnumFacing side) {
|
public boolean onPlayerDamageBlock(BlockPos pos, EnumFacing side) {
|
||||||
return mc.playerController.onPlayerDamageBlock(pos, side);
|
return mc.playerController.onPlayerDamageBlock(pos, side);
|
||||||
|
Loading…
Reference in New Issue
Block a user