More more more more more work

This commit is contained in:
Nassim Jahnke 2023-06-07 21:54:11 +02:00
parent 94aa4b518a
commit 3fed7289ed
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
39 changed files with 124 additions and 125 deletions

View File

@ -12,10 +12,10 @@ flushing on the netty event loop, so it won't do the flush on the main thread.
Renable flushing by passing -Dpaper.explicit-flush=true
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 07b2d28c5cba543b104ade6a180b0940a794e08c..b1a9c75081f7e61212ea9395b35375e067fd7fc6 100644
index ff1069f57227783f440e4ec9deb58fc709dfd0e7..0a4a875cd3d7f8f864d583d94b6f3869139db48e 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -117,6 +117,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -95,6 +95,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
// Paper start - NetworkClient implementation
public int protocolVersion;
public java.net.InetSocketAddress virtualHost;
@ -23,7 +23,7 @@ index 07b2d28c5cba543b104ade6a180b0940a794e08c..b1a9c75081f7e61212ea9395b35375e0
// Paper end
public Connection(PacketFlow side) {
@@ -317,7 +318,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -288,7 +289,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
if (this.channel != null) {

View File

@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4e263a0ca438ffd1253cda577689a1b6d2d55992..274f3a213e60c9b67dbc43c8b53efb676b8bd41e 100644
index 9fad7c117033694bc5850b9f9585e439c44ef0dd..646d6d3833ab7e40165502f29b0522562d6b8a71 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,6 +3,9 @@ package net.minecraft.server;
@ -194,7 +194,7 @@ index 4e263a0ca438ffd1253cda577689a1b6d2d55992..274f3a213e60c9b67dbc43c8b53efb67
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1349,7 +1352,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1353,7 +1356,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hidesOnlinePlayers()) {
return new ServerStatus.Players(i, list.size(), List.of());
} else {

View File

@ -9,10 +9,10 @@ This can be useful for changing name or skins after a player has logged in.
public-f net.minecraft.world.entity.player.Player gameProfile
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index efc9b3bf0a63f87f8d1cab57b8f521a306aef5f3..d9c441f600a1f981a9dad075cba9d1d9b28e1aa0 100644
index 8abd8d7e1bbdd59338725ae075117ec26d567a86..86e6e6ffdd5d8391b7a8f17bbad9b49a62339a8a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1536,7 +1536,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1528,7 +1528,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
}
@ -55,7 +55,7 @@ index e7442952ef1f03969949014492a7ddc6d0796ba5..69a1852905dd4724c30ac8ab88c14251
public Server getServer() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6ec434b6e07aba63b28f9f03eadc3550e43f9998..d3b5c7d0d6ac449ecfb99e0ed62981b296528e07 100644
index b7f071d7d0128d4c0990b59bd843fd88f8320ca8..407a037ae43c8cd209a9ce18359b5e0a15d9a88f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -82,6 +82,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
@ -64,9 +64,9 @@ index 6ec434b6e07aba63b28f9f03eadc3550e43f9998..d3b5c7d0d6ac449ecfb99e0ed62981b2
import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.entity.SignBlockEntity;
import net.minecraft.world.level.block.entity.SignText;
import net.minecraft.world.level.border.BorderChangeListener;
import net.minecraft.world.level.saveddata.maps.MapDecoration;
@@ -291,11 +292,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -216,11 +217,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return server.getPlayer(getUniqueId()) != null;
}
@ -78,11 +78,11 @@ index 6ec434b6e07aba63b28f9f03eadc3550e43f9998..d3b5c7d0d6ac449ecfb99e0ed62981b2
@Override
public InetSocketAddress getAddress() {
if (this.getHandle().connection == null) return null;
@@ -1686,8 +1682,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1617,8 +1613,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private void untrackAndHideEntity(org.bukkit.entity.Entity entity) {
// Remove this entity from the hidden player's EntityTrackerEntry
- ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap;
- ChunkMap tracker = ((ServerLevel) this.getHandle().level()).getChunkSource().chunkMap;
+ // Paper start
Entity other = ((CraftEntity) entity).getHandle();
+ unregisterEntity(other);
@ -91,11 +91,11 @@ index 6ec434b6e07aba63b28f9f03eadc3550e43f9998..d3b5c7d0d6ac449ecfb99e0ed62981b2
+ }
+ private void unregisterEntity(Entity other) {
+ // Paper end
+ ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap;
+ ChunkMap tracker = ((ServerLevel) this.getHandle().level()).getChunkSource().chunkMap;
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
if (entry != null) {
entry.removePlayer(this.getHandle());
@@ -1700,8 +1703,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1631,8 +1634,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(new ClientboundPlayerInfoRemovePacket(List.of(otherPlayer.getUUID())));
}
}
@ -104,7 +104,7 @@ index 6ec434b6e07aba63b28f9f03eadc3550e43f9998..d3b5c7d0d6ac449ecfb99e0ed62981b2
}
void resetAndHideEntity(org.bukkit.entity.Entity entity) {
@@ -1778,8 +1779,38 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1709,8 +1710,38 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (entry != null && !entry.seenBy.contains(this.getHandle().connection)) {
entry.updatePlayer(this.getHandle());
}
@ -144,7 +144,7 @@ index 6ec434b6e07aba63b28f9f03eadc3550e43f9998..d3b5c7d0d6ac449ecfb99e0ed62981b2
}
void resetAndShowEntity(org.bukkit.entity.Entity entity) {
@@ -1792,6 +1823,36 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1723,6 +1754,36 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.trackAndShowEntity(entity);
}
}

View File

@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5dcbb06370cdf6a5f700ebd09a9a765c9587a688..cb70820fd96624c2378e98d48ac31a11dc9e25e3 100644
index 495d904c24c13419675e94c4ecc9beca266f9ce6..3798a78a48047bde4e78072b271ba0a22c0ba579 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1740,6 +1740,25 @@ public final class CraftServer implements Server {
@@ -1738,6 +1738,25 @@ public final class CraftServer implements Server {
return recipients.size();
}

View File

@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d3b5c7d0d6ac449ecfb99e0ed62981b296528e07..e65981b8d064c6f9309b7b574531a6083fe0d783 100644
index 407a037ae43c8cd209a9ce18359b5e0a15d9a88f..ffdff5ac16903f7632347db883cd2f09c3cf0547 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -182,6 +182,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -20,7 +20,7 @@ index d3b5c7d0d6ac449ecfb99e0ed62981b296528e07..e65981b8d064c6f9309b7b574531a608
// Paper end
public CraftPlayer(CraftServer server, ServerPlayer entity) {
@@ -2061,7 +2062,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1992,7 +1993,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
public void addChannel(String channel) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add openSign method to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 46b18cac2c40db01ebd29528d529fe631b03ddbb..f399a69e9dbac06e591219040634cbdb9382d3a2 100644
index 1a49daed4fe43d4513561e03937374c312d09efb..97028a14830384f06f4f1de36abfbc6bc1b90a19 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -100,15 +100,15 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState<
@@ -110,14 +110,14 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState<
super.applyTo(sign);
}
@ -20,15 +20,14 @@ index 46b18cac2c40db01ebd29528d529fe631b03ddbb..f399a69e9dbac06e591219040634cbdb
Preconditions.checkArgument(sign.getWorld() == player.getWorld(), "Sign must be in same world as Player");
SignBlockEntity handle = ((CraftSign<?>) sign).getTileEntity();
handle.isEditable = true;
- ((CraftPlayer) player).getHandle().openTextEdit(handle);
+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) player).getHandle().openTextEdit(handle); // Paper - change move open sign to HumanEntity
- ((CraftPlayer) player).getHandle().openTextEdit(handle, true);
+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) player).getHandle().openTextEdit(handle, true); // Paper - change move open sign to HumanEntity
}
// Paper start
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 03a05d4d34181b34ca67bdbd6c66006071bdcdb4..04fe1bd9254b084eacbbca0e2a8a1ac100d17f12 100644
index c6b2f1b90735ec75492daf64031d9d33226cdac6..db27f88cc2fcb2835a5ef03519c75a176426b9fa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -628,6 +628,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Configurable sprint interruption on attack
If the sprint interruption is disabled players continue sprinting when they attack entities.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index ad723fc78d7fc57c67b5a74bb7dd2fd6623d18dd..f92a5fc15b05b247dd62ccfdf690c2ef2b702b65 100644
index 0bf9425d001660816b36674c2757ec9e85cbd296..f5662c9b8dfd3251be6bf57e7bc13aeb54fe30c2 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1289,7 +1289,11 @@ public abstract class Player extends LivingEntity {
@@ -1290,7 +1290,11 @@ public abstract class Player extends LivingEntity {
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));

View File

@ -8,7 +8,7 @@ Fires an event anytime an enderman intends to teleport away from the player
You may cancel this, enabling ranged attacks to damage the enderman for example.
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index d5f6769a50dee22349713bd313858c799a5a3960..167be7bc35f83fb3563044492195181c75b0bd1d 100644
index 045f9d569305786b882db915e431cb45f6aa3375..9df51c1108f4e9a3d8391783b7394286d6e1eb24 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -118,6 +118,12 @@ public class EnderMan extends Monster implements NeutralMob {
@ -25,11 +25,11 @@ index d5f6769a50dee22349713bd313858c799a5a3960..167be7bc35f83fb3563044492195181c
public boolean setTarget(LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setTarget(entityliving, reason, fireEvent)) {
@@ -272,7 +278,7 @@ public class EnderMan extends Monster implements NeutralMob {
if (this.level.isDay() && this.tickCount >= this.targetChangeTime + 600) {
if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) {
float f = this.getLightLevelDependentMagicValue();
- if (f > 0.5F && this.level.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.level.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
- if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
this.setTarget((LivingEntity) null);
this.teleport();
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Enderman.teleportRandomly()
Ability to trigger the vanilla "teleport randomly" mechanic of an enderman.
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 167be7bc35f83fb3563044492195181c75b0bd1d..54088f183e218e10d48e07f3f66b2fdb892a1035 100644
index 9df51c1108f4e9a3d8391783b7394286d6e1eb24..67dab95d562f4d1acc2a78bb9d45cba92cb6d38b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -287,7 +287,7 @@ public class EnderMan extends Monster implements NeutralMob {
@ -15,7 +15,7 @@ index 167be7bc35f83fb3563044492195181c75b0bd1d..54088f183e218e10d48e07f3f66b2fdb
- protected boolean teleport() {
+ public boolean teleport() { // Paper - protected->public
if (!this.level.isClientSide() && this.isAlive()) {
if (!this.level().isClientSide() && this.isAlive()) {
double d0 = this.getX() + (this.random.nextDouble() - 0.5D) * 64.0D;
double d1 = this.getY() + (double) (this.random.nextInt(64) - 32);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java

View File

@ -16,10 +16,10 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner
public net.minecraft.world.entity.projectile.Projectile ownerUUID
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 343e6da38413ab8dad876884241ad31172466659..d273673978c8270f2e0719412372039406e31f5e 100644
index 99a7fadf87b0b081a1f5ab15a8eeb1b0cb8572fe..1ca6b0f7306cb182cc2920e564e0d37368c08cc7 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2178,6 +2178,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2080,6 +2080,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTickingEnd(Entity entity) {
ServerLevel.this.entityTickList.remove(entity);
@ -33,14 +33,14 @@ index 343e6da38413ab8dad876884241ad31172466659..d273673978c8270f2e07194123720394
public void onTrackingStart(Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index f5ce2653489e544ca95cae9cfb1f209dd047824c..ad5c96e9a7577df1729533ec9a709387b7232844 100644
index b4a37d11e381d08c82945966ee5f969364f6e3ee..e9ae25a70c747c173ebd2e393818d205527d5314 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -91,6 +91,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
protected void readAdditionalSaveData(CompoundTag nbt) {
@@ -92,6 +92,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
if (nbt.hasUUID("Owner")) {
this.ownerUUID = nbt.getUUID("Owner");
+ if (this instanceof ThrownEnderpearl && this.level != null && this.level.paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
this.cachedOwner = null;
+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
}
this.leftOwner = nbt.getBoolean("LeftOwner");

View File

@ -10,10 +10,10 @@ Adds an option to control the force mode of the particle.
This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d273673978c8270f2e0719412372039406e31f5e..65110445ff8a245742c4f7a7055f544ff6344f75 100644
index 1ca6b0f7306cb182cc2920e564e0d37368c08cc7..34ffc34d853e7d38189597d258d80442624915e3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1576,12 +1576,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1485,12 +1485,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
@ -34,10 +34,10 @@ index d273673978c8270f2e0719412372039406e31f5e..65110445ff8a245742c4f7a7055f544f
if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 632cc1e185b61677d42405d212f41833ee1bc9d4..33cd9cb5b048fccd6bf7720aa1249f966f5b1e6d 100644
index 1278b114db828606dcd2f70c8f0ab53da490c19f..b241ae8bd974858bee9994ebde4272f0a6364b47 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1856,11 +1856,17 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1866,11 +1866,17 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {

View File

@ -8,11 +8,11 @@ Allow control over whether or not an enderman aggros a player.
This allows you to override/extend the pumpkin/stare logic.
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 54088f183e218e10d48e07f3f66b2fdb892a1035..908ef284f17296c72009a5803dfefff13664fb1c 100644
index 67dab95d562f4d1acc2a78bb9d45cba92cb6d38b..acd41b474fadee12c571f390b937f455cbe393ad 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -230,7 +230,15 @@ public class EnderMan extends Monster implements NeutralMob {
this.readPersistentAngerSaveData(this.level, nbt);
this.readPersistentAngerSaveData(this.level(), nbt);
}
- boolean isLookingAtMe(Player player) {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index e8be8054c3d54defe5e42e2c8a48e2b69552cd9c..b1dc61cd1a3ec4a9e8f0a0b0117ead1f31942c11 100644
index 112c4f203e2c1e3b1e0259e687ee2293c0132953..6a6b8672e65212dc2a1d837563d623b8bce8da28 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -124,7 +124,11 @@ public class Witch extends Raider implements RangedAttackMob {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] WitchThrowPotionEvent
Fired when a witch throws a potion at a player
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index b1dc61cd1a3ec4a9e8f0a0b0117ead1f31942c11..d9608df5227970e31ebc35a8293edb2de1e7ba76 100644
index 6a6b8672e65212dc2a1d837563d623b8bce8da28..0341a1cf05865f1a182a25adc5651f80ae09290a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -236,9 +236,16 @@ public class Witch extends Raider implements RangedAttackMob {
@ -20,7 +20,7 @@ index b1dc61cd1a3ec4a9e8f0a0b0117ead1f31942c11..d9608df5227970e31ebc35a8293edb2d
+ return;
+ }
+ potion = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
ThrownPotion entitypotion = new ThrownPotion(this.level, this);
ThrownPotion entitypotion = new ThrownPotion(this.level(), this);
-
- entitypotion.setItem(PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry));
+ entitypotion.setItem(potion);

View File

@ -8,7 +8,7 @@ This API has more capabilities than .dropItem with the Consumer function
Item can be set inside of the Consumer pre spawn function.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 7c5d5355237bc00f1c8c8433351ca7a9938f2e8b..d9be32a5141d7b322f31b61c685ca712cdb45182 100644
index 101dac0fcabc5fd696f58ec52ad1fc93a2d0afeb..cb6f5fc352aff449173825d4e7fad9fccb9df915 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -593,6 +593,10 @@ public abstract class CraftRegionAccessor implements RegionAccessor {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] WitchReadyPotionEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index d9608df5227970e31ebc35a8293edb2de1e7ba76..abbb077281eb8fc7961cf97ff23bb9822f2727f0 100644
index 0341a1cf05865f1a182a25adc5651f80ae09290a..df024c3108df807772fc487f5c59004a59938bf2 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -157,7 +157,11 @@ public class Witch extends Raider implements RangedAttackMob {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index da5e660860a46227c59567f6458a9cf4ac4092eb..3726339bff55bafce9d985254c91241c0c20b4b7 100644
index bdfce4a49cc6fed46de5864d1c443038f44027fb..e9ea9c85544a895dcf4220d907744996e6e077d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -173,6 +173,13 @@ public final class CraftItemStack extends ItemStack {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Implement EntityTeleportEndGatewayEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index 5fd074909f18f9b865ac1bcbed3711430e5349b0..757be65a8b6a85be91deeeea895e683eb107e809 100644
index 9f685b4fe6d57d921e9e7a4d817e0913b863c0ad..11f9b40d0cfb77d69ecd2c7ef71dc409d1d79eba 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -225,9 +225,20 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index baa30d4bdc8c31d04c84e4992062575709c4f2a4..d34945bc60d2b1734ec65be444ae8745cba2029d 100644
index b1e583ff4c1a9019be2f5d037bb04e7ebcbe9ae5..2480c128f6b7c4ba7af1f06f4e01b972587c08ba 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -276,6 +276,7 @@ public class Creeper extends Monster implements PowerableMob {

View File

@ -21,7 +21,7 @@ check is essentially the same as this.getHandle() == other.getHandle()
However, replaced it too to make it clearer of intent.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 5a44b9a94992f3703ae1353dbaad40fe25e89a50..dc4060aee09ec9700a9379e0536fd758c3c1eb25 100644
index f1a382d26f6a64b1c3f81fd2f2d5a35c51a63fdb..18967257c5c217868a5356369e3e3b200044aa39 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -837,14 +837,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Print Error details when failing to save player data
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
index 9d25ab52fac9e22d74f874491c7efbcaafa2ffc6..1b076dc77ea57cc779ce3c8742aba2b8c25ce92b 100644
index 984b75e12b5feab63767e030df925b3cbf26d559..36af81f0957d17e170d229059c66f4eb4539dfeb 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -43,7 +43,7 @@ public class PlayerDataStorage {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Make shield blocking delay configurable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 5ae5f58a6b521318703cf8ba044044992f0ef3f9..059223a014135cd6f6d8fbc4eee7888569fb46b5 100644
index bb5cff4ddf9c442f93a87dff8ab2aeb16a0f7c04..74c3762ebcb17d3836991f0293f02f5c42081715 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3711,12 +3711,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3760,12 +3760,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem();

View File

@ -9,12 +9,12 @@ Adds missing call to Illagers and also adds Arrow ItemStack to skeletons
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
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 1928354a7b9a4e3b03fc355ce7a1c60c23c504a9..362bc2d78e024df5a1cdfad9da6e768e3a778095 100644
index 9634de10605eb477c073d4241f8ea5f17eea268d..4ea7a6bd6fdc98bef30546e19e2676a78fb29007 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -201,7 +201,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4));
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
// CraftBukkit start
- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true);
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper
@ -22,13 +22,13 @@ index 1928354a7b9a4e3b03fc355ce7a1c60c23c504a9..362bc2d78e024df5a1cdfad9da6e768e
event.getProjectile().remove();
return;
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
index bd65129ec4f1b7c80ef99c34a1d30780f21bb4bf..10573602c9bc73713cbd6989762d3dbb6f6fcf8c 100644
index 421ed4daed9a61b9e9395538ff36606b196ca1f1..63fce7e3d9f59f36e29bc827a46396d73143bb8b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
@@ -196,8 +196,18 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4));
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
+ // Paper start
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true);
+ if (event.isCancelled()) {
@ -37,11 +37,11 @@ index bd65129ec4f1b7c80ef99c34a1d30780f21bb4bf..10573602c9bc73713cbd6989762d3dbb
+ }
+
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
+ this.level.addFreshEntity(entityarrow);
+ this.level().addFreshEntity(entityarrow);
+ }
this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
- this.level.addFreshEntity(entityarrow);
+ // Paper end
this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
- this.level().addFreshEntity(entityarrow);
}
@Override

View File

@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index f92a5fc15b05b247dd62ccfdf690c2ef2b702b65..457cafaa39907e85e1d1e9028f0eb75a90f3eb8e 100644
index f5662c9b8dfd3251be6bf57e7bc13aeb54fe30c2..16345738be241e5858a8df189a3c5c1d7b772353 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -2232,18 +2232,29 @@ public abstract class Player extends LivingEntity {
@@ -2260,18 +2260,29 @@ public abstract class Player extends LivingEntity {
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
}

View File

@ -9,10 +9,10 @@ Co-authored-by: aerulion <aerulion@gmail.com>
This event is called when an entity receives knockback by another entity.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 579b0c70043a545798a6c2871a84c77a5f011744..8b3beb78cf48ea7a23865ddc16c8421ecb047aba 100644
index 40cfaee167c3991392e7a82094b8e28361b65581..2032b98a1571846b28fd18cdb3ae96f2640a11c9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1775,8 +1775,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1842,8 +1842,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void push(double deltaX, double deltaY, double deltaZ) {
@ -33,10 +33,10 @@ index 579b0c70043a545798a6c2871a84c77a5f011744..8b3beb78cf48ea7a23865ddc16c8421e
protected void markHurt() {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cd0ae977eff36db8a2010596698835dcd9166ef9..10c6f6ac0c56eedf40190216e44d3f5d47b63deb 100644
index 74c3762ebcb17d3836991f0293f02f5c42081715..eeeaf05cb49e3440bfa3ab94048653f75e6a42da 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1445,7 +1445,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1494,7 +1494,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
d0 = (Math.random() - Math.random()) * 0.01D;
}
@ -45,7 +45,7 @@ index cd0ae977eff36db8a2010596698835dcd9166ef9..10c6f6ac0c56eedf40190216e44d3f5d
if (!flag) {
this.indicateDamage(d0, d1);
}
@@ -1494,7 +1494,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1543,7 +1543,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void blockedByShield(LivingEntity target) {
@ -54,7 +54,7 @@ index cd0ae977eff36db8a2010596698835dcd9166ef9..10c6f6ac0c56eedf40190216e44d3f5d
}
private boolean checkTotemDeathProtection(DamageSource source) {
@@ -1750,6 +1750,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1803,6 +1803,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void knockback(double strength, double x, double z) {
@ -66,10 +66,10 @@ index cd0ae977eff36db8a2010596698835dcd9166ef9..10c6f6ac0c56eedf40190216e44d3f5d
strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
if (strength > 0.0D) {
this.hasImpulse = true;
@@ -1757,6 +1762,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1810,6 +1815,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 vec3d1 = (new Vec3(x, 0.0D, z)).normalize().scale(strength);
this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
+ // Paper start - call EntityKnockbackByEntityEvent
+ Vec3 currentMovement = this.getDeltaMovement();
+ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMovement.x - vec3d.x, currentMovement.y - vec3d.y, currentMovement.z - vec3d.z);
@ -83,10 +83,10 @@ index cd0ae977eff36db8a2010596698835dcd9166ef9..10c6f6ac0c56eedf40190216e44d3f5d
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 6f1755efd7f1cf9dd65d070a3ba7623333f341bc..984a33d5e1f790a9c78ba57f2dc21fb072a44b3d 100644
index fec33a79fc9681ef51899a92ebb43c27126bd7ac..8151da761dd2dd561384181576321c71197a84e1 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1631,7 +1631,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1633,7 +1633,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (flag) {
if (f1 > 0.0F && target instanceof LivingEntity) {
@ -122,10 +122,10 @@ index 29cfd065f246bbd3d3c2a5bbd32c3f4813a02951..03ec02f9a2fb5abb5387cd0d83c9481d
}
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 18a9050158f71245d5d88f9c0833fd5d4e5fdca6..55a8ab31a26a16adbe78b3b34366dc81851c02d4 100644
index 0f39550f82aa1646dd5e4a887e33c414160ee7d9..9d5d03a913366c0f60557e39523c30df7e2fde33 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -434,7 +434,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -467,7 +467,7 @@ public class EnderDragon extends Mob implements Enemy {
double d3 = entity.getZ() - d1;
double d4 = Math.max(d2 * d2 + d3 * d3, 0.1D);
@ -135,7 +135,7 @@ index 18a9050158f71245d5d88f9c0833fd5d4e5fdca6..55a8ab31a26a16adbe78b3b34366dc81
entity.hurt(this.damageSources().mobAttack(this), 5.0F);
this.doEnchantDamageEffects(this, entity);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
index f4aa2be477da34c37660f0f3d7997928d327545d..24dc43c7806e99be6dc37af48ec056a5edd19947 100644
index 4e9cf63f363f7bba12b0a298230e3c7825512631..243397de3b0a843ec95c6b721d7fc654bfc78448 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
@@ -274,7 +274,7 @@ public class Ravager extends Raider {
@ -148,23 +148,23 @@ index f4aa2be477da34c37660f0f3d7997928d327545d..24dc43c7806e99be6dc37af48ec056a5
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
index f8ccf0cf421bf2d8d6d6ccf8dd9e7c27eb9024ed..de73183166962d84b3fcbb408e011bc9e8486374 100644
index 81003ce3f05c6be6f52a92b86a4721235f4ce12a..004382377ee364143a34287e7b6546ae1df4e88e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
@@ -40,7 +40,7 @@ public interface HoglinBase {
double j = f * (double)(attacker.level.random.nextFloat() * 0.5F + 0.2F);
double j = f * (double)(attacker.level().random.nextFloat() * 0.5F + 0.2F);
Vec3 vec3 = (new Vec3(g, 0.0D, h)).normalize().scale(j).yRot(i);
double k = f * (double)attacker.level.random.nextFloat() * 0.5D;
double k = f * (double)attacker.level().random.nextFloat() * 0.5D;
- target.push(vec3.x, k, vec3.z);
+ target.push(vec3.x, k, vec3.z, attacker); // Paper
target.hurtMarked = true;
}
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 457cafaa39907e85e1d1e9028f0eb75a90f3eb8e..2961e08fc315a0d5f3b95de9d127948da07e66c8 100644
index 16345738be241e5858a8df189a3c5c1d7b772353..71cca9c0e7742992661e857686aa2908e3474d21 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1283,9 +1283,9 @@ public abstract class Player extends LivingEntity {
@@ -1284,9 +1284,9 @@ public abstract class Player extends LivingEntity {
if (flag5) {
if (i > 0) {
if (target instanceof LivingEntity) {
@ -176,7 +176,7 @@ index 457cafaa39907e85e1d1e9028f0eb75a90f3eb8e..2961e08fc315a0d5f3b95de9d127948d
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
@@ -1307,7 +1307,7 @@ public abstract class Player extends LivingEntity {
@@ -1308,7 +1308,7 @@ public abstract class Player extends LivingEntity {
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits
if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
@ -186,7 +186,7 @@ index 457cafaa39907e85e1d1e9028f0eb75a90f3eb8e..2961e08fc315a0d5f3b95de9d127948d
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index aabb5ad09dd7b11a7dfbaa0849726541c0401951..01ccd4f90ad8aed84a89630cf6df9f7ba9bc3fec 100644
index 7acd5d9fb7f7d3e067de779a9e3f0cedb587c68a..86a82ecdcffc27b523fddc2709bbd92f315e8590 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -401,7 +401,7 @@ public abstract class AbstractArrow extends Projectile {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 33cd9cb5b048fccd6bf7720aa1249f966f5b1e6d..076a97209d9ac90bb89970a6d3a6075c022bd2ef 100644
index b241ae8bd974858bee9994ebde4272f0a6364b47..9ebd73ed9d88b74b007e918d74a9f000275d6550 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -711,6 +711,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -721,6 +721,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled;
}

View File

@ -148,7 +148,7 @@ index 5fbb06e28d5c797cfb6859ce7ef05ba00949f690..eada1f0ff10d4c00f82a6f4411fe18b7
super(server, entity);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
index 5f78b7ac2313cb8fe9ce835c0317217810a6b023..e92355fa2042c4cf15354a11b7058cacbe996f0d 100644
index 10ba8c3f9c2c84b573d77da4919324df6292ab9d..f9c3a14bf4674f21ed32f6dc2a4296a935dd2b6d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
@@ -10,7 +10,7 @@ import org.bukkit.entity.EntityType;

View File

@ -5,17 +5,17 @@ Subject: [PATCH] Add config to disable ender dragon legacy check
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 8412fbcafcfacc907e5dbdfcbde3fdc8a067464d..fd57b5a4cf8906b7bfb7c8c4f57c7b057296c8a3 100644
index c2b0eaaa1c4b74d04ba1781711208cbebd7b356c..35304d7a60348a2b4e1eec43418086086502e4ab 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -90,6 +90,10 @@ public class EndDragonFight {
private List<EndCrystal> respawnCrystals;
@@ -97,6 +97,10 @@ public class EndDragonFight {
}
public EndDragonFight(ServerLevel world, long gatewaysSeed, CompoundTag nbt) {
public EndDragonFight(ServerLevel world, long gatewaysSeed, EndDragonFight.Data data, BlockPos origin) {
+ // Paper start
+ this.needsStateScanning = world.paperConfig().entities.spawning.scanForLegacyEnderDragon;
+ if (!this.needsStateScanning) this.dragonKilled = true;
+ // Paper end
this.level = world;
if (nbt.contains("NeedsStateScanning")) {
this.needsStateScanning = nbt.getBoolean("NeedsStateScanning");
this.origin = origin;
this.validPlayer = EntitySelector.ENTITY_STILL_ALIVE.and(EntitySelector.withinDistance((double)origin.getX(), (double)(128 + origin.getY()), (double)origin.getZ(), 192.0D));

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement World.getEntity(UUID) API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 076a97209d9ac90bb89970a6d3a6075c022bd2ef..020049ba110ec10d7dfca9117dcc6de190cd6785 100644
index 9ebd73ed9d88b74b007e918d74a9f000275d6550..896ca23731663570c98ecd3eb20f984577f82d99 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1035,6 +1035,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1045,6 +1045,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return list;
}

View File

@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 65110445ff8a245742c4f7a7055f544ff6344f75..718a403799246228e085280cb539236b01720d4b 100644
index 34ffc34d853e7d38189597d258d80442624915e3..0612151976fe8bca5bdda27980d7e35e0aea1547 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1308,7 +1308,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1217,7 +1217,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) {
@ -19,7 +19,7 @@ index 65110445ff8a245742c4f7a7055f544ff6344f75..718a403799246228e085280cb539236b
}
}
}
@@ -2268,7 +2268,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2170,7 +2170,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
@ -29,19 +29,19 @@ index 65110445ff8a245742c4f7a7055f544ff6344f75..718a403799246228e085280cb539236b
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8797bfcf1115fd7011aff9b1d3c0e5ae80aa6d8c..57ab89118811cb0825435b9bdde8f5aeee681d75 100644
index 4a16b00058ce985c3080af9212a9d0331a5e5c62..4885dd69d6f63666a38b6d8d859c1dd858d38ad0 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -641,7 +641,7 @@ public class ServerPlayer extends Player {
@@ -640,7 +640,7 @@ public class ServerPlayer extends Player {
}
// Paper end
if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) {
if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) {
- this.closeContainer();
+ this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper
this.containerMenu = this.inventoryMenu;
}
@@ -834,7 +834,7 @@ public class ServerPlayer extends Player {
@@ -833,7 +833,7 @@ public class ServerPlayer extends Player {
// SPIGOT-943 - only call if they have an inventory open
if (this.containerMenu != this.inventoryMenu) {
@ -50,7 +50,7 @@ index 8797bfcf1115fd7011aff9b1d3c0e5ae80aa6d8c..57ab89118811cb0825435b9bdde8f5ae
}
net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure
@@ -1453,7 +1453,7 @@ public class ServerPlayer extends Player {
@@ -1452,7 +1452,7 @@ public class ServerPlayer extends Player {
}
// CraftBukkit end
if (this.containerMenu != this.inventoryMenu) {
@ -59,7 +59,7 @@ index 8797bfcf1115fd7011aff9b1d3c0e5ae80aa6d8c..57ab89118811cb0825435b9bdde8f5ae
}
// this.nextContainerCounter(); // CraftBukkit - moved up
@@ -1481,7 +1481,13 @@ public class ServerPlayer extends Player {
@@ -1480,7 +1480,13 @@ public class ServerPlayer extends Player {
@Override
public void closeContainer() {
@ -75,7 +75,7 @@ index 8797bfcf1115fd7011aff9b1d3c0e5ae80aa6d8c..57ab89118811cb0825435b9bdde8f5ae
this.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bed9c637d7d26b758ab587eb5cdf2c7f7fb7b356..0f3b223522872aeaacd7f571f60b9f01639820d7 100644
index 86e6e6ffdd5d8391b7a8f17bbad9b49a62339a8a..7f5f15c3542b308b9269a4e2194de2077fef82f5 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -220,6 +220,7 @@ import org.bukkit.event.inventory.ClickType;
@ -86,16 +86,16 @@ index bed9c637d7d26b758ab587eb5cdf2c7f7fb7b356..0f3b223522872aeaacd7f571f60b9f01
import org.bukkit.event.inventory.InventoryCreativeEvent;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.inventory.SmithItemEvent;
@@ -2680,10 +2681,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2672,10 +2673,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleContainerClose(ServerboundContainerClosePacket packet) {
+ // Paper start
+ handleContainerClose(packet, InventoryCloseEvent.Reason.PLAYER);
+ this.handleContainerClose(packet, InventoryCloseEvent.Reason.PLAYER);
+ }
+ public void handleContainerClose(ServerboundContainerClosePacket packet, InventoryCloseEvent.Reason reason) {
+ // Paper end
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.isImmobile()) return; // CraftBukkit
- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
@ -104,10 +104,10 @@ index bed9c637d7d26b758ab587eb5cdf2c7f7fb7b356..0f3b223522872aeaacd7f571f60b9f01
this.player.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 39cfbc7e109943878df038b7c3e26c64188104a3..bfc81327f0c64ef3bd2e8ba218f6a4970553a309 100644
index 3ab02a68d1cca67507cdf5e10f39199278d957ee..58a808e2ccf366eca8358529ed7c02080a4948b0 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -526,7 +526,7 @@ public abstract class PlayerList {
@@ -533,7 +533,7 @@ public abstract class PlayerList {
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
// See SPIGOT-5799, SPIGOT-6145
if (entityplayer.containerMenu != entityplayer.inventoryMenu) {
@ -117,19 +117,19 @@ index 39cfbc7e109943878df038b7c3e26c64188104a3..bfc81327f0c64ef3bd2e8ba218f6a497
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 2961e08fc315a0d5f3b95de9d127948da07e66c8..9c12fc197c5367a35acda4155707c602f043e571 100644
index 71cca9c0e7742992661e857686aa2908e3474d21..577cb4537296edebd0d48680171859e852ac1032 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -268,7 +268,7 @@ public abstract class Player extends LivingEntity {
@@ -269,7 +269,7 @@ public abstract class Player extends LivingEntity {
this.updateIsUnderwater();
super.tick();
if (!this.level.isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
- this.closeContainer();
+ this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper
this.containerMenu = this.inventoryMenu;
}
@@ -491,6 +491,13 @@ public abstract class Player extends LivingEntity {
@@ -492,6 +492,13 @@ public abstract class Player extends LivingEntity {
}
@ -144,7 +144,7 @@ index 2961e08fc315a0d5f3b95de9d127948da07e66c8..9c12fc197c5367a35acda4155707c602
this.containerMenu = this.inventoryMenu;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 04fe1bd9254b084eacbbca0e2a8a1ac100d17f12..77314674a1f66a514f8f5a0fef5ca188b5af0b6a 100644
index db27f88cc2fcb2835a5ef03519c75a176426b9fa..20aa0ad8e056ebb8d352c69da2a2ed044d338b41 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -378,7 +378,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -173,10 +173,10 @@ index 04fe1bd9254b084eacbbca0e2a8a1ac100d17f12..77314674a1f66a514f8f5a0fef5ca188
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e65981b8d064c6f9309b7b574531a6083fe0d783..931ad65bc199a3d5089c9f52d7b8b5d29b115285 100644
index ffdff5ac16903f7632347db883cd2f09c3cf0547..8a3b62dd565ed69132af3c0d3fb0919aebe58c7e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1239,7 +1239,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1170,7 +1170,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory
if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) {
@ -186,7 +186,7 @@ index e65981b8d064c6f9309b7b574531a6083fe0d783..931ad65bc199a3d5089c9f52d7b8b5d2
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 64ddab11cc8bd9e8063450f2bec22a4277e49414..c50cfe19bd40fb75fc66767d2760eb3b5852c4c8 100644
index beacc9af36eface8cf855ee15fb7bcf7e08f9439..116d3af618351cfec7dc172ba8e5170453b7226d 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1261,7 +1261,7 @@ public class CraftEventFactory {
@ -197,7 +197,7 @@ index 64ddab11cc8bd9e8063450f2bec22a4277e49414..c50cfe19bd40fb75fc66767d2760eb3b
+ player.connection.handleContainerClose(new ServerboundContainerClosePacket(player.containerMenu.containerId), InventoryCloseEvent.Reason.OPEN_NEW); // Paper
}
CraftServer server = player.level.getCraftServer();
CraftServer server = player.level().getCraftServer();
@@ -1435,8 +1435,18 @@ public class CraftEventFactory {
return event;
}
@ -215,6 +215,6 @@ index 64ddab11cc8bd9e8063450f2bec22a4277e49414..c50cfe19bd40fb75fc66767d2760eb3b
+ public static void handleInventoryCloseEvent(net.minecraft.world.entity.player.Player human, org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
+ // Paper end
+ InventoryCloseEvent event = new InventoryCloseEvent(human.containerMenu.getBukkitView(), reason); // Paper
human.level.getCraftServer().getPluginManager().callEvent(event);
human.level().getCraftServer().getPluginManager().callEvent(event);
human.containerMenu.transferTo(human.inventoryMenu, human.getBukkitEntity());
}

View File

@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0f3b223522872aeaacd7f571f60b9f01639820d7..c425dc285b6fe42093fb1c8f8fb4d512ec071929 100644
index 7f5f15c3542b308b9269a4e2194de2077fef82f5..eb83098f1cc176b57cacb3833ae00585099b7a36 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2562,6 +2562,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2554,6 +2554,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
if (event.isCancelled()) {