mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-08 11:50:32 +01:00
c02c01b2c5
Also removes our toggle for Spigot's option, I doubt anyone uses it.
72 lines
3.8 KiB
Diff
72 lines
3.8 KiB
Diff
From a665617ef7bb355cd7ca3ab6d21f0b136dbaa9ce Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 28 Mar 2016 19:55:45 -0400
|
|
Subject: [PATCH] Option to disable BlockPhysicsEvent for Redstone
|
|
|
|
Not sure of any reason a plugin would need to act on a Physics event
|
|
for redstone. There is a BlockRedstoneEvent that plugins can also use
|
|
for accessing redstone activity.
|
|
|
|
Defaulting this to false will provide substantial performance improvement
|
|
by saving millions of event calls on redstone heavy servers.
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index d29f2a4..9628c06 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -286,4 +286,9 @@ public class PaperWorldConfig {
|
|
skeleHorseSpawnChance = 0.05D; // Vanilla
|
|
}
|
|
}
|
|
+
|
|
+ public boolean firePhysicsEventForRedstone = false;
|
|
+ private void firePhysicsEventForRedstone() {
|
|
+ firePhysicsEventForRedstone = getBoolean("fire-physics-event-for-redstone", firePhysicsEventForRedstone);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index b683c3e..0c7558f 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -558,7 +558,7 @@ public abstract class World implements IBlockAccess {
|
|
try {
|
|
// CraftBukkit start
|
|
CraftWorld world = ((WorldServer) this).getWorld();
|
|
- if (world != null) {
|
|
+ if (world != null && !((WorldServer)this).stopPhysicsEvent) { // Paper
|
|
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftMagicNumbers.getId(block));
|
|
this.getServer().getPluginManager().callEvent(event);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index db71eef..87abf7f 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -33,6 +33,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
|
|
public class WorldServer extends World implements IAsyncTaskHandler {
|
|
|
|
private static final Logger a = LogManager.getLogger();
|
|
+ boolean stopPhysicsEvent = false; // Paper
|
|
private final MinecraftServer server;
|
|
public EntityTracker tracker;
|
|
private final PlayerChunkMap manager;
|
|
@@ -741,6 +742,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
|
|
|
if (iblockdata.getMaterial() != Material.AIR && Block.a(iblockdata.getBlock(), nextticklistentry.a())) {
|
|
try {
|
|
+ stopPhysicsEvent = !paperConfig.firePhysicsEventForRedstone && (iblockdata.getBlock() instanceof BlockDiodeAbstract || iblockdata.getBlock() instanceof BlockRedstoneTorch); // Paper
|
|
iblockdata.getBlock().b((World) this, nextticklistentry.a, iblockdata, this.random);
|
|
} catch (Throwable throwable) {
|
|
CrashReport crashreport = CrashReport.a(throwable, "Exception while ticking a block");
|
|
@@ -748,7 +750,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
|
|
|
CrashReportSystemDetails.a(crashreportsystemdetails, nextticklistentry.a, iblockdata);
|
|
throw new ReportedException(crashreport);
|
|
- }
|
|
+ } finally { stopPhysicsEvent = false; } // Paper
|
|
}
|
|
timing.stopTiming(); // Paper
|
|
} else {
|
|
--
|
|
2.10.0.windows.1
|
|
|