Files
Purpur/purpur-server/minecraft-patches/features/0003-Barrels-and-enderchests-6-rows.patch
granny d4d8f4bd90 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@6fe7eb5a Load World Key when its instance is created (#13818)
PaperMC/Paper@944ce44a Fix CraftWorld identifier passing
PaperMC/Paper@aa6f09b0 Prevent Happy Ghast from playing mount/dismount noises when silenced (#13807)
PaperMC/Paper@7b31cc2b Make leaveMessage in PlayerKickEvent nullable (#13804)
PaperMC/Paper@65461225 Update health after setPlayerProfile() (#13717)
PaperMC/Paper@1a8417b1 [ci/skip] Add Javadocs for PotionEffect withX methods (#13723)
PaperMC/Paper@4af86ff3 Handle null ServerLevel in fromGlobalPos (#13703)
PaperMC/Paper@c39822ae reset pending keepalive state on listener handoff during reconfiguration (#13712)
PaperMC/Paper@dcf5577a Fix PlayerProfile applySkinToPlayerHeadContents (#13692)
PaperMC/Paper@dd203a27 chore: Don't log errors for accepting the EULA via the system property (#13681)
PaperMC/Paper@d74f6bc7 Support for Kill damageable entities (#13667)
PaperMC/Paper@90aee8e0 Update world methods to take in account environment attributes (#13543)
PaperMC/Paper@b2b1e177 Improvement to Vehicle damage events (#13572)
PaperMC/Paper@49daadd2 Fix insomniaStartTicks option being ignored for phantom spawning (#13609)
PaperMC/Paper@57d84f68 Prevent NPE on ThrownPotion#splash (#13683)
PaperMC/Paper@4f184db3 Fix memory leak on constantly damage (#13455)
PaperMC/Paper@60073714 Update MOJIRA reference in DeOp command response for multiple targets [ci/skip] (#13812)
PaperMC/Paper@4aef3f0a Remove already fixed vanilla bug MC-244739 (#13787)
PaperMC/Paper@945aea99 Fix Damager for HangingBreakByEntityEvent and minor improvements (#12615)
PaperMC/Paper@a8c05a35 Add an option to WorldCreator to avoid spawn location computation on world creation (#13407)
PaperMC/Paper@182b2f8a Add Point Of Interest API (#12117)
PaperMC/Paper@8021488e Disconnect State Fixes (#13616)
PaperMC/Paper@1f819732 Allow ServerboundChangeGameModePacket if player has /gamemode permissions (#13507)
PaperMC/Paper@a64ea13e Re-implement per-world and per-player time (#13814)
PaperMC/Paper@acfe105b Add options to disable chunk and block entity ticking (#13821)
PaperMC/Paper@651d8481 Finish world key initial migration (#13824)
PaperMC/Paper@f4e769a7 Improvements checks for arguments numbers (#13290)
PaperMC/Paper@5dc4afc1 Promote build channel to BETA
PaperMC/Paper@55be6c0e Fix boat and minecart inventories on region switch [ci/skip] (#13826)
PaperMC/Paper@7799bf28 Update Paperclip to v3.0.4
2026-04-27 00:53:47 -07:00

217 lines
12 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 23 May 2019 21:50:37 -0500
Subject: [PATCH] Barrels and enderchests 6 rows
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 7c0382f7cb42f448e947001542b7f40f11b018e9..341021c3952b89b6e234ce777aa37856eea58ff8 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -888,6 +888,27 @@ public abstract class PlayerList {
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
this.server.getCommands().sendCommands(player);
} // Paper - Add sendOpLevel API
+
+ // Purpur start - Barrels and enderchests 6 rows
+ if (org.purpurmc.purpur.PurpurConfig.enderChestSixRows && org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) {
+ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkit = player.getBukkitEntity();
+ if (bukkit.hasPermission("purpur.enderchest.rows.six")) {
+ player.sixRowEnderchestSlotCount = 54;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.five")) {
+ player.sixRowEnderchestSlotCount = 45;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.four")) {
+ player.sixRowEnderchestSlotCount = 36;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.three")) {
+ player.sixRowEnderchestSlotCount = 27;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.two")) {
+ player.sixRowEnderchestSlotCount = 18;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.one")) {
+ player.sixRowEnderchestSlotCount = 9;
+ }
+ } else {
+ player.sixRowEnderchestSlotCount = -1;
+ }
+ // Purpur end - Barrels and enderchests 6 rows
}
// Paper start - whitelist verify event / login event
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index 68688267947f19154a220fc4bea828232d08c313..fbf8d50b0e757b329818d868d86d4e8c4088ec07 100644
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -176,6 +176,7 @@ public abstract class Player extends Avatar implements ContainerUser {
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
public int burpDelay = 0; // Purpur - Burp delay
public boolean canPortalInstant = false; // Purpur - Add portal permission bypass
+ public int sixRowEnderchestSlotCount = -1; // Purpur - Barrels and enderchests 6 rows
// CraftBukkit start
public boolean fauxSleeping;
diff --git a/net/minecraft/world/inventory/ChestMenu.java b/net/minecraft/world/inventory/ChestMenu.java
index e77bfcd31cdcfd5836dc5db561e3fe2bc552a4b1..afa2ead0548766669201526d83f351c227c97e87 100644
--- a/net/minecraft/world/inventory/ChestMenu.java
+++ b/net/minecraft/world/inventory/ChestMenu.java
@@ -66,10 +66,30 @@ public class ChestMenu extends AbstractContainerMenu {
return new ChestMenu(MenuType.GENERIC_9x6, containerId, inventory, 6);
}
+ // Purpur start - Barrels and enderchests 6 rows
+ public static ChestMenu oneRow(int syncId, Inventory playerInventory, Container inventory) {
+ return new ChestMenu(MenuType.GENERIC_9x1, syncId, playerInventory, inventory, 1);
+ }
+
+ public static ChestMenu twoRows(int syncId, Inventory playerInventory, Container inventory) {
+ return new ChestMenu(MenuType.GENERIC_9x2, syncId, playerInventory, inventory, 2);
+ }
+ // Purpur end - Barrels and enderchests 6 rows
+
public static ChestMenu threeRows(final int containerId, final Inventory inventory, final Container container) {
return new ChestMenu(MenuType.GENERIC_9x3, containerId, inventory, container, 3);
}
+ // Purpur start - Barrels and enderchests 6 rows
+ public static ChestMenu fourRows(int syncId, Inventory playerInventory, Container inventory) {
+ return new ChestMenu(MenuType.GENERIC_9x4, syncId, playerInventory, inventory, 4);
+ }
+
+ public static ChestMenu fiveRows(int syncId, Inventory playerInventory, Container inventory) {
+ return new ChestMenu(MenuType.GENERIC_9x5, syncId, playerInventory, inventory, 5);
+ }
+ // Purpur end - Barrels and enderchests 6 rows
+
public static ChestMenu sixRows(final int containerId, final Inventory inventory, final Container container) {
return new ChestMenu(MenuType.GENERIC_9x6, containerId, inventory, container, 6);
}
diff --git a/net/minecraft/world/inventory/PlayerEnderChestContainer.java b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
index 4df3a32faf85595372f4b250482d852c985ea3ab..8347150af55119d772b797e79be412f7e17a0f1f 100644
--- a/net/minecraft/world/inventory/PlayerEnderChestContainer.java
+++ b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
@@ -26,11 +26,18 @@ public class PlayerEnderChestContainer extends SimpleContainer {
}
public PlayerEnderChestContainer(Player owner) {
- super(27);
+ super(org.purpurmc.purpur.PurpurConfig.enderChestSixRows ? 54 : 27); // Purpur - Barrels and enderchests 6 rows
this.owner = owner;
// CraftBukkit end
}
+ // Purpur start - Barrels and enderchests 6 rows
+ @Override
+ public int getContainerSize() {
+ return owner == null || owner.sixRowEnderchestSlotCount < 0 ? super.getContainerSize() : owner.sixRowEnderchestSlotCount;
+ }
+ // Purpur end - Barrels and enderchests 6 rows
+
public void setActiveChest(final EnderChestBlockEntity activeChest) {
this.activeChest = activeChest;
}
diff --git a/net/minecraft/world/level/block/EnderChestBlock.java b/net/minecraft/world/level/block/EnderChestBlock.java
index 24a2c411da0ebbb7f97d621bb76ff686621f9aae..7ba9e8f6414246b589ff423fac63f80505326505 100644
--- a/net/minecraft/world/level/block/EnderChestBlock.java
+++ b/net/minecraft/world/level/block/EnderChestBlock.java
@@ -88,7 +88,7 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
// Paper start - Fix InventoryOpenEvent cancellation - moved up;
container.setActiveChest(enderChest); // Needs to happen before ChestMenu.threeRows as it is required for opening animations
if (level instanceof ServerLevel serverLevel && player.openMenu(
- new SimpleMenuProvider((containerId, inventory, p) -> ChestMenu.threeRows(containerId, inventory, container), CONTAINER_TITLE)
+ new SimpleMenuProvider((containerId, inventory, p) -> org.purpurmc.purpur.PurpurConfig.enderChestSixRows ? getEnderChestSixRows(containerId, inventory, player, container) : ChestMenu.threeRows(containerId, inventory, container), CONTAINER_TITLE) // Purpur - Barrels and enderchests 6 rows
).isPresent()) {
// Paper end - Fix InventoryOpenEvent cancellation - moved up;
player.awardStat(Stats.OPEN_ENDERCHEST);
@@ -102,6 +102,35 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
}
}
+ // Purpur start - Barrels and enderchests 6 rows
+ private ChestMenu getEnderChestSixRows(int syncId, net.minecraft.world.entity.player.Inventory inventory, Player player, PlayerEnderChestContainer playerEnderChestContainer) {
+ if (org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) {
+ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkitPlayer = player.getBukkitEntity();
+ if (bukkitPlayer.hasPermission("purpur.enderchest.rows.six")) {
+ player.sixRowEnderchestSlotCount = 54;
+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.five")) {
+ player.sixRowEnderchestSlotCount = 45;
+ return ChestMenu.fiveRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.four")) {
+ player.sixRowEnderchestSlotCount = 36;
+ return ChestMenu.fourRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.three")) {
+ player.sixRowEnderchestSlotCount = 27;
+ return ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.two")) {
+ player.sixRowEnderchestSlotCount = 18;
+ return ChestMenu.twoRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.one")) {
+ player.sixRowEnderchestSlotCount = 9;
+ return ChestMenu.oneRow(syncId, inventory, playerEnderChestContainer);
+ }
+ }
+ player.sixRowEnderchestSlotCount = -1;
+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer);
+ }
+ // Purpur end - Barrels and enderchests 6 rows
+
@Override
public BlockEntity newBlockEntity(final BlockPos worldPosition, final BlockState blockState) {
return new EnderChestBlockEntity(worldPosition, blockState);
diff --git a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
index da5fdf77dd26d97c8b92bac9a6af8d922c31eb9c..c788746268d7317d8d4a7220fa9c71f5d04eedd6 100644
--- a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
@@ -60,7 +60,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
}
// CraftBukkit end
private static final Component DEFAULT_NAME = Component.translatable("container.barrel");
- private NonNullList<ItemStack> items = NonNullList.withSize(27, ItemStack.EMPTY);
+ // Purpur start - Barrels and enderchests 6 rows
+ private NonNullList<ItemStack> items = NonNullList.withSize(switch (org.purpurmc.purpur.PurpurConfig.barrelRows) {
+ case 6 -> 54;
+ case 5 -> 45;
+ case 4 -> 36;
+ case 2 -> 18;
+ case 1 -> 9;
+ default -> 27;
+ }, ItemStack.EMPTY);
+ // Purpur end - Barrels and enderchests 6 rows
public final ContainerOpenersCounter openersCounter = new ContainerOpenersCounter() {
{
Objects.requireNonNull(BarrelBlockEntity.this);
@@ -123,7 +132,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@Override
public int getContainerSize() {
- return 27;
+ // Purpur start - Barrels and enderchests 6 rows
+ return switch (org.purpurmc.purpur.PurpurConfig.barrelRows) {
+ case 6 -> 54;
+ case 5 -> 45;
+ case 4 -> 36;
+ case 2 -> 18;
+ case 1 -> 9;
+ default -> 27;
+ };
+ // Purpur end - Barrels and enderchests 6 rows
}
@Override
@@ -143,7 +161,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@Override
protected AbstractContainerMenu createMenu(final int containerId, final Inventory inventory) {
- return ChestMenu.threeRows(containerId, inventory, this);
+ // Purpur start - Barrels and enderchests 6 rows
+ return switch (org.purpurmc.purpur.PurpurConfig.barrelRows) {
+ case 6 -> ChestMenu.sixRows(containerId, inventory, this);
+ case 5 -> ChestMenu.fiveRows(containerId, inventory, this);
+ case 4 -> ChestMenu.fourRows(containerId, inventory, this);
+ case 2 -> ChestMenu.twoRows(containerId, inventory, this);
+ case 1 -> ChestMenu.oneRow(containerId, inventory, this);
+ default -> ChestMenu.threeRows(containerId, inventory, this);
+ };
+ // Purpur end - Barrels and enderchests 6 rows
}
@Override