Skip to content

Commit 5222380

Browse files
committed
Purpur patch 6 row barrel and enderchest
1 parent c53bce7 commit 5222380

File tree

5 files changed

+108
-438
lines changed

5 files changed

+108
-438
lines changed

atdeprecated-server/minecraft-patches/removes/0007-Purpur-Barrels-and-enderchests-6-rows.patch renamed to atdeprecated-server/minecraft-patches/features/0009-Purpur-Barrels-and-enderchests-6-rows.patch

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: MidnightTale <[email protected]>
3-
Date: Sun, 20 Jul 2025 08:35:18 +0700
3+
Date: Thu, 24 Jul 2025 08:46:30 +0700
44
Subject: [PATCH] Purpur: Barrels and enderchests 6 rows
55

66
Co-authored by: William Blake Galbreath <[email protected]>
77
As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/purpur-server/minecraft-patches/features/0003-Barrels-and-enderchests-6-rows.patch)
88
Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/LICENSE)
99

1010
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
11-
index 5c21fc0c749973d17df690fe7e2eab597b198131..1efb67c5e047f692fc07b2f563698bacdaba8631 100644
11+
index 5c21fc0c749973d17df690fe7e2eab597b198131..d89f91a08d38869296471a78d52fa84ff97be64a 100644
1212
--- a/net/minecraft/server/players/PlayerList.java
1313
+++ b/net/minecraft/server/players/PlayerList.java
1414
@@ -1086,6 +1086,9 @@ public abstract class PlayerList {
1515
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
1616
this.server.getCommands().sendCommands(player);
1717
} // Paper - Add sendOpLevel API
18-
+ // Purpur start - Barrels and enderchests 6 rows
19-
+ player.enderChestSlotCount = 9 * 6;
20-
+ // Purpur end - Barrels and enderchests 6 rows
18+
+ // atDeprecated start - Barrels and enderchests 6 rows
19+
+ player.enderChestSlotCount = 9 * fun.mntale.atdeprecated.config.AtCoreConfig.INVENTORY_CONFIG.enderChestRows;
20+
+ // atDeprecated end - Barrels and enderchests 6 rows
2121
}
2222

2323
// Paper start - whitelist verify event / login event
2424
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
25-
index 0101e15160ffb47929f282a08d626f3dfa811c58..bb9247c44bc57221f6899e88e3136603b53ea9c9 100644
25+
index 7ff3562f4095a1e79a1299b56a080ee5a15cfa0d..aa1a5de33aef5718581bf50ee45b1d2b1c13a46c 100644
2626
--- a/net/minecraft/world/entity/player/Player.java
2727
+++ b/net/minecraft/world/entity/player/Player.java
2828
@@ -219,6 +219,7 @@ public abstract class Player extends LivingEntity {
2929
private int currentImpulseContextResetGraceTime = 0;
3030
public boolean affectsSpawning = true; // Paper - Affects Spawning API
3131
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
32-
+ public int enderChestSlotCount = -1; // Purpur - Barrels and enderchests 6 rows
32+
+ public int enderChestSlotCount = -1; // atDeprecated - Barrels and enderchests 6 rows
3333

3434
// CraftBukkit start
3535
public boolean fauxSleeping;
3636
diff --git a/net/minecraft/world/inventory/ChestMenu.java b/net/minecraft/world/inventory/ChestMenu.java
37-
index 0fffa384f928ab84451331380968fb4650eafe26..0399092c9f7a43ac100c11505176ade6d95a39da 100644
37+
index 0fffa384f928ab84451331380968fb4650eafe26..8cf24c79535d1cf326079f0eacd5f1ac25e3f365 100644
3838
--- a/net/minecraft/world/inventory/ChestMenu.java
3939
+++ b/net/minecraft/world/inventory/ChestMenu.java
40-
@@ -66,10 +66,30 @@ public class ChestMenu extends AbstractContainerMenu {
41-
return new ChestMenu(MenuType.GENERIC_9x6, containerId, playerInventory, 6);
40+
@@ -70,6 +70,26 @@ public class ChestMenu extends AbstractContainerMenu {
41+
return new ChestMenu(MenuType.GENERIC_9x3, containerId, playerInventory, container, 3);
4242
}
4343

4444
+ // Purpur start - Barrels and enderchests 6 rows
@@ -51,10 +51,6 @@ index 0fffa384f928ab84451331380968fb4650eafe26..0399092c9f7a43ac100c11505176ade6
5151
+ }
5252
+ // Purpur end - Barrels and enderchests 6 rows
5353
+
54-
public static ChestMenu threeRows(int containerId, Inventory playerInventory, Container container) {
55-
return new ChestMenu(MenuType.GENERIC_9x3, containerId, playerInventory, container, 3);
56-
}
57-
5854
+ // Purpur start - Barrels and enderchests 6 rows
5955
+ public static ChestMenu fourRows(int syncId, Inventory playerInventory, Container inventory) {
6056
+ return new ChestMenu(MenuType.GENERIC_9x4, syncId, playerInventory, inventory, 4);
@@ -69,7 +65,7 @@ index 0fffa384f928ab84451331380968fb4650eafe26..0399092c9f7a43ac100c11505176ade6
6965
return new ChestMenu(MenuType.GENERIC_9x6, containerId, playerInventory, container, 6);
7066
}
7167
diff --git a/net/minecraft/world/inventory/PlayerEnderChestContainer.java b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
72-
index beb74bc8398de8b48f41af7daef14d624826310e..1b8190d49c631a2a5720c836641205d798bd74e9 100644
68+
index beb74bc8398de8b48f41af7daef14d624826310e..3e434d41dea042697ae3a6804b64aec5bd1a4207 100644
7369
--- a/net/minecraft/world/inventory/PlayerEnderChestContainer.java
7470
+++ b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
7571
@@ -25,11 +25,18 @@ public class PlayerEnderChestContainer extends SimpleContainer {
@@ -82,18 +78,18 @@ index beb74bc8398de8b48f41af7daef14d624826310e..1b8190d49c631a2a5720c836641205d7
8278
// CraftBukkit end
8379
}
8480

85-
+ // Purpur start - Barrels and enderchests 6 rows
81+
+ // atDeprecated start - Barrels and enderchests 6 rows
8682
+ @Override
8783
+ public int getContainerSize() {
8884
+ return owner.enderChestSlotCount < 0 ? super.getContainerSize() : owner.enderChestSlotCount;
8985
+ }
90-
+ // Purpur end - Barrels and enderchests 6 rows
86+
+ // atDeprecated end - Barrels and enderchests 6 rows
9187
+
9288
public void setActiveChest(EnderChestBlockEntity enderChestBlockEntity) {
9389
this.activeChest = enderChestBlockEntity;
9490
}
9591
diff --git a/net/minecraft/world/level/block/EnderChestBlock.java b/net/minecraft/world/level/block/EnderChestBlock.java
96-
index 5077a9ff7b78801bdc53536a37aee07b8d86ee4d..264c837b79c4454391b3b6c0a2e183a69960a156 100644
92+
index 5077a9ff7b78801bdc53536a37aee07b8d86ee4d..c8f8ccd0cb1e24364cb2fade71558f8470687255 100644
9793
--- a/net/minecraft/world/level/block/EnderChestBlock.java
9894
+++ b/net/minecraft/world/level/block/EnderChestBlock.java
9995
@@ -84,9 +84,14 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
@@ -103,73 +99,72 @@ index 5077a9ff7b78801bdc53536a37aee07b8d86ee4d..264c837b79c4454391b3b6c0a2e183a6
10399
- new SimpleMenuProvider(
104100
- (containerId, playerInventory, player1) -> ChestMenu.threeRows(containerId, playerInventory, enderChestInventory), CONTAINER_TITLE
105101
- )
106-
+ new SimpleMenuProvider((containerId, playerInventory, player1) -> switch (6) {
102+
+ new SimpleMenuProvider((containerId, playerInventory, player1) -> switch (fun.mntale.atdeprecated.config.AtCoreConfig.INVENTORY_CONFIG.enderChestRows) {
107103
+ case 6 -> ChestMenu.sixRows(containerId, playerInventory, enderChestInventory);
108104
+ case 5 -> ChestMenu.fiveRows(containerId, playerInventory, enderChestInventory);
109105
+ case 4 -> ChestMenu.fourRows(containerId, playerInventory, enderChestInventory);
110106
+ case 2 -> ChestMenu.twoRows(containerId, playerInventory, enderChestInventory);
111107
+ case 1 -> ChestMenu.oneRow(containerId, playerInventory, enderChestInventory);
112108
+ default -> ChestMenu.threeRows(containerId, playerInventory, enderChestInventory);
113-
+ }, CONTAINER_TITLE) // Purpur - Barrels and enderchests 6 rows
109+
+ }, CONTAINER_TITLE) // atDeprecated - Barrels and enderchests 6 rows
114110
).isPresent()) {
115111
// Paper end - Fix InventoryOpenEvent cancellation - moved up;
116112
player.awardStat(Stats.OPEN_ENDERCHEST);
117113
diff --git a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
118-
index d679ab599dfd0bdbdc3ab5530d7fcd1c38baf7fa..2d0752274cde538927fea0206c874d4bc4ca0b16 100644
114+
index d679ab599dfd0bdbdc3ab5530d7fcd1c38baf7fa..f45f596341edc01c626c6b8c15e25895a9860261 100644
119115
--- a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
120116
+++ b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
121-
@@ -56,7 +56,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
117+
@@ -56,7 +56,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
122118
}
123119
// CraftBukkit end
124120

125121
- private NonNullList<ItemStack> items = NonNullList.withSize(27, ItemStack.EMPTY);
126-
+ // Purpur start - Barrels and enderchests 6 rows
127-
+ private NonNullList<ItemStack> items = NonNullList.withSize(switch (6) {
122+
+ // atDeprecated start - Barrels and enderchests 6 rows
123+
+ private NonNullList<ItemStack> items = NonNullList.withSize(switch (fun.mntale.atdeprecated.config.AtCoreConfig.INVENTORY_CONFIG.barrelRows) {
128124
+ case 6 -> 54;
129125
+ case 5 -> 45;
130126
+ case 4 -> 36;
131127
+ case 2 -> 18;
132128
+ case 1 -> 9;
133129
+ default -> 27;
134130
+ }, ItemStack.EMPTY);
135-
+ // Purpur end - Barrels and enderchests 6 rows
136-
+
131+
+ // atDeprecated end - Barrels and enderchests 6 rows
137132
public final ContainerOpenersCounter openersCounter = new ContainerOpenersCounter() {
138133
@Override
139134
protected void onOpen(Level level, BlockPos pos, BlockState state) {
140-
@@ -108,7 +118,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
135+
@@ -108,7 +117,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
141136

142137
@Override
143138
public int getContainerSize() {
144139
- return 27;
145-
+ // Purpur start - Barrels and enderchests 6 rows
146-
+ return switch (6) {
140+
+ // atDeprecated start - Barrels and enderchests 6 rows
141+
+ return switch (fun.mntale.atdeprecated.config.AtCoreConfig.INVENTORY_CONFIG.barrelRows) {
147142
+ case 6 -> 54;
148143
+ case 5 -> 45;
149144
+ case 4 -> 36;
150145
+ case 2 -> 18;
151146
+ case 1 -> 9;
152147
+ default -> 27;
153148
+ };
154-
+ // Purpur end - Barrels and enderchests 6 rows
149+
+ // atDeprecated end - Barrels and enderchests 6 rows
155150
}
156151

157152
@Override
158-
@@ -128,7 +147,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
153+
@@ -128,7 +146,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
159154

160155
@Override
161156
protected AbstractContainerMenu createMenu(int id, Inventory player) {
162157
- return ChestMenu.threeRows(id, player, this);
163-
+ // Purpur start - Barrels and enderchests 6 rows
164-
+ return switch (6) {
158+
+ // atDeprecated start - Barrels and enderchests 6 rows
159+
+ return switch (fun.mntale.atdeprecated.config.AtCoreConfig.INVENTORY_CONFIG.barrelRows) {
165160
+ case 6 -> ChestMenu.sixRows(id, player, this);
166161
+ case 5 -> ChestMenu.fiveRows(id, player, this);
167162
+ case 4 -> ChestMenu.fourRows(id, player, this);
168163
+ case 2 -> ChestMenu.twoRows(id, player, this);
169164
+ case 1 -> ChestMenu.oneRow(id, player, this);
170165
+ default -> ChestMenu.threeRows(id, player, this);
171166
+ };
172-
+ // Purpur end - Barrels and enderchests 6 rows
167+
+ // atDeprecated end - Barrels and enderchests 6 rows
173168
}
174169

175170
@Override

0 commit comments

Comments
 (0)