3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

more patches & fixes to existing patches

Dieser Commit ist enthalten in:
Jake Potrebic 2021-06-14 12:17:47 -07:00 committet von MiniDigger | Martin
Ursprung 5dce4d9178
Commit f777faa8c1
44 geänderte Dateien mit 244 neuen und 365 gelöschten Zeilen

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Better AnnotationTest printout
diff --git a/pom.xml b/pom.xml
index 6b71d9a397dd5b72320402a47b8e7197d24e061c..73fbd5d5a591871a3a386fb5c455cd96a3992e7a 100644
index aefaeec678b2f6b5ba1c15e43c4886eb9af6b143..33771618d2fd7591db020af57df358c891b11d6d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -257,6 +257,19 @@
@@ -250,6 +250,19 @@
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</plugin>

Datei anzeigen

@ -3,6 +3,7 @@ From: Kyle Wood <demonwav@gmail.com>
Date: Wed, 2 Dec 2020 21:58:45 -0800
Subject: [PATCH] Add warning for servers not running on Java 16
1.17: game requires java 16
diff --git a/src/main/java/io/papermc/paper/util/PaperJvmChecker.java b/src/main/java/io/papermc/paper/util/PaperJvmChecker.java
new file mode 100644

Datei anzeigen

@ -1,90 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 2 Dec 2020 20:04:01 -0800
Subject: [PATCH] Added ServerResourcesReloadedEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c83f2636ae93d92381e019d5b13ac82c5a1d30bf..892ca65d258b0745be95d7ef4886c49899b24d92 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2,9 +2,6 @@ package net.minecraft.server;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
-import co.aikar.timings.Timings;
-import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
-import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -181,6 +178,7 @@ import org.bukkit.event.server.ServerLoadEvent;
import co.aikar.timings.MinecraftTimings; // Paper
import org.spigotmc.SlackActivityAccountant; // Spigot
import io.papermc.paper.util.PaperJvmChecker; // Paper
+import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements SnooperPopulator, CommandSource, AutoCloseable {
@@ -1934,9 +1932,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.functionManager;
}
+ // Paper start - add cause
+ @Deprecated
public CompletableFuture<Void> reloadResources(Collection<String> datapacks) {
+ return this.reloadServerResources(datapacks, ServerResourcesReloadedEvent.Cause.PLUGIN);
+ }
+ public CompletableFuture<Void> reloadServerResources(Collection<String> collection, ServerResourcesReloadedEvent.Cause cause) {
+ // Paper end
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
- Stream<String> stream = datapacks.stream(); // CraftBukkit - decompile error
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
PackRepository resourcepackrepository = this.packRepository;
this.packRepository.getClass();
@@ -1947,9 +1951,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.resources.close();
this.resources = datapackresources;
this.server.syncCommands(); // SPIGOT-5884: Lost on reload
- this.packRepository.setSelected(datapacks);
+ this.packRepository.setSelected(collection);
this.worldData.setDataPackConfig(getSelectedPacks(this.packRepository));
datapackresources.updateGlobals();
+ new ServerResourcesReloadedEvent(cause).callEvent(); // Paper
if (Thread.currentThread() != this.serverThread) return; // Paper
//this.getPlayerList().savePlayers(); // Paper - we don't need to do this
this.getPlayerList().reloadResources();
diff --git a/src/main/java/net/minecraft/server/commands/ReloadCommand.java b/src/main/java/net/minecraft/server/commands/ReloadCommand.java
index 38642911113baf253560960af992e942a3dc87e1..33e34f302b046f819bf9a4c14459bfbbff18b786 100644
--- a/src/main/java/net/minecraft/server/commands/ReloadCommand.java
+++ b/src/main/java/net/minecraft/server/commands/ReloadCommand.java
@@ -12,15 +12,16 @@ import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.world.level.storage.WorldData;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper
public class ReloadCommand {
private static final Logger LOGGER = LogManager.getLogger();
public static void reloadPacks(Collection<String> collection, CommandSourceStack commandlistenerwrapper) {
- commandlistenerwrapper.getServer().reloadResources(collection).exceptionally((throwable) -> {
- ReloadCommand.LOGGER.warn("Failed to execute reload", throwable);
- commandlistenerwrapper.sendFailure(new TranslatableComponent("commands.reload.failure"));
+ commandlistenerwrapper.getServer().reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper
+ CommandReload.LOGGER.warn("Failed to execute reload", throwable);
+ commandlistenerwrapper.sendFailureMessage(new ChatMessage("commands.reload.failure"));
return null;
});
}
@@ -48,7 +49,7 @@ public class ReloadCommand {
WorldData savedata = minecraftserver.getWorldData();
Collection<String> collection = resourcepackrepository.getSelectedIds();
Collection<String> collection1 = discoverNewPacks(resourcepackrepository, savedata, collection);
- minecraftserver.reloadResources(collection1);
+ minecraftserver.reloadServerResources(collection1, ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper
}
// CraftBukkit end

Datei anzeigen

@ -1,66 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 23 Nov 2020 12:58:51 -0800
Subject: [PATCH] Added PlayerLecternPageChangeEvent
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index bc39e7464646d712b085251dc0277a5b1ec0a393..b5d79635cd8b0eb6b17962450b347010aeb52654 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -561,6 +561,7 @@ public abstract class AbstractContainerMenu {
this.getSlot(slot).set(stack);
}
+ public void setData(int index, int value) { this.setData(index, value); } // Paper - OBFHELPER
public void setData(int id, int value) {
((DataSlot) this.dataSlots.get(id)).set(value);
}
diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
index 29e8dbc6be57faf50a8ca68eed6bf2e203b7e87a..a7be91a9336065899c409526a890e55f37b98751 100644
--- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
@@ -11,6 +11,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTakeLecternBookEvent;
// CraftBukkit end
+import io.papermc.paper.event.player.PlayerLecternPageChangeEvent; // Paper
public class LecternMenu extends AbstractContainerMenu {
@@ -58,6 +59,7 @@ public class LecternMenu extends AbstractContainerMenu {
@Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
int j;
+ PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper
if (id >= 100) {
j = id - 100;
@@ -67,11 +69,25 @@ public class LecternMenu extends AbstractContainerMenu {
switch (id) {
case 1:
j = this.lecternData.get(0);
- this.setData(0, j - 1);
+ // Paper start
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
+ playerLecternPageChangeEvent = new PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1);
+ if (!playerLecternPageChangeEvent.callEvent()) {
+ return false;
+ }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end
return true;
case 2:
j = this.lecternData.get(0);
- this.setData(0, j + 1);
+ // Paper start
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
+ playerLecternPageChangeEvent = new PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1);
+ if (!playerLecternPageChangeEvent.callEvent()) {
+ return false;
+ }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end
return true;
case 3:
if (!player.mayBuild()) {

Datei anzeigen

@ -1,63 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 25 Nov 2020 16:33:27 -0800
Subject: [PATCH] Added PlayerLoomPatternSelectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index 3460fb2bb1451b8456a7fe42449ec4dbce641f40..0dc1b0b7181c0f93dcf6213c63baffcd4694d70c 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -20,6 +20,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryLoom;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
import org.bukkit.entity.Player;
// CraftBukkit end
+import io.papermc.paper.event.player.PlayerLoomPatternSelectEvent; // Paper
public class LoomMenu extends AbstractContainerMenu {
@@ -39,7 +40,7 @@ public class LoomMenu extends AbstractContainerMenu {
}
// CraftBukkit end
private final ContainerLevelAccess access;
- private final DataSlot selectedBannerPatternIndex;
+ private final DataSlot selectedBannerPatternIndex; public final DataSlot getSelectedBannerPattern() { return this.selectedBannerPatternIndex; }; // Paper - OBFHELPER
private Runnable slotUpdateListener;
private final Slot bannerSlot;
private final Slot dyeSlot;
@@ -158,7 +159,22 @@ public class LoomMenu extends AbstractContainerMenu {
@Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
if (id > 0 && id <= BannerPattern.AVAILABLE_PATTERNS) {
- this.selectedBannerPatternIndex.set(id);
+ // Paper start
+ int enumBannerPatternTypeOrdinal = id;
+ PlayerLoomPatternSelectEvent event = new PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(BannerPattern.values()[id].getIdentifier()));
+ if (!event.callEvent()) {
+ ((Player) player.getBukkitEntity()).updateInventory();
+ return false;
+ }
+ for (BannerPattern nms : BannerPattern.values()) {
+ if (event.getPatternType().getIdentifier().equals(nms.getIdentifier())) {
+ enumBannerPatternTypeOrdinal = nms.ordinal();
+ break;
+ }
+ }
+ ((Player) player.getBukkitEntity()).updateInventory();
+ this.getSelectedBannerPattern().set(enumBannerPatternTypeOrdinal);
+ // Paper end
this.setupResultSlot();
return true;
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java b/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java
index 9ea01d5888a21b0dedb555d118a4dc07af2b50fd..9ee3f8bb2294fc552735a64efbddf661d39602c7 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java
@@ -33,6 +33,7 @@ public enum BannerPattern {
this.hasPatternItem = flag;
}
+ public String getIdentifier() { return this.getHashname(); } // Paper - OBFHELPER
public String getHashname() {
return this.hashname;
}

Datei anzeigen

@ -1,50 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 9 Jan 2021 14:17:07 +0100
Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index fe7b71fbb3963beafe93a5d86bebdd629c7ec8f2..9f1838d12b13d64f10871eb672ed2aec78d9936e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2071,6 +2071,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
});
optional1.ifPresent((villageplacetype) -> {
this.getServer().execute(() -> {
+ // Paper start
+ if (!optional.isPresent() && this.getPoiStorage().test(blockposition1, com.google.common.base.Predicates.alwaysTrue())) {
+ this.getPoiStorage().remove(blockposition1);
+ }
+ // Paper end
this.getPoiManager().add(blockposition1, villageplacetype);
DebugPackets.sendPoiAddedPacket(this, blockposition1);
});
@@ -2078,6 +2083,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
}
}
+ public final PoiManager getPoiStorage() { return this.getPoiManager(); } // Paper - OBFHELPER
public PoiManager getPoiManager() {
return this.getChunkSource().getPoiManager();
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index b9d32e3322c2cce1aca2a90df71b6175a6f8c548..25b26a78a55f98687ed22e986b54d5e9d47a16ea 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -54,6 +54,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).add(pos, type);
}
+ public void remove(BlockPos blockposition) { this.remove(blockposition); } // Paper - OBFHELPER
public void remove(BlockPos pos) {
((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).remove(pos);
}
@@ -138,6 +139,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
return ((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).release(pos);
}
+ public final boolean test(BlockPos blockposition, Predicate<PoiType> predicate) { return this.exists(blockposition, predicate); } // Paper - OBFHELPER
public boolean exists(BlockPos pos, Predicate<PoiType> predicate) {
return (Boolean) this.getOrLoad(SectionPos.of(pos).asLong()).map((villageplacesection) -> {
return villageplacesection.exists(pos, predicate);

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Guardian beam workaround
This patch is a workaround for MC-165595
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..c96b63355b38053b0f7ede313fb4bdf0e1089796 100644
index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..689ad22925b2561f7c8db961743eb1f821dbb25f 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
@@ -8,7 +8,7 @@ public class ClientboundSetTimePacket implements Packet<ClientGamePacketListener
@ -14,7 +14,7 @@ index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..c96b63355b38053b0f7ede313fb4bdf0
public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) {
- this.gameTime = time;
+ this.gameTime = time % 192000; // Paper - fix guardian bean
+ this.gameTime = time % 192000; // Paper - fix guardian beam
long l = timeOfDay;
if (!doDaylightCycle) {
l = -timeOfDay;

Datei anzeigen

@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 2 Dec 2020 20:04:01 -0800
Subject: [PATCH] Added ServerResourcesReloadedEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9bd2255d31bcfd4574f8d1caf598f9141aa9e3c1..51bbb11ff8d3da95fa6d9890be3135a34b3eafac 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2017,7 +2017,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.functionManager;
}
+ // Paper start - add cause
+ @Deprecated
public CompletableFuture<Void> reloadResources(Collection<String> datapacks) {
+ return this.reloadResources(datapacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN);
+ }
+ public CompletableFuture<Void> reloadResources(Collection<String> datapacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) {
+ // Paper end
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
Stream<String> stream = datapacks.stream(); // CraftBukkit - decompile error
PackRepository resourcepackrepository = this.packRepository;
@@ -2033,6 +2039,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.packRepository.setSelected(datapacks);
this.worldData.setDataPackConfig(MinecraftServer.getSelectedPacks(this.packRepository));
datapackresources.updateGlobals();
+ new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper
if (Thread.currentThread() != this.serverThread) return; // Paper
//this.getPlayerList().savePlayers(); // Paper - we don't need to do this
this.getPlayerList().reloadResources();
diff --git a/src/main/java/net/minecraft/server/commands/ReloadCommand.java b/src/main/java/net/minecraft/server/commands/ReloadCommand.java
index 3b46b4bf2597354a2c39e8fac2a250ef71034197..23f79f0bef308e6e7dee0bdc0e8b09aa3655cbc7 100644
--- a/src/main/java/net/minecraft/server/commands/ReloadCommand.java
+++ b/src/main/java/net/minecraft/server/commands/ReloadCommand.java
@@ -20,7 +20,7 @@ public class ReloadCommand {
public ReloadCommand() {}
public static void reloadPacks(Collection<String> dataPacks, CommandSourceStack source) {
- source.getServer().reloadResources(dataPacks).exceptionally((throwable) -> {
+ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> {
ReloadCommand.LOGGER.warn("Failed to execute reload", throwable);
source.sendFailure(new TranslatableComponent("commands.reload.failure"));
return null;
@@ -50,7 +50,7 @@ public class ReloadCommand {
WorldData savedata = minecraftserver.getWorldData();
Collection<String> collection = resourcepackrepository.getSelectedIds();
Collection<String> collection1 = ReloadCommand.discoverNewPacks(resourcepackrepository, savedata, collection);
- minecraftserver.reloadResources(collection1);
+ minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper
}
// CraftBukkit end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Added world settings for mobs picking up loot
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b48067c71f9de18ba40e970e2832f6245984a218..23a23e2ea133ce81d3dedc4ffd17435a995497ef 100644
index bedadfc8835fa0c834494eb10cef13fa1cdc5cf5..b0b414a31192a2b0e5c69d00b982f883b66e77fd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -363,6 +363,14 @@ public class PaperWorldConfig {
@@ -433,6 +433,14 @@ public class PaperWorldConfig {
log("Creeper lingering effect: " + disableCreeperLingeringEffect);
}
@ -24,10 +24,10 @@ index b48067c71f9de18ba40e970e2832f6245984a218..23a23e2ea133ce81d3dedc4ffd17435a
private void expMergeMaxValue() {
expMergeMaxValue = getInt("experience-merge-max-value", -1);
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 76027a7c9615495af64102744e264d7ba7c9b87e..68e52e3a31e70569d1a92602aff4b7b81c594757 100644
index 3d8f3e22223e4effeaf52cb18c14c60276d4689c..6b4163f5601a0961055c8451ec7ef2204938cf69 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -149,7 +149,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@@ -148,7 +148,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
this.populateDefaultEquipmentSlots(difficulty);
this.populateDefaultEquipmentEnchantments(difficulty);
this.reassessWeaponGoal();
@ -37,15 +37,15 @@ index 76027a7c9615495af64102744e264d7ba7c9b87e..68e52e3a31e70569d1a92602aff4b7b8
LocalDate localdate = LocalDate.now();
int i = localdate.get(ChronoField.DAY_OF_MONTH);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 77634a1e8e7539000f7db0b96f4548137af1a819..74fd175c4dc2d0d9832ee41efaf065b75a43f4b8 100644
index 3125aad3b14a185bbd563827f07c15bbb1ef0895..03acacd30b84452733aa2bdeed515455a1f271f8 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -494,7 +494,7 @@ public class Zombie extends Monster {
Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
@@ -497,7 +497,7 @@ public class Zombie extends Monster {
Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
float f = difficulty.getSpecialMultiplier();
- this.setCanPickUpLoot(this.random.nextFloat() < 0.55F * f);
+ this.setCanPickUpLoot(this.level.paperConfig.zombiesAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * f); // Paper
if (object == null) {
object = new Zombie.ZombieGroupData(getSpawnAsBabyOdds(world.getRandom()), true);
object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(world.getRandom()), true);
}

Datei anzeigen

@ -5,58 +5,45 @@ Subject: [PATCH] Implemented BlockFailedDispenseEvent
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
index bfb2e21ccbcc67d6c9b4b329db1949d7d938bd2e..2a4cb76bdfcf55ba222b4976359c1b8efb165009 100644
index 5812a6d601ab3552bd42dbf6e1071eff29dacc75..501a5483160dba050261bb3448317a097cdb7ef2 100644
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@@ -81,6 +81,7 @@ public class DispenserBlock extends BaseEntityBlock {
@@ -82,8 +82,10 @@ public class DispenserBlock extends BaseEntityBlock {
int i = tileentitydispenser.getRandomSlot();
if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(worldserver, pos)) // Paper - BlockFailedDispenseEvent is called here
worldserver.levelEvent(1001, pos, 0);
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here
world.levelEvent(1001, pos, 0);
world.gameEvent(GameEvent.DISPENSE_FAIL, pos);
+ } // Paper
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
index 154ec671e9d741e536464b794783da859e8447c1..492b19b94e2e2439f72ed9478d75641b0f50451a 100644
index 51723c8f740c7b0bbd15acc0f1c848790c2ff299..5a95b550c767284563c124df1ff45322b37d4b4c 100644
--- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
@@ -45,6 +45,7 @@ public class DropperBlock extends DispenserBlock {
int i = tileentitydispenser.getRandomSlot();
if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(worldserver, pos)) // Paper - BlockFailedDispenseEvent is called here
worldserver.levelEvent(1001, pos, 0);
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here
world.levelEvent(1001, pos, 0);
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 34c7b1213b3f83ff1a1f2d606a9c25e57fea8ef3..8829ef03d0be16d8317aaf05bcd286b74f20656a 100644
index 0f120d72816667ef8d50502b1e7e7dc3848f0ab4..263aaf312efcc8c8bda57448710ef6eb36a3a5bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -4,6 +4,7 @@ import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.collect.Lists;
import com.mojang.datafixers.util.Either;
+import io.papermc.paper.event.block.BlockFailedDispenseEvent;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collections;
@@ -111,7 +112,6 @@ import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Vehicle;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Villager.Profession;
-import org.bukkit.entity.ExperienceOrb; // Paper
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Result;
@@ -1784,4 +1784,12 @@ public class CraftEventFactory {
@@ -1791,4 +1791,12 @@ public class CraftEventFactory {
Bukkit.getPluginManager().callEvent(event);
return event;
}
+
+ // Paper start
+ public static boolean handleBlockFailedDispenseEvent(ServerLevel worldserver, BlockPos blockposition) {
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ BlockFailedDispenseEvent event = new BlockFailedDispenseEvent(block);
+ public static boolean handleBlockFailedDispenseEvent(ServerLevel serverLevel, BlockPos blockposition) {
+ org.bukkit.block.Block block = serverLevel.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block);
+ return event.callEvent();
+ }
+ // Paper end

Datei anzeigen

@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 23 Nov 2020 12:58:51 -0800
Subject: [PATCH] Added PlayerLecternPageChangeEvent
diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
index 0149b958a3bdeb529a8b7e64f4ca458d0be88998..ff79925bc6437222f9ceb133e21bbc0600cc74ed 100644
--- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
@@ -64,6 +64,7 @@ public class LecternMenu extends AbstractContainerMenu {
@Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
int j;
+ io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper
if (id >= 100) {
j = id - 100;
@@ -73,11 +74,25 @@ public class LecternMenu extends AbstractContainerMenu {
switch (id) {
case 1:
j = this.lecternData.get(0);
- this.setData(0, j - 1);
+ // Paper start
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
+ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1);
+ if (!playerLecternPageChangeEvent.callEvent()) {
+ return false;
+ }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end
return true;
case 2:
j = this.lecternData.get(0);
- this.setData(0, j + 1);
+ // Paper start
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
+ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1);
+ if (!playerLecternPageChangeEvent.callEvent()) {
+ return false;
+ }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end
return true;
case 3:
if (!player.mayBuild()) {

Datei anzeigen

@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 25 Nov 2020 16:33:27 -0800
Subject: [PATCH] Added PlayerLoomPatternSelectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index 7e8b6e0e69876cb7bfd444a8dd72edf8289e6dd1..51579f642859fc99c715dfcd286482995012d84a 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -166,7 +166,22 @@ public class LoomMenu extends AbstractContainerMenu {
@Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
if (id > 0 && id <= BannerPattern.AVAILABLE_PATTERNS) {
- this.selectedBannerPatternIndex.set(id);
+ // Paper start
+ int enumBannerPatternTypeOrdinal = id;
+ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(BannerPattern.values()[id].getHashname()));
+ if (!event.callEvent()) {
+ ((Player) player.getBukkitEntity()).updateInventory();
+ return false;
+ }
+ for (BannerPattern nms : BannerPattern.values()) {
+ if (event.getPatternType().getIdentifier().equals(nms.getHashname())) {
+ enumBannerPatternTypeOrdinal = nms.ordinal();
+ break;
+ }
+ }
+ ((Player) player.getBukkitEntity()).updateInventory();
+ this.selectedBannerPatternIndex.set(enumBannerPatternTypeOrdinal);
+ // Paper end
this.setupResultSlot();
return true;
} else {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable door breaking difficulty
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 23a23e2ea133ce81d3dedc4ffd17435a995497ef..7ebc85264a2cbfb601dfe5472b561cac1a7cf8bf 100644
index b0b414a31192a2b0e5c69d00b982f883b66e77fd..dd5c092a035a30c477fe828b58bc918fc48daa03 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -5,7 +5,10 @@ import java.util.EnumMap;
@@ -4,7 +4,10 @@ import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -17,10 +17,36 @@ index 23a23e2ea133ce81d3dedc4ffd17435a995497ef..7ebc85264a2cbfb601dfe5472b561cac
+import net.minecraft.world.Difficulty;
+import net.minecraft.world.entity.monster.Vindicator;
+import net.minecraft.world.entity.monster.Zombie;
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -73,6 +76,11 @@ public class PaperWorldConfig {
import org.bukkit.configuration.ConfigurationSection;
@@ -92,6 +95,25 @@ public class PaperWorldConfig {
disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation);
}
+ public List<Difficulty> zombieBreakDoors;
+ public List<Difficulty> vindicatorBreakDoors;
+ private void setupEntityBreakingDoors() {
+ zombieBreakDoors = getEnumList(
+ "door-breaking-difficulty.zombie",
+ java.util.Arrays.stream(Difficulty.values())
+ .filter(Zombie.DOOR_BREAKING_PREDICATE)
+ .collect(Collectors.toList()),
+ Difficulty.class
+ );
+ vindicatorBreakDoors = getEnumList(
+ "door-breaking-difficulty.vindicator",
+ java.util.Arrays.stream(Difficulty.values())
+ .filter(Vindicator.DOOR_BREAKING_PREDICATE)
+ .collect(Collectors.toList()),
+ Difficulty.class
+ );
+ }
+
public short keepLoadedRange;
private void keepLoadedRange() {
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
@@ -143,6 +165,11 @@ public class PaperWorldConfig {
return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
}
@ -32,45 +58,22 @@ index 23a23e2ea133ce81d3dedc4ffd17435a995497ef..7ebc85264a2cbfb601dfe5472b561cac
public int cactusMaxHeight;
public int reedMaxHeight;
public int bambooMaxHeight;
@@ -735,4 +743,23 @@ public class PaperWorldConfig {
private void disableMobSpawnerSpawnEggTransformation() {
disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation);
}
+
+ public List<Difficulty> zombieBreakDoors;
+ public List<Difficulty> vindicatorBreakDoors;
+ private void setupEntityBreakingDoors() {
+ zombieBreakDoors = getEnumList(
+ "door-breaking-difficulty.zombie",
+ Arrays.stream(Difficulty.values())
+ .filter(Zombie.getDoorBreakingPredicate())
+ .collect(Collectors.toList()),
+ Difficulty.class
+ );
+ vindicatorBreakDoors = getEnumList(
+ "door-breaking-difficulty.vindicator",
+ Arrays.stream(Difficulty.values())
+ .filter(Vindicator.getDoorBreakingPredicate())
+ .collect(Collectors.toList()),
+ Difficulty.class
+ );
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
index 623de661f3b56062792e3a7dbc508637aa58aca5..48700094da6e97610ccc652593a9e229ba7b1003 100644
index dcaec42b0756cf36da813815b4a54e4d6c4e293a..53a9e4b0fda9f5a3b23a874c53d93fbe931b0cfb 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -48,6 +48,7 @@ import net.minecraft.world.level.ServerLevelAccessor;
@@ -48,7 +48,7 @@ import net.minecraft.world.level.ServerLevelAccessor;
public class Vindicator extends AbstractIllager {
+ public static final Predicate<Difficulty> getDoorBreakingPredicate() { return DOOR_BREAKING_PREDICATE; } // Paper - OBFHELPER
private static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> {
return enumdifficulty == Difficulty.NORMAL || enumdifficulty == Difficulty.HARD;
private static final String TAG_JOHNNY = "Johnny";
- static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (difficulty) -> {
+ public static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (difficulty) -> { // Paper - package private -> public
return difficulty == Difficulty.NORMAL || difficulty == Difficulty.HARD;
};
@@ -204,7 +205,7 @@ public class Vindicator extends AbstractIllager {
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
private boolean isJohnny; public boolean isJohnny() { return this.isJohnny; } public void setJohnny(boolean johnny) { this.isJohnny = johnny; } // Paper - OBFHELPER
@@ -195,7 +195,7 @@ public class Vindicator extends AbstractIllager {
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
public VindicatorBreakDoorGoal(Mob mob) {
- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE);
+ super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig.vindicatorBreakDoors)); // Paper
@ -78,18 +81,19 @@ index 623de661f3b56062792e3a7dbc508637aa58aca5..48700094da6e97610ccc652593a9e229
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 74fd175c4dc2d0d9832ee41efaf065b75a43f4b8..caa99a2737598bd74ede54f1c35ce4b99ce1e6d3 100644
index 03acacd30b84452733aa2bdeed515455a1f271f8..9e535cf3293cf624b1e2e1b7fb40a446b888b099 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -83,6 +83,7 @@ public class Zombie extends Monster {
private static final EntityDataAccessor<Boolean> DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
private static final EntityDataAccessor<Integer> DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Boolean> DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
+ public static final Predicate<Difficulty> getDoorBreakingPredicate() { return DOOR_BREAKING_PREDICATE; } // Paper - OBFHELPER
private static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> {
@@ -88,7 +88,7 @@ public class Zombie extends Monster {
public static final int REINFORCEMENT_RANGE_MAX = 40;
public static final int REINFORCEMENT_RANGE_MIN = 7;
private static final float BREAK_DOOR_CHANCE = 0.1F;
- private static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> {
+ public static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> { // Paper - private -> public
return enumdifficulty == Difficulty.HARD;
};
@@ -95,7 +96,7 @@ public class Zombie extends Monster {
private final BreakDoorGoal breakDoorGoal;
@@ -100,7 +100,7 @@ public class Zombie extends Monster {
public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Empty commands shall not be dispatched
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index c63033e3eb50423a7c32acfc0e705623cc4bec68..5ed78383ce247ceb24cda0335dbeae293958055c 100644
index 7156dea53be828acd01734fa1f9f7b9accf30ff6..dc5d21693237ebb0b2a1ee45e92d0f191c547637 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -223,6 +223,7 @@ public class Commands {
@@ -230,6 +230,7 @@ public class Commands {
command = event.getCommand();
String[] args = command.split(" ");

Datei anzeigen

@ -5,23 +5,23 @@ Subject: [PATCH] Implement API to expose exact interaction point
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 6269e37f2859417a80e6de16045f1c2325f9746f..37761176861027d0ee06f50d60584687fdac669b 100644
index de4fdd46f23b2b17da752a8afc0faecc1ad8344f..2a0f313365a25c1780027f1536dbb88ccdab61e2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -495,7 +495,7 @@ public class ServerPlayerGameMode {
@@ -498,7 +498,7 @@ public class ServerPlayerGameMode {
cancelledBlock = true;
}
- PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, hand);
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, hand, hitResult.getLocation()); // Paper
firedInteract = true;
interactResult = event.useItemInHand() == Event.Result.DENY;
interactPosition = blockposition.immutable();
this.firedInteract = true;
this.interactResult = event.useItemInHand() == Event.Result.DENY;
this.interactPosition = blockposition.immutable();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 8829ef03d0be16d8317aaf05bcd286b74f20656a..586d21eed8189adf696ca6d3642afebbe752d1b5 100644
index 263aaf312efcc8c8bda57448710ef6eb36a3a5bd..f6f2856c407abe195f1dfee7f4a7e30baea585f7 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -58,7 +58,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@@ -55,7 +55,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
@ -31,8 +31,8 @@ index 8829ef03d0be16d8317aaf05bcd286b74f20656a..586d21eed8189adf696ca6d3642afebb
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Server;
@@ -475,7 +477,13 @@ public class CraftEventFactory {
return callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand);
@@ -477,7 +479,13 @@ public class CraftEventFactory {
return CraftEventFactory.callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand);
}
+ // Paper start - Add interactionPoint
@ -45,7 +45,7 @@ index 8829ef03d0be16d8317aaf05bcd286b74f20656a..586d21eed8189adf696ca6d3642afebb
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
@@ -501,7 +509,10 @@ public class CraftEventFactory {
@@ -503,7 +511,10 @@ public class CraftEventFactory {
itemInHand = null;
}

Datei anzeigen

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 9 Jan 2021 14:17:07 +0100
Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f1c02ae301da2a3b582d2ec1215c1a981e26ac47..0e14946284738b751790b2763bfe197c0148a54a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1768,6 +1768,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
});
optional1.ifPresent((villageplacetype) -> {
this.getServer().execute(() -> {
+ // Paper start
+ if (!optional.isPresent() && this.getPoiManager().exists(blockposition1, com.google.common.base.Predicates.alwaysTrue())) {
+ this.getPoiManager().remove(blockposition1);
+ }
+ // Paper end
this.getPoiManager().add(blockposition1, villageplacetype);
DebugPackets.sendPoiAddedPacket(this, blockposition1);
});