9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-04 15:41:31 +00:00

No TNT place update (#114)

This commit is contained in:
violetc
2024-01-18 12:33:44 +08:00
parent a8acd62001
commit 25f3bfe8c6
2 changed files with 24 additions and 2 deletions

View File

@@ -78,10 +78,10 @@ index 01d907e3266095bb33d3a73dc56004fd79043943..06c00aa070334deeae96524b35ff1295
.withRequiredArg()
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..837ab6d67fc563042364985ecd5c44cf231e5804
index 0000000000000000000000000000000000000000..863396656580481e8ed3dfaa0f5b7044e652ea96
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,867 @@
@@ -0,0 +1,870 @@
+package top.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
@@ -495,6 +495,9 @@ index 0000000000000000000000000000000000000000..837ab6d67fc563042364985ecd5c44cf
+ @GlobalConfig(name = "no-block-update-command", category = "modify", verify = NoBlockUpdateVerify.class)
+ public static boolean noBlockUpdateCommand = false;
+
+ @GlobalConfig(name = "no-tnt-place-update", category = "modify")
+ public static boolean noTNTPlaceUpdate = false;
+
+ private static class NoBlockUpdateVerify extends ConfigVerify.BooleanConfigVerify {
+ @Override
+ public String check(Boolean old, Boolean value) {

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Thu, 18 Jan 2024 12:31:31 +0800
Subject: [PATCH] No TNT place update
diff --git a/src/main/java/net/minecraft/world/level/block/TntBlock.java b/src/main/java/net/minecraft/world/level/block/TntBlock.java
index 8eaf1eaf0f739a12baf6e3e9fe32c007eaba20ae..b12bb23089f66bc12a64d50a10377254c9be39c6 100644
--- a/src/main/java/net/minecraft/world/level/block/TntBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TntBlock.java
@@ -48,7 +48,7 @@ public class TntBlock extends Block {
@Override
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (!oldState.is(state.getBlock())) {
- if (world.hasNeighborSignal(pos) && CraftEventFactory.callTNTPrimeEvent(world, pos, PrimeCause.REDSTONE, null, null)) { // CraftBukkit - TNTPrimeEvent
+ if (!top.leavesmc.leaves.LeavesConfig.noTNTPlaceUpdate && world.hasNeighborSignal(pos) && CraftEventFactory.callTNTPrimeEvent(world, pos, PrimeCause.REDSTONE, null, null)) { // CraftBukkit - TNTPrimeEvent // Leaves - No tnt place update
// Paper start - TNTPrimeEvent
org.bukkit.block.Block tntBlock = io.papermc.paper.util.MCUtil.toBukkitBlock(world, pos);
if (!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) {