mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
95 lines
4.3 KiB
Diff
95 lines
4.3 KiB
Diff
From c25c25d42f7a1f4b98c803061e5ad521a039452e 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] Packed Barrels
|
|
|
|
---
|
|
src/main/java/net/minecraft/server/TileEntityBarrel.java | 5 +++--
|
|
src/main/java/net/pl3x/purpur/PurpurConfig.java | 7 +++++++
|
|
.../org/bukkit/craftbukkit/inventory/CraftContainer.java | 6 +++++-
|
|
3 files changed, 15 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityBarrel.java b/src/main/java/net/minecraft/server/TileEntityBarrel.java
|
|
index 1e27abbea..08dee7518 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityBarrel.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityBarrel.java
|
|
@@ -54,7 +54,7 @@ public class TileEntityBarrel extends TileEntityLootable {
|
|
|
|
private TileEntityBarrel(TileEntityTypes<?> tileentitytypes) {
|
|
super(tileentitytypes);
|
|
- this.items = NonNullList.a(27, ItemStack.a);
|
|
+ this.items = NonNullList.a(net.pl3x.purpur.PurpurConfig.packedBarrels ? 54 : 27, ItemStack.a); // Purpur
|
|
}
|
|
|
|
public TileEntityBarrel() {
|
|
@@ -83,7 +83,7 @@ public class TileEntityBarrel extends TileEntityLootable {
|
|
|
|
@Override
|
|
public int getSize() {
|
|
- return 27;
|
|
+ return net.pl3x.purpur.PurpurConfig.packedBarrels ? 54 : 27; // Purpur
|
|
}
|
|
|
|
@Override
|
|
@@ -103,6 +103,7 @@ public class TileEntityBarrel extends TileEntityLootable {
|
|
|
|
@Override
|
|
protected Container createContainer(int i, PlayerInventory playerinventory) {
|
|
+ if (net.pl3x.purpur.PurpurConfig.packedBarrels) return ContainerChest.b(i, playerinventory, this); // 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 d7da38bf5..2179acffe 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -6,6 +6,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;
|
|
@@ -164,6 +165,12 @@ public class PurpurConfig {
|
|
snowmanPumpkinPutBack = getBoolean("settings.mobs.snow_golem.pumpkin-can-be-added-back", snowmanPumpkinPutBack);
|
|
}
|
|
|
|
+ public static boolean packedBarrels = true;
|
|
+ private static void packedBarrels() {
|
|
+ packedBarrels = getBoolean("settings.packed-barrels", packedBarrels);
|
|
+ InventoryType.BARREL.setDefaultSize(packedBarrels ? 54 : 27);
|
|
+ }
|
|
+
|
|
public static boolean ridableBat = true;
|
|
public static boolean ridableBee = true;
|
|
public static boolean ridableBlaze = true;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
|
|
index b4a7d982e..49cc721f5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
|
|
@@ -155,6 +155,8 @@ public class CraftContainer extends Container {
|
|
return Containers.GRINDSTONE;
|
|
case STONECUTTER:
|
|
return Containers.STONECUTTER;
|
|
+ case BARREL:
|
|
+ return net.pl3x.purpur.PurpurConfig.packedBarrels ? Containers.GENERIC_9X6 : Containers.GENERIC_9X3;
|
|
default:
|
|
return Containers.GENERIC_9X3;
|
|
}
|
|
@@ -168,8 +170,10 @@ public class CraftContainer extends Container {
|
|
case PLAYER:
|
|
case CHEST:
|
|
case ENDER_CHEST:
|
|
+ delegate = new ContainerChest(Containers.GENERIC_9X3, windowId, bottom, top, top.getSize() / 9); // Purpur
|
|
+ break;
|
|
case BARREL:
|
|
- delegate = new ContainerChest(Containers.GENERIC_9X3, windowId, bottom, top, top.getSize() / 9);
|
|
+ delegate = new ContainerChest(net.pl3x.purpur.PurpurConfig.packedBarrels ? Containers.GENERIC_9X6 : Containers.GENERIC_9X3, windowId, bottom, top, top.getSize() / 9); // Purpur
|
|
break;
|
|
case DISPENSER:
|
|
case DROPPER:
|
|
--
|
|
2.24.0.rc1
|
|
|