mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
150 patches done
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Tue, 23 Mar 2021 19:38:53 -0500
|
||||
Subject: [PATCH] Break individual slabs when sneaking
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index adecb4915a0428b71e8c1e59b11f94dd1776697d..7315e604a2f9cb068eb5bbca744e44eeabac09c9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -403,6 +403,7 @@ public class ServerPlayerGameMode {
|
||||
} else {capturedBlockEntity = true;} // Paper - Send block entities after destroy prediction
|
||||
return false;
|
||||
}
|
||||
+ if (this.player.level().purpurConfig.slabHalfBreak && this.player.isShiftKeyDown() && iblockdata.getBlock() instanceof net.minecraft.world.level.block.SlabBlock && ((net.minecraft.world.level.block.SlabBlock) iblockdata.getBlock()).halfBreak(iblockdata, pos, this.player)) return true; // Purpur
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SlabBlock.java b/src/main/java/net/minecraft/world/level/block/SlabBlock.java
|
||||
index 9274fd639c22e305dda567b303f9b01068adb52c..4433e432ea0ee8d11045b87e68dac3ed43e8cf82 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SlabBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SlabBlock.java
|
||||
@@ -150,4 +150,25 @@ public class SlabBlock extends Block implements SimpleWaterloggedBlock {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public boolean halfBreak(BlockState state, BlockPos pos, net.minecraft.server.level.ServerPlayer player) {
|
||||
+ if (state.getValue(SlabBlock.TYPE) != SlabType.DOUBLE) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ net.minecraft.world.phys.HitResult result = player.getRayTrace(16, net.minecraft.world.level.ClipContext.Fluid.NONE);
|
||||
+ if (result.getType() != net.minecraft.world.phys.HitResult.Type.BLOCK) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ double hitY = result.getLocation().y();
|
||||
+ int blockY = org.bukkit.util.NumberConversions.floor(hitY);
|
||||
+ player.level().setBlock(pos, state.setValue(SlabBlock.TYPE, (hitY - blockY > 0.5 || blockY - pos.getY() == 1) ? SlabType.BOTTOM : SlabType.TOP), 3);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ net.minecraft.world.entity.item.ItemEntity item = new net.minecraft.world.entity.item.ItemEntity(player.level(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(asItem()));
|
||||
+ item.setDefaultPickUpDelay();
|
||||
+ player.level().addFreshEntity(item);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 0f8348bedaf101fa9b9d50c3288aec0953cb56f6..cbca90e2008e0ed3736a1ad1d645ca1ee532fbba 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -560,6 +560,11 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean slabHalfBreak = false;
|
||||
+ private void slabSettings() {
|
||||
+ slabHalfBreak = getBoolean("blocks.slab.break-individual-slabs-when-sneaking", slabHalfBreak);
|
||||
+ }
|
||||
+
|
||||
public boolean spawnerDeactivateByRedstone = false;
|
||||
private void spawnerSettings() {
|
||||
spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone);
|
||||
Reference in New Issue
Block a user