9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-06 15:51:33 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0118-Vanilla-creative-pickup-behavior.patch
MC_XiaoHei 0e65b948fe 0120/0132
2025-07-03 15:15:39 +08:00

25 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Date: Sat, 10 May 2025 00:49:51 +0800
Subject: [PATCH] Vanilla creative pickup behavior
diff --git a/net/minecraft/world/entity/player/Inventory.java b/net/minecraft/world/entity/player/Inventory.java
index cc1a69293c31f23965b869e6899d89ad45312129..f6fa8dfe5c8ba33f770f2e53aaa3f4de6ad8918f 100644
--- a/net/minecraft/world/entity/player/Inventory.java
+++ b/net/minecraft/world/entity/player/Inventory.java
@@ -176,6 +176,13 @@ public class Inventory implements Container, Nameable {
// CraftBukkit start - Watch method above! :D
public int canHold(ItemStack itemStack) {
int remains = itemStack.getCount();
+
+ // Leaves start - vanilla creative pickup behavior
+ if (player.hasInfiniteMaterials()) {
+ return remains;
+ }
+ // Leaves end - vanilla creative pickup behavior
+
for (int slot = 0; slot < this.items.size(); ++slot) {
ItemStack itemInSlot = this.getItem(slot);
if (itemInSlot.isEmpty()) {