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.
63 Zeilen
3.4 KiB
Diff
63 Zeilen
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Byteflux <byte@byteflux.net>
|
|
Date: Wed, 2 Mar 2016 23:30:53 -0600
|
|
Subject: [PATCH] Add BeaconEffectEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
|
index 26275e888d09ee4bdbe305be9a56f749a8f4db4a..0c699c08ef85ca3339ada5c869b571581092a11d 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
|
@@ -40,6 +40,10 @@ import net.minecraft.world.phys.AABB;
|
|
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
|
import org.bukkit.potion.PotionEffect;
|
|
// CraftBukkit end
|
|
+// Paper start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
|
+// Paper end
|
|
|
|
public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
|
|
|
@@ -278,15 +282,23 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
|
}
|
|
}
|
|
|
|
- private static void applyEffect(List list, MobEffect mobeffectlist, int j, int b0) {
|
|
- {
|
|
+ private static void applyEffect(List list, MobEffect effects, int i, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent
|
|
+ if (!list.isEmpty()) { // Paper - BeaconEffectEvent
|
|
Iterator iterator = list.iterator();
|
|
|
|
Player entityhuman;
|
|
+ // Paper start - BeaconEffectEvent
|
|
+ org.bukkit.block.Block block = ((Player) list.get(0)).level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
|
|
+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(effects, i, b0, true, true));
|
|
+ // Paper end
|
|
|
|
while (iterator.hasNext()) {
|
|
- entityhuman = (Player) iterator.next();
|
|
- entityhuman.addEffect(new MobEffectInstance(mobeffectlist, j, b0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
|
+ // Paper start - BeaconEffectEvent
|
|
+ entityhuman = (ServerPlayer) iterator.next();
|
|
+ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), isPrimary);
|
|
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
|
+ entityhuman.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
|
+ // Paper end
|
|
}
|
|
}
|
|
}
|
|
@@ -309,10 +321,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
|
int j = BeaconBlockEntity.getLevel(beaconLevel);
|
|
List list = BeaconBlockEntity.getHumansInRange(world, pos, beaconLevel);
|
|
|
|
- BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0);
|
|
+ BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0, true, pos); // Paper - BeaconEffectEvent
|
|
|
|
if (BeaconBlockEntity.hasSecondaryEffect(beaconLevel, primaryEffect, secondaryEffect)) {
|
|
- BeaconBlockEntity.applyEffect(list, secondaryEffect, j, 0);
|
|
+ BeaconBlockEntity.applyEffect(list, secondaryEffect, j, 0, false, pos); // Paper - BeaconEffectEvent
|
|
}
|
|
}
|
|
|