Commits

md_5 authored e65d67a7a97
SPIGOT-7934: Item entities start "bouncing" under certain conditions
No tags

CraftBukkit-Patches/0006-Async-Operation-Catching.patch

Modified
1 -From d7386ad104c37103e09df6ef685ba15803c57b54 Mon Sep 17 00:00:00 2001
1 +From 3a74f6c100d03a14c698ae26e71dff33327d70dd Mon Sep 17 00:00:00 2001
2 2 From: md_5 <git@md-5.net>
3 3 Date: Tue, 25 Mar 2014 16:10:01 +1100
4 4 Subject: [PATCH] Async Operation Catching
5 5
6 6 Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread.
7 7
8 8 diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
9 9 index 4d8aa931fb..5043631d14 100644
10 10 --- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
11 11 +++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
71 71 WorldServer.this.players.add(entityplayer);
72 72 @@ -2078,6 +2081,7 @@ public class WorldServer extends World implements ServerEntityGetter, GeneratorA
73 73 }
74 74
75 75 public void onTrackingEnd(Entity entity) {
76 76 + org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot
77 77 WorldServer.this.getChunkSource().removeEntity(entity);
78 78 if (entity instanceof EntityPlayer entityplayer) {
79 79 WorldServer.this.players.remove(entityplayer);
80 80 diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
81 -index 0ee571c05f..b17621a29f 100644
81 +index 02f729d695..7fe581b308 100644
82 82 --- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
83 83 +++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
84 84 @@ -1129,6 +1129,7 @@ public abstract class EntityLiving extends Entity implements Attackable {
85 85 }
86 86
87 87 public boolean addEffect(MobEffect mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
88 88 + org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot
89 89 if (isTickingEffects) {
90 90 effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
91 91 return true;
92 92 diff --git a/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java b/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java
93 -index a927c8756a..65a1fa3b61 100644
93 +index dd28f90d90..7f58791c8a 100644
94 94 --- a/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java
95 95 +++ b/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java
96 -@@ -115,6 +115,7 @@ public class CraftingManager extends ResourceDataAbstract<RecipeMap> implements
96 +@@ -116,6 +116,7 @@ public class CraftingManager extends ResourceDataAbstract<RecipeMap> implements
97 97
98 98 // CraftBukkit start
99 99 public void addRecipe(RecipeHolder<?> irecipe) {
100 100 + org.spigotmc.AsyncCatcher.catchOp("Recipe Add"); // Spigot
101 101 this.recipes.addRecipe(irecipe);
102 102 finalizeRecipeLoading();
103 103 }
104 104 diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
105 105 index 3a143fffa3..8d15390052 100644
106 106 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
118 118 protected void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, @Nullable ItemActionContext context) {
119 119 @@ -170,6 +172,7 @@ public abstract class BlockBase implements FeatureElement {
120 120 // CraftBukkit end
121 121
122 122 protected void onRemove(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
123 123 + org.spigotmc.AsyncCatcher.catchOp("block remove"); // Spigot
124 124 if (iblockdata.hasBlockEntity() && !iblockdata.is(iblockdata1.getBlock())) {
125 125 world.removeBlockEntity(blockposition);
126 126 }
127 127 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
128 -index 7b8e1bb014..9dcdbb1cba 100644
128 +index 7a5f99dc86..10c80d8563 100644
129 129 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
130 130 +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
131 131 @@ -900,6 +900,7 @@ public final class CraftServer implements Server {
132 132 public boolean dispatchCommand(CommandSender sender, String commandLine) {
133 133 Preconditions.checkArgument(sender != null, "sender cannot be null");
134 134 Preconditions.checkArgument(commandLine != null, "commandLine cannot be null");
135 135 + org.spigotmc.AsyncCatcher.catchOp("command dispatch"); // Spigot
136 136
137 137 if (commandMap.dispatch(sender, commandLine)) {
138 138 return true;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut