use of org.lanternpowered.server.inventory.carrier.LanternBlockCarrier in project LanternServer by LanternPowered.
the class CraftingTableInteractionBehavior method tryInteract.
@Override
public BehaviorResult tryInteract(BehaviorPipeline<Behavior> pipeline, BehaviorContext context) {
final Optional<Player> optPlayer = context.getContext(ContextKeys.PLAYER);
if (optPlayer.isPresent()) {
final CraftingTableInventory craftingTableInventory = VanillaInventoryArchetypes.CRAFTING_TABLE.builder().withCarrier(new LanternBlockCarrier(context.requireContext(ContextKeys.BLOCK_LOCATION))).build(Lantern.getMinecraftPlugin());
final Optional<Container> optContainer = optPlayer.get().openInventory(craftingTableInventory);
if (optContainer.isPresent()) {
return BehaviorResult.SUCCESS;
}
}
return BehaviorResult.PASS;
}
Aggregations