1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-17 02:34:30 +01:00

More more more more work

This commit is contained in:
Nassim Jahnke 2024-12-03 20:34:55 +01:00
parent 39c2c1d5f7
commit 2c2dadf75b
315 changed files with 143 additions and 126 deletions
patches/server
API-for-an-entity-s-scoreboard-name.patchAPI-for-updating-recipes-on-clients.patchAbility-to-control-player-s-insomnia-and-phantoms.patchAdd-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patchAdd-API-to-get-the-collision-shape-of-a-block-before.patchAdd-BlockBreakProgressUpdateEvent.patchAdd-BlockFace-to-BlockDamageEvent.patchAdd-BlockLockCheckEvent.patchAdd-CartographyItemEvent.patchAdd-CompostItemEvent-and-EntityCompostItemEvent.patchAdd-Entity-Body-Yaw-API.patchAdd-EntityFertilizeEggEvent.patchAdd-EntityPortalReadyEvent.patchAdd-EntityToggleSitEvent.patchAdd-FluidState-API.patchAdd-ItemType-getItemRarity.patchAdd-Lifecycle-Event-system.patchAdd-Listing-API-for-Player.patchAdd-Mob-Experience-reward-API.patchAdd-Moving-Piston-API.patchAdd-NamespacedKey-biome-methods.patchAdd-Player-Warden-Warning-API.patchAdd-Player-getFishHook.patchAdd-PlayerInventorySlotChangeEvent.patchAdd-PlayerPickItemEvent.patchAdd-PlayerShieldDisableEvent.patchAdd-PlayerTradeEvent-and-PlayerPurchaseEvent.patchAdd-PrePlayerAttackEntityEvent.patchAdd-Shearable-API.patchAdd-ShulkerDuplicateEvent.patchAdd-Sneaking-API-for-Entities.patchAdd-Structure-check-API.patchAdd-UUID-attribute-modifier-API.patchAdd-Velocity-IP-Forwarding-Support.patchAdd-WardenAngerChangeEvent.patchAdd-and-fix-missing-BlockFadeEvents.patchAdd-api-for-spawn-egg-texture-colors.patchAdd-config-for-mobs-immune-to-default-effects.patchAdd-config-option-for-spider-worldborder-climbing.patchAdd-drops-to-shear-events.patchAdd-entity-knockback-API.patchAdd-even-more-Enchantment-API.patchAdd-event-for-player-editing-sign.patchAdd-experience-points-API.patchAdd-fire-tick-delay-option.patchAdd-getChunkSnapshot-includeLightData-parameter.patchAdd-getDrops-to-BlockState.patchAdd-hand-to-fish-event-for-all-player-interactions.patchAdd-method-to-remove-all-active-potion-effects.patchAdd-missing-InventoryHolders-to-inventories.patchAdd-missing-SpigotConfig-logCommands-check.patchAdd-missing-fishing-event-state.patchAdd-missing-important-BlockStateListPopulator-method.patchAdd-missing-logs-for-log-ips-config-option.patchAdd-onboarding-message-for-initial-server-start.patchAdd-option-for-strict-advancement-dimension-checks.patchAdd-option-to-disable-block-updates.patchAdd-paper-dumplisteners-command.patchAdd-player-idle-duration-API.patchAdd-plugin-info-at-startup.patchAdd-predicate-for-blocks-when-raytracing.patchAdd-registry-entry-and-builders.patchAdd-skipping-world-symlink-scan.patchAdd-slot-sanity-checks-in-container-clicks.patchAdd-source-block-to-BlockPhysicsEvent.patchAdd-titleOverride-to-InventoryOpenEvent.patchAdd-transient-modifier-API.patchAdd-various-missing-EntityDropItemEvent-calls.patchAdd-whitelist-events.patchAdded-API-to-get-player-ha-proxy-address.patchAdded-byte-array-serialization-deserialization-for-P.patchAdopt-MaterialRerouting.patchAllow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patchAllow-Saving-of-Oversized-Chunks.patchAllow-null-itemstack-for-Player-sendEquipmentChange.patchAllow-proper-checking-of-empty-item-stacks.patchAllow-trident-custom-damage.patchAnti-Xray.patchAvoid-Lazy-Initialization-for-Enum-Fields.patchBandaid-fix-for-Effect.patchBlock-Ticking-API.patchBreak-redstone-on-top-of-trap-doors-early.patchBrigadier-based-command-API.patchBroadcast-take-item-packets-with-collector-as-source.patchCache-map-ids-on-item-frames.patchCall-BlockGrowEvent-for-missing-blocks.patchCall-BlockRedstoneEvents-properly.patchCall-missing-BlockDispenseEvent.patchCheck-distance-in-entity-interactions.patchCheck-for-block-type-in-SculkSensorBlock-canActivate.patchCollision-API.patchConfigurable-Region-Compression-Format.patchConfigurable-Sand-Duping.patchConfigurable-chat-thread-limit.patchConfigurable-damage-tick-when-blocking-with-shield.patchConfigurable-entity-tracking-range-by-Y-coordinate.patchConfigurable-max-block-fluid-ticks.patchConfiguration-for-horizontal-only-item-merging.patchConfigure-sniffer-egg-hatch-time.patchCorrectly-handle-ArmorStand-invisibility.patch

View file

@ -0,0 +1,68 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: RodneyMKay <36546810+RodneyMKay@users.noreply.github.com>
Date: Wed, 8 Sep 2021 21:34:01 +0200
Subject: [PATCH] Add PlayerPickItemEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (stack.isItemEnabled(this.player.level().enabledFeatures())) {
Inventory playerinventory = this.player.getInventory();
int i = playerinventory.findSlotMatchingItem(stack);
+ // Paper start - Add PlayerPickItemEvent
+ final int sourceSlot = i;
+ final int targetSlot = Inventory.isHotbarSlot(sourceSlot) ? sourceSlot : playerinventory.getSuitableHotbarSlot();
+ final Player bukkitPlayer = this.player.getBukkitEntity();
+ final io.papermc.paper.event.player.PlayerPickItemEvent event = new io.papermc.paper.event.player.PlayerPickItemEvent(bukkitPlayer, targetSlot, sourceSlot);
+ if (!event.callEvent()) {
+ return;
+ }
+ // Paper end - Add PlayerPickItemEvent
if (i != -1) {
if (Inventory.isHotbarSlot(i)) {
- playerinventory.selected = i;
+ playerinventory.selected = event.getTargetSlot(); // Paper - Add target slot
} else {
- playerinventory.pickSlot(i);
+ playerinventory.pickSlot(i, event.getTargetSlot()); // Paper - Add target slot
}
} else if (this.player.hasInfiniteMaterials()) {
- playerinventory.addAndPickItem(stack);
+ playerinventory.addAndPickItem(stack, event.getTargetSlot()); // Paper - Add target slot
}
this.player.connection.send(new ClientboundSetHeldSlotPacket(playerinventory.selected));
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
@@ -0,0 +0,0 @@ public class Inventory implements Container, Nameable {
return -1;
}
- public void addAndPickItem(ItemStack stack) {
- this.selected = this.getSuitableHotbarSlot();
+ // Paper start - Add PlayerPickItemEvent
+ public void addAndPickItem(ItemStack stack, final int targetSlot) {
+ this.selected = targetSlot;
+ // Paper end - Add PlayerPickItemEvent
if (!((ItemStack) this.items.get(this.selected)).isEmpty()) {
int i = this.getFreeSlot();
@@ -0,0 +0,0 @@ public class Inventory implements Container, Nameable {
this.items.set(this.selected, stack);
}
- public void pickSlot(int slot) {
- this.selected = this.getSuitableHotbarSlot();
+ // Paper start - Add PlayerPickItemEvent
+ public void pickSlot(int slot, final int targetSlot) {
+ this.selected = targetSlot;
+ // Paper end - Add PlayerPickItemEvent
ItemStack itemstack = (ItemStack) this.items.get(this.selected);
this.items.set(this.selected, (ItemStack) this.items.get(slot));

Some files were not shown because too many files have changed in this diff Show more