SPIGOT-5047: Correct slot types for 1.14 inventories

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2019-06-13 21:25:58 +10:00
parent aa6ffe2455
commit 1399237b6b
2 changed files with 23 additions and 13 deletions

View file

@ -54,7 +54,7 @@ public enum InventoryType {
*/
ENCHANTING(2,"Enchanting"),
/**
* A brewing stand inventory, with one FUEL slot and three CRAFTING slots.
* A brewing stand inventory, with one FUEL slot and four CRAFTING slots.
*/
BREWING(5,"Brewing"),
/**
@ -70,7 +70,7 @@ public enum InventoryType {
*/
CREATIVE(9,"Creative", false),
/**
* The merchant inventory, with 2 TRADE-IN slots, and 1 RESULT slot.
* The merchant inventory, with 2 CRAFTING slots, and 1 RESULT slot.
*/
MERCHANT(3,"Villager", false),
/**
@ -111,19 +111,19 @@ public enum InventoryType {
*/
SMOKER(3, "Smoker"),
/**
* Loom inventory, with 3 INPUT slots, and 1 RESULT slot.
* Loom inventory, with 3 CRAFTING slots, and 1 RESULT slot.
*/
LOOM(4, "Loom"),
/**
* Cartography inventory with 2 INPUT slots, and 1 RESULT slot.
* Cartography inventory with 2 CRAFTING slots, and 1 RESULT slot.
*/
CARTOGRAPHY(3, "Cartography Table"),
/**
* Grindstone inventory with 2 INPUT slots, and 1 RESULT slot.
* Grindstone inventory with 2 CRAFTING slots, and 1 RESULT slot.
*/
GRINDSTONE(3, "Repair & Disenchant"),
/**
* Stonecutter inventory with 1 INPUT slot, and 1 RESULT slot.
* Stonecutter inventory with 1 CRAFTING slot, and 1 RESULT slot.
*/
STONECUTTER(2, "Stonecutter")
;
@ -167,9 +167,7 @@ public enum InventoryType {
*/
RESULT,
/**
* A slot in the crafting matrix, or the input slot in a furnace
* inventory, the potion slot in the brewing stand, or the enchanting
* slot.
* A slot in the crafting matrix, or an 'input' slot.
*/
CRAFTING,
/**

View file

@ -329,7 +329,9 @@ public abstract class InventoryView {
InventoryType.SlotType type = InventoryType.SlotType.CONTAINER;
if (slot >= 0 && slot < this.getTopInventory().getSize()) {
switch(this.getType()) {
case BLAST_FURNACE:
case FURNACE:
case SMOKER:
if (slot == 2) {
type = InventoryType.SlotType.RESULT;
} else if(slot == 1) {
@ -356,6 +358,12 @@ public abstract class InventoryView {
type = InventoryType.SlotType.CRAFTING;
}
break;
case BEACON:
type = InventoryType.SlotType.CRAFTING;
break;
case ANVIL:
case CARTOGRAPHY:
case GRINDSTONE:
case MERCHANT:
if (slot == 2) {
type = InventoryType.SlotType.RESULT;
@ -363,11 +371,15 @@ public abstract class InventoryView {
type = InventoryType.SlotType.CRAFTING;
}
break;
case BEACON:
type = InventoryType.SlotType.CRAFTING;
case STONECUTTER:
if (slot == 1) {
type = InventoryType.SlotType.RESULT;
} else {
type = InventoryType.SlotType.CRAFTING;
}
break;
case ANVIL:
if (slot == 2) {
case LOOM:
if (slot == 3) {
type = InventoryType.SlotType.RESULT;
} else {
type = InventoryType.SlotType.CRAFTING;