Add inventory and slot types for new containers. Fixes BUKKIT-2741

This commit is contained in:
Travis Watkins 2012-10-31 12:14:39 -05:00 committed by EvilSeph
parent 347fd3cb6e
commit 87a1cd3d43
3 changed files with 22 additions and 0 deletions

View File

@ -109,6 +109,12 @@ public class CraftContainer extends Container {
case BREWING:
typeID = 5;
break;
case BEACON:
typeID = 7;
break;
case ANVIL:
typeID = 8;
break;
default:
typeID = 0;
break;

View File

@ -4,12 +4,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import net.minecraft.server.ContainerAnvilInventory;
import net.minecraft.server.ContainerEnchantTableInventory;
import net.minecraft.server.IInventory;
import net.minecraft.server.InventoryCrafting;
import net.minecraft.server.InventoryEnderChest;
import net.minecraft.server.InventoryMerchant;
import net.minecraft.server.PlayerInventory;
import net.minecraft.server.TileEntityBeacon;
import net.minecraft.server.TileEntityBrewingStand;
import net.minecraft.server.TileEntityDispenser;
import net.minecraft.server.TileEntityFurnace;
@ -416,6 +418,10 @@ public class CraftInventory implements Inventory {
return InventoryType.ENDER_CHEST;
} else if (inventory instanceof InventoryMerchant) {
return InventoryType.MERCHANT;
} else if (inventory instanceof TileEntityBeacon) {
return InventoryType.BEACON;
} else if (inventory instanceof ContainerAnvilInventory) {
return InventoryType.ANVIL;
} else {
return InventoryType.CHEST;
}

View File

@ -109,6 +109,16 @@ public class CraftInventoryView extends InventoryView {
type = SlotType.CRAFTING;
}
break;
case BEACON:
type = SlotType.CRAFTING;
break;
case ANVIL:
if (slot == 2) {
type = SlotType.RESULT;
} else {
type = SlotType.CRAFTING;
}
break;
default:
// Nothing to do, it's a CONTAINER slot
}