mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Added Loom blocks
these don't support doing patterns yet, but their inventories work.
This commit is contained in:
@ -29,6 +29,7 @@ use pocketmine\block\inventory\BrewingStandInventory;
|
||||
use pocketmine\block\inventory\EnchantInventory;
|
||||
use pocketmine\block\inventory\FurnaceInventory;
|
||||
use pocketmine\block\inventory\HopperInventory;
|
||||
use pocketmine\block\inventory\LoomInventory;
|
||||
use pocketmine\inventory\CreativeInventory;
|
||||
use pocketmine\inventory\Inventory;
|
||||
use pocketmine\inventory\transaction\action\SlotChangeAction;
|
||||
@ -161,6 +162,8 @@ class InventoryManager{
|
||||
//if the class isn't final, not to mention being inflexible.
|
||||
if($inv instanceof BlockInventory){
|
||||
switch(true){
|
||||
case $inv instanceof LoomInventory:
|
||||
return [ContainerOpenPacket::blockInvVec3($id, WindowTypes::LOOM, $inv->getHolder())];
|
||||
case $inv instanceof FurnaceInventory:
|
||||
//TODO: specialized furnace types
|
||||
return [ContainerOpenPacket::blockInvVec3($id, WindowTypes::FURNACE, $inv->getHolder())];
|
||||
|
@ -25,6 +25,7 @@ namespace pocketmine\network\mcpe\convert;
|
||||
use pocketmine\block\BlockLegacyIds;
|
||||
use pocketmine\block\inventory\AnvilInventory;
|
||||
use pocketmine\block\inventory\EnchantInventory;
|
||||
use pocketmine\block\inventory\LoomInventory;
|
||||
use pocketmine\crafting\CraftingGrid;
|
||||
use pocketmine\inventory\Inventory;
|
||||
use pocketmine\inventory\transaction\action\CreateItemAction;
|
||||
@ -266,7 +267,9 @@ class TypeConverter{
|
||||
$this->mapUIInventory($pSlot, UIInventorySlotOffset::ANVIL, $current,
|
||||
function(Inventory $i) : bool{ return $i instanceof AnvilInventory; }) ??
|
||||
$this->mapUIInventory($pSlot, UIInventorySlotOffset::ENCHANTING_TABLE, $current,
|
||||
function(Inventory $i) : bool{ return $i instanceof EnchantInventory; });
|
||||
function(Inventory $i) : bool{ return $i instanceof EnchantInventory; }) ??
|
||||
$this->mapUIInventory($pSlot, UIInventorySlotOffset::LOOM, $current,
|
||||
fn(Inventory $i) => $i instanceof LoomInventory);
|
||||
}
|
||||
if($mapped === null){
|
||||
throw new \UnexpectedValueException("Unmatched UI inventory slot offset $pSlot");
|
||||
|
@ -277,6 +277,7 @@ class InGamePacketHandler extends PacketHandler{
|
||||
|
||||
if($isCraftingPart){
|
||||
if($this->craftingTransaction === null){
|
||||
//TODO: this might not be crafting if there is a special inventory open (anvil, enchanting, loom etc)
|
||||
$this->craftingTransaction = new CraftingTransaction($this->player, $this->player->getServer()->getCraftingManager(), $actions);
|
||||
}else{
|
||||
foreach($actions as $action){
|
||||
|
Reference in New Issue
Block a user