9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00

Updated Upstream (Gale)

This commit is contained in:
Dreeam
2023-08-10 01:42:43 +08:00
parent 220f856cb1
commit 01d3932db6
29 changed files with 42 additions and 148 deletions

View File

@@ -1565,7 +1565,7 @@ index f830ff98ac6e94fa4f0c9d85bcdd8f3816ecc645..24405fb76f0995350f259d5c5b775863
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60ae0be013 100644
index c6d13f1df78d93fb4a21e6733c4ca7d22464bded..59eaa377ca7201d2c634ef30f588969b36f4d6e3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -349,6 +349,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1725,16 +1725,16 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
} else {
ServerLevel worldserver = this.player.serverLevel();
@@ -1583,7 +1633,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
@@ -1601,7 +1651,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!event.isAllowed()) {
flag2 = true; // Paper - diff on change, this should be moved wrongly
if (event.getLogWarning())
- ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!", this.player.getName().getString());
+ ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!, ({})", this.player.getName().getString(), d11); // Purpur
+ ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!, ({})", this.player.getName().getString(), d11); // Purpur
}
// Paper end
}
// Paper start - optimise out extra getCubes
@@ -1634,6 +1684,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1663,6 +1713,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
@@ -1743,7 +1743,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
// Skip the first time we do this
if (from.getX() != Double.MAX_VALUE) {
Location oldTo = to.clone();
@@ -1672,6 +1724,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1701,6 +1753,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player.resetFallDistance();
}
@@ -1757,7 +1757,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5);
this.lastGoodX = this.player.getX();
this.lastGoodY = this.player.getY();
@@ -1704,6 +1763,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1745,6 +1804,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
}
// Paper end - optimise out extra getCubes
@@ -1771,7 +1771,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
private boolean isPlayerCollidingWithAnythingNew(LevelReader world, AABB box, double newX, double newY, double newZ) {
AABB axisalignedbb1 = this.player.getBoundingBox().move(newX - this.player.getX(), newY - this.player.getY(), newZ - this.player.getZ());
Iterable<VoxelShape> iterable = world.getCollisions(this.player, axisalignedbb1.deflate(9.999999747378752E-6D));
@@ -2049,6 +2115,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2090,6 +2156,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
boolean cancelled;
if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) {
@@ -1779,7 +1779,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand);
cancelled = event.useItemInHand() == Event.Result.DENY;
} else {
@@ -2103,12 +2170,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2144,12 +2211,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleResourcePackResponse(ServerboundResourcePackPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1801,7 +1801,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
player.getBukkitEntity().setResourcePackStatus(packStatus);
this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packStatus)); // CraftBukkit
// Paper end
@@ -2413,7 +2489,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2454,7 +2530,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
do {
instant1 = (Instant) this.lastChatTimeStamp.get();
if (timestamp.isBefore(instant1)) {
@@ -1810,7 +1810,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
}
} while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp));
@@ -2843,6 +2919,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2884,6 +2960,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
AABB axisalignedbb = entity.getBoundingBox();
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < ServerGamePacketListenerImpl.getMaxInteractionDistanceSquared(this.player.level())) { // Gale - make max interaction distance configurable
@@ -1818,7 +1818,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
packet.dispatch(new ServerboundInteractPacket.Handler() {
private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand);
@@ -2856,6 +2933,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2897,6 +2974,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event);
@@ -1827,7 +1827,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it.
@@ -3435,6 +3514,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3476,6 +3555,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
}
}
@@ -1840,7 +1840,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@@ -3590,6 +3675,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3631,6 +3716,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
@@ -1848,7 +1848,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
@@ -3614,6 +3700,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3655,6 +3741,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
@@ -1863,7 +1863,7 @@ index cafe296c9613c3363971a04a9fcd96bf1be8781b..fc43b6892f651af1cd6017aa15e07f60
try {
byte[] data = new byte[packet.data.readableBytes()];
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index ded7811cd10bc436957ed9f1576f3231f1af7b7b..badb262810effd22ca1ba021a1e746a777a19cbc 100644
index da6e9efd48567149123649e1a1014ebf14a4da2b..2163d62be320031b6cd1bed06a2600801c634112 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -233,6 +233,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -2282,7 +2282,7 @@ index 14fab63346d56c72cd7534a04760efd10eef4295..745e792482f61c571e2efbd4200dd1bd
@Override
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1bc6a4f616efbb9b78a894da0f501769e28394f4..136b9c7e21cb6eed24066efe81e9a7a33b1fd907 100644
index 4e1db12dbffd839cd37130ddfd494226c65c0d0e..2763c93cc32b4b0954cb34c67cbeccd2258cd07c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -156,7 +156,7 @@ import org.bukkit.plugin.PluginManager;
@@ -2491,7 +2491,7 @@ index 1bc6a4f616efbb9b78a894da0f501769e28394f4..136b9c7e21cb6eed24066efe81e9a7a3
}
public int getAirSupply() {
@@ -3759,7 +3825,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3764,7 +3830,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean canChangeDimensions() {
@@ -2500,7 +2500,7 @@ index 1bc6a4f616efbb9b78a894da0f501769e28394f4..136b9c7e21cb6eed24066efe81e9a7a3
}
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
@@ -4066,6 +4132,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4071,6 +4137,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return SlotAccess.NULL;
}
@@ -2521,7 +2521,7 @@ index 1bc6a4f616efbb9b78a894da0f501769e28394f4..136b9c7e21cb6eed24066efe81e9a7a3
@Override
public void sendSystemMessage(Component message) {}
@@ -4347,6 +4427,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4352,6 +4432,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.yRotO = this.getYRot();
}
@@ -2534,7 +2534,7 @@ index 1bc6a4f616efbb9b78a894da0f501769e28394f4..136b9c7e21cb6eed24066efe81e9a7a3
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
if (false && this.touchingUnloadedChunk()) { // Gale - Airplane - reduce entity fluid lookups if no fluids - cost of a lookup here is the same cost as below, so skip
return false;
@@ -4910,4 +4996,45 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4915,4 +5001,45 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
}
// Paper end
@@ -17668,7 +17668,7 @@ index 03455a6cf97b8bec5c84978fdae2c5cc5d27c7ff..cc34d64ae522f69d1d4cbd0be75c50e1
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 550dcb7d595221b221e4710890d8a3cad789fc07..f30c6e09adb3a6aa485357f859fc2a22227350c9 100644
index 0cc4025613df85ace29db75cb8c4a465a69b1a06..555f8d3aff7a6c1beed604dddc316d5904a0ea77 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2290,6 +2290,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {