Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
4bc15f13aa
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: e2160a18 Make MapCursor#type not depends on deprecated values CraftBukkit Changes: 6ce172642 SPIGOT-7761: Ender pearl does not damage or spawn endermites f5a63f734 SPIGOT-7759: Chunk not there when requested in ChunkUnloadEvent 28287259c Remove unused import eb9a7dde0 SPIGOT-7757: Cannot set item in Stonecutter Inventory f8be9d752 Move deserialized removed unhandled tags to dedicated removedTags a7e576186 Fix potential mutability issue with CraftMetaItem copy constructor 995885452 SPIGOT-7741: Vanilla ItemComponent in commands can't remove components 9ef69aa0b PR-1284: Move ItemType <-> ItemMeta linking to a centralized place 3e82eafbe PR-1420: Fix DirectEntity and CausingEntity Damager for Creepers ignited by Player c23daa71f SPIGOT-7751: Fix crash caused by arrows from trial spawners Make MapCursor#type not depends on deprecated values SPIGOT-7761: Ender pearl does not damage or spawn endermites
56 Zeilen
3.8 KiB
Diff
56 Zeilen
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Tue, 11 Feb 2020 21:56:48 -0600
|
|
Subject: [PATCH] Add EntityMoveEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 691d9d18e72a07b85bf13c6990b44e5cf56dffb5..64a334c368152656f0dbb811220ae20fbd3d5f85 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1608,6 +1608,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
while (iterator.hasNext()) {
|
|
ServerLevel worldserver = (ServerLevel) iterator.next();
|
|
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
|
|
+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
|
|
|
this.profiler.push(() -> {
|
|
String s = String.valueOf(worldserver);
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index deabbf30a550ff1835530257177b8f47e4710414..6b2d00878a373680bc3d59e19ae11a2d545146cc 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
public final LevelStorageSource.LevelStorageAccess convertable;
|
|
public final UUID uuid;
|
|
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
|
|
+ public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
|
|
|
public LevelChunk getChunkIfLoaded(int x, int z) {
|
|
return this.chunkSource.getChunk(x, z, false);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 536625307d7b820bd5293e70274e4d3885b04cba..9153119e21c75b3d523e10897935d931f633f1a5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3481,6 +3481,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
|
|
this.pushEntities();
|
|
this.level().getProfiler().pop();
|
|
+ // Paper start - Add EntityMoveEvent
|
|
+ if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
|
|
+ if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
|
|
+ Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
|
|
+ Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
|
+ io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
|
|
+ if (!event.callEvent()) {
|
|
+ this.absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
|
|
+ } else if (!to.equals(event.getTo())) {
|
|
+ this.absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Paper end - Add EntityMoveEvent
|
|
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
|
|
this.hurt(this.damageSources().drown(), 1.0F);
|
|
}
|