geforkt von Mirrors/Paper
01a13871de
Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
47 Zeilen
2.8 KiB
Diff
47 Zeilen
2.8 KiB
Diff
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 9b80f533e94c47ebc0d46429698e084216b632ab..52471ef87994ac91b4b0017159b61ff50774848a 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()) {
|