Search in sources :

Example 1 with BaphometScreenHandler

use of moriyashiine.bewitchment.client.screen.BaphometScreenHandler in project bewitchment by MoriyaShiine.

the class BaphometEntity method interactMob.

@Override
protected ActionResult interactMob(PlayerEntity player, Hand hand) {
    if (!world.isClient && isAlive() && getTarget() == null && BewitchmentAPI.isPledged(player, getPledgeID())) {
        if (BWUtil.rejectTrades(this)) {
            return ActionResult.FAIL;
        }
        if (getCurrentCustomer() == null) {
            setCurrentCustomer(player);
        }
        if (!getOffers().isEmpty()) {
            SyncContractsPacket.send(player);
            player.openHandledScreen(new SimpleNamedScreenHandlerFactory((id, playerInventory, customer) -> new BaphometScreenHandler(id, this), getDisplayName())).ifPresent(syncId -> SyncDemonTradesPacket.send(player, this, syncId));
        } else {
            setCurrentCustomer(null);
        }
    }
    return ActionResult.success(world.isClient);
}
Also used : SimpleNamedScreenHandlerFactory(net.minecraft.screen.SimpleNamedScreenHandlerFactory) BaphometScreenHandler(moriyashiine.bewitchment.client.screen.BaphometScreenHandler)

Aggregations

BaphometScreenHandler (moriyashiine.bewitchment.client.screen.BaphometScreenHandler)1 SimpleNamedScreenHandlerFactory (net.minecraft.screen.SimpleNamedScreenHandlerFactory)1