Paper/Spigot-Server-Patches/0083-Option-to-disable-BlockPhysicsEvent-for-Redstone.patch
Aikar 835bc39b03
Paper 1.13.1 Update
Updated Upstream (Bukkit/CraftBukkit/Spigot)

Bukkit Changes:
2dcc44dc SPIGOT-4307: Fix hacky API for banners on shields
e0fc6572 SPIGOT-4309: Add "forced" display of particles
efeeab2f Add index to README.md for easier navigation
f502bc6f Update to Minecraft 1.13.1

CraftBukkit Changes:
d0bb0a1d Fix some tests randomly failing
997d378d Fix client stall in specific teleportation scenarios
b3dc2366 SPIGOT-4307: Fix hacky API for banners on shields
2a271162 SPIGOT-4301: Fix more invalid enchants
5d0d83bb SPIGOT-4309: Add "forced" display of particles
a6772578 Add additional tests for CraftBlockData
ce1af0c3 Update to Minecraft 1.13.1

Spigot Changes:
2440e189 Rebuild patches
4ecffced Update to Minecraft 1.13.1
2018-08-26 20:51:39 -04:00

63 lines
3.1 KiB
Diff

From ad72279171cbc841b7cc23ea948ff03cb2963b80 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 b05277067a..5f3156af60 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -220,4 +220,9 @@ public class PaperWorldConfig {
skeleHorseSpawnChance = 0.01D; // Vanilla value
}
}
+
+ 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 45b0880607..8f3b1d529a 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -614,7 +614,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
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()), CraftBlockData.fromData(iblockdata));
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 253019d89b..8f704a0e0b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -37,6 +37,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;
@@ -676,6 +677,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
IBlockData iblockdata = this.getType(nextticklistentry.a);
if (iblockdata.getBlock() == nextticklistentry.a()) {
+ stopPhysicsEvent = !paperConfig.firePhysicsEventForRedstone && (iblockdata.getBlock() instanceof BlockDiodeAbstract || iblockdata.getBlock() instanceof BlockRedstoneTorch); // Paper
iblockdata.a((World) this, nextticklistentry.a, this.random);
}
--
2.18.0