Files
Purpur/patches/server/0006-Barrels-and-enderchests-6-rows.patch
BillyGalbreath 1362f49b24 Updated Upstream (Paper, Tuinity, & Airplane)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
bca97a8f7 replace spaces in world key (touches #5397)
de94f6485 Refactor chat message composition (#5396)
e27f334bb [CI-SKIP] Fix makemcdevsrc.sh for nms relocations (#5389)
ae15e85da Updated Upstream (CraftBukkit)
26fe0ac5a Only set despawnTimer for Wandering Traders spawned by MobSpawnerTrader (#5391)
b748eb7b8 Fix VanillaMobGoalTest#testBukkitMap (#5390)
18dbbb578 [Auto] Updated Upstream (CraftBukkit)
fac9cc5d5 [CI-SKIP] Ignore .gitignore
087aa70e7 Deprecate ItemStack#setLore(List<String>) and ItemStack#getLore, add Component based alternatives
9889c651c apply fixup
c310f0a61 Updated Upstream (Bukkit/CraftBukkit)
f17560ab0 wtf is this t file -jmp
347f3a9b8 fix compile
700e9e6a5 rebase
cf4dc464a Revert de5f4e469...c270abe96
6870db613 script & POM fix
743c6533c Replace ** with * (BSD/macOS)
376d7b097 Don't remove the .java
fcb3fd42a Fix macOS/BSD support
8cfc05249 Link correctly
ba1031ca7 Rename work dir
c8d844ab7 Actually fix preloading this time
e62aa5e3e Fix class preloading
1c03cf898 It's mojang math, not minecraft math
1034873df Apply fixups
39b125771 Use revision file
956150da7 Welcome to 1.16.5-R0.2
ccb217c01 Change cache keys
0d217001c more work
f6d820f07 It compiles
0f78e9525 More work
1718f61bf Updated Upstream (CraftBukkit/Spigot)
b28d46114 Update scripts for NMS repackaging

Tuinity Changes:
9bdcb9b8e Delete work dir when running jar
6351d7ca7 Update Upstream (Paper)
932c199a6 Generate md-dev correctly
bf3e73778 Make packet limiter work from IDE
1686f3861 Fix packet limiter config
f40f7b425 Update README.md styling (#264)
da1c3ace5 GH Actions Changes (#213)
5f325ecf1 Update Upstream (Paper)
0f83fe48d Update Upstream (Paper)

Airplane Changes:
f94d39947 Merge pull request #18 from notOM3GA/upstream/nms-repackage
0fc622631 Force build for Flare update
08439d6a9 Update Upstream (Tuinity)
2021-03-21 23:00:01 -05:00

190 lines
11 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/src/main/java/net/minecraft/world/inventory/InventoryEnderChest.java b/src/main/java/net/minecraft/world/inventory/InventoryEnderChest.java
index 85b9eba1dba3de69ab65b0e1c5ebb8740ce6e9e5..97f6ba97a4b2a35c0b8a003e1e27ad38831d859d 100644
--- a/src/main/java/net/minecraft/world/inventory/InventoryEnderChest.java
+++ b/src/main/java/net/minecraft/world/inventory/InventoryEnderChest.java
@@ -28,11 +28,34 @@ public class InventoryEnderChest extends InventorySubcontainer {
}
public InventoryEnderChest(EntityHuman owner) {
- super(27);
+ super(net.pl3x.purpur.PurpurConfig.enderChestSixRows ? 54 : 27); // Purpur
this.owner = owner;
// CraftBukkit end
}
+ // Purpur start
+ @Override
+ public int getSize() {
+ if (net.pl3x.purpur.PurpurConfig.enderChestSixRows && net.pl3x.purpur.PurpurConfig.enderChestPermissionRows && owner != null && owner.getProfile() != null) {
+ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkit = owner.getBukkitEntity();
+ if (bukkit.hasPermission("purpur.enderchest.rows.six")) {
+ return 54;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.five")) {
+ return 45;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.four")) {
+ return 36;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.three")) {
+ return 27;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.two")) {
+ return 18;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.one")) {
+ return 9;
+ }
+ }
+ return super.getSize();
+ }
+ // Purpur end
+
public void a(TileEntityEnderChest tileentityenderchest) {
this.a = tileentityenderchest;
}
diff --git a/src/main/java/net/minecraft/world/level/block/BlockEnderChest.java b/src/main/java/net/minecraft/world/level/block/BlockEnderChest.java
index 70d10c492b6ba893d56a463c0e71ac6aa8707f81..34ea9d2aeb9d606d487be796283c9d5ed614a6af 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockEnderChest.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockEnderChest.java
@@ -11,6 +11,7 @@ import net.minecraft.world.TileInventory;
import net.minecraft.world.entity.monster.piglin.PiglinAI;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.inventory.ContainerChest;
+import net.minecraft.world.inventory.Containers;
import net.minecraft.world.inventory.InventoryEnderChest;
import net.minecraft.world.item.context.BlockActionContext;
import net.minecraft.world.level.GeneratorAccess;
@@ -81,6 +82,27 @@ public class BlockEnderChest extends BlockChestAbstract<TileEntityEnderChest> im
inventoryenderchest.a(tileentityenderchest);
entityhuman.openContainer(new TileInventory((i, playerinventory, entityhuman1) -> {
+ // Purpur start
+ if (net.pl3x.purpur.PurpurConfig.enderChestSixRows) {
+ if (net.pl3x.purpur.PurpurConfig.enderChestPermissionRows) {
+ org.bukkit.craftbukkit.entity.CraftHumanEntity player = entityhuman.getBukkitEntity();
+ if (player.hasPermission("purpur.enderchest.rows.six")) {
+ return new ContainerChest(Containers.GENERIC_9X6, i, playerinventory, inventoryenderchest, 6);
+ } else if (player.hasPermission("purpur.enderchest.rows.five")) {
+ return new ContainerChest(Containers.GENERIC_9X5, i, playerinventory, inventoryenderchest, 5);
+ } else if (player.hasPermission("purpur.enderchest.rows.four")) {
+ return new ContainerChest(Containers.GENERIC_9X4, i, playerinventory, inventoryenderchest, 4);
+ } else if (player.hasPermission("purpur.enderchest.rows.three")) {
+ return new ContainerChest(Containers.GENERIC_9X3, i, playerinventory, inventoryenderchest, 3);
+ } else if (player.hasPermission("purpur.enderchest.rows.two")) {
+ return new ContainerChest(Containers.GENERIC_9X2, i, playerinventory, inventoryenderchest, 2);
+ } else if (player.hasPermission("purpur.enderchest.rows.one")) {
+ return new ContainerChest(Containers.GENERIC_9X1, i, playerinventory, inventoryenderchest, 1);
+ }
+ }
+ return new ContainerChest(Containers.GENERIC_9X6, i, playerinventory, inventoryenderchest, 6);
+ }
+ // Purpur end
return ContainerChest.a(i, playerinventory, inventoryenderchest);
}, BlockEnderChest.e));
entityhuman.a(StatisticList.OPEN_ENDERCHEST);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBarrel.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBarrel.java
index 7a6f150490bc3ef8a5ed43c401fd70bcc67f40f0..449d2c38abdd35b782a6732006eebb381815bcba 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBarrel.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBarrel.java
@@ -14,6 +14,7 @@ import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.player.PlayerInventory;
import net.minecraft.world.inventory.Container;
import net.minecraft.world.inventory.ContainerChest;
+import net.minecraft.world.inventory.Containers;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.BlockBarrel;
import net.minecraft.world.level.block.Blocks;
@@ -68,7 +69,7 @@ public class TileEntityBarrel extends TileEntityLootable {
private TileEntityBarrel(TileEntityTypes<?> tileentitytypes) {
super(tileentitytypes);
- this.items = NonNullList.a(27, ItemStack.b);
+ this.items = NonNullList.a(net.pl3x.purpur.PurpurConfig.barrelSixRows ? 54 : 27, ItemStack.b); // Purpur
}
public TileEntityBarrel() {
@@ -97,7 +98,7 @@ public class TileEntityBarrel extends TileEntityLootable {
@Override
public int getSize() {
- return 27;
+ return net.pl3x.purpur.PurpurConfig.barrelSixRows ? 54 : 27; // Purpur
}
@Override
@@ -117,6 +118,7 @@ public class TileEntityBarrel extends TileEntityLootable {
@Override
protected Container createContainer(int i, PlayerInventory playerinventory) {
+ if (net.pl3x.purpur.PurpurConfig.barrelSixRows) return new ContainerChest(Containers.GENERIC_9X6, i, playerinventory, this, 6); // Purpur
return ContainerChest.a(i, playerinventory, this);
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 00eb196f8caa2e4f2478972c14f4596071adbd2a..cb7e34924cb5dbff25d1ffe05cfe5bc22e4a90ed 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.event.inventory.InventoryType;
import java.io.File;
import java.io.IOException;
@@ -133,4 +134,23 @@ public class PurpurConfig {
timingsUrl = getString("settings.timings.url", timingsUrl);
if (!TimingsManager.hiddenConfigs.contains("server-ip")) TimingsManager.hiddenConfigs.add("server-ip");
}
+
+ public static boolean barrelSixRows = false;
+ public static boolean enderChestSixRows = false;
+ public static boolean enderChestPermissionRows = false;
+ private static void blockSettings() {
+ if (version < 3) {
+ boolean oldValue = getBoolean("settings.barrel.packed-barrels", true);
+ set("settings.blocks.barrel.six-rows", oldValue);
+ set("settings.packed-barrels", null);
+ oldValue = getBoolean("settings.large-ender-chests", true);
+ set("settings.blocks.ender_chest.six-rows", oldValue);
+ set("settings.large-ender-chests", null);
+ }
+ barrelSixRows = getBoolean("settings.blocks.barrel.six-rows", barrelSixRows);
+ InventoryType.BARREL.setDefaultSize(barrelSixRows ? 54 : 27);
+ enderChestSixRows = getBoolean("settings.blocks.ender_chest.six-rows", enderChestSixRows);
+ InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
+ enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
index 614ab2d73db2293116f2272f6cd5c16da446132d..2885dc250f171917393c0356a005b476b23f9c5f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
@@ -212,8 +212,10 @@ public class CraftContainer extends Container {
case PLAYER:
case CHEST:
case ENDER_CHEST:
+ delegate = new ContainerChest(net.pl3x.purpur.PurpurConfig.enderChestSixRows ? Containers.GENERIC_9X6 : Containers.GENERIC_9X3, windowId, bottom, top, top.getSize() / 9); // Purpur
+ break; // Purpur
case BARREL:
- delegate = new ContainerChest(Containers.GENERIC_9X3, windowId, bottom, top, top.getSize() / 9);
+ delegate = new ContainerChest(net.pl3x.purpur.PurpurConfig.barrelSixRows ? Containers.GENERIC_9X6 : Containers.GENERIC_9X3, windowId, bottom, top, top.getSize() / 9); // Purpur
break;
case DISPENSER:
case DROPPER:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index c3fa97ac34e1fc61ae02f224f8afe5a0b486fb4d..40e5a2fae032445467ac453f1fab7e366e911283 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -82,7 +82,7 @@ public class CraftInventory implements Inventory {
@Override
public void setContents(ItemStack[] items) {
- if (getSize() < items.length) {
+ if (false && getSize() < items.length) { // Purpur
throw new IllegalArgumentException("Invalid inventory size; expected " + getSize() + " or less");
}