mining ghost block restrictions
This commit is contained in:
1 parent
6505afdfdb
commit
38459a8d11
3 files changed
+36
No files matched your search
@@ -0,0 +1,31 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.settings.CarpetSettings;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||||
|
import net.minecraft.server.network.packet.PlayerActionC2SPacket;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(ServerPlayerInteractionManager.class)
|
||||||
|
public class ServerPlayerInteractionManager_ghostBlocksMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "method_14263", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/block/BlockState;calcBlockBreakingDelta(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F")
|
||||||
|
|
||||||
|
)
|
||||||
|
private float noCheatBlockBreakSpeed(BlockState blockState, PlayerEntity playerEntity_1, BlockView blockView_1, BlockPos blockPos_1,
|
||||||
|
// main args
|
||||||
|
BlockPos blockPos_1a, PlayerActionC2SPacket.Action playerActionC2SPacket$Action_1, Direction direction_1, int int_1)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.miningGhostBlockFix && playerActionC2SPacket$Action_1 == PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK)
|
||||||
|
return 1.0f;
|
||||||
|
return blockState.calcBlockBreakingDelta(playerEntity_1, blockView_1, blockPos_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -229,6 +229,9 @@ public class CarpetSettings
|
|||||||
@Rule(desc = "smooth client animations with low tps settings", extra = "works only in SP, and will slow down players", category = CREATIVE)
|
@Rule(desc = "smooth client animations with low tps settings", extra = "works only in SP, and will slow down players", category = CREATIVE)
|
||||||
public static boolean smoothClientAnimations;
|
public static boolean smoothClientAnimations;
|
||||||
|
|
||||||
|
@Rule(desc="Fixes mining ghost blocks by allowing ANY mining speed from clients", category = SURVIVAL)
|
||||||
|
public static boolean miningGhostBlockFix;
|
||||||
|
|
||||||
private static class PushLimitLimits extends Validator<Integer> {
|
private static class PushLimitLimits extends Validator<Integer> {
|
||||||
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string) {
|
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string) {
|
||||||
return (newValue>0 && newValue <= 1024) ? newValue : null;
|
return (newValue>0 && newValue <= 1024) ? newValue : null;
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
"StructureBlockBlockEntity_fillUpdatesMixin",
|
"StructureBlockBlockEntity_fillUpdatesMixin",
|
||||||
"Structure_fillUpdatesMixin",
|
"Structure_fillUpdatesMixin",
|
||||||
|
|
||||||
|
"ServerPlayerInteractionManager_ghostBlocksMixin",
|
||||||
|
|
||||||
"ServerMetadata_motdMixin",
|
"ServerMetadata_motdMixin",
|
||||||
|
|
||||||
"MinecraftServer_coreMixin",
|
"MinecraftServer_coreMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user