Search in sources :

Example 1 with SimpleBlockBreakHandler

use of io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler in project Slimefun4 by Slimefun.

the class AncientPedestal method onBreak.

@Nonnull
private BlockBreakHandler onBreak() {
    return new SimpleBlockBreakHandler() {

        @Override
        public void onBlockBreak(@Nonnull Block b) {
            Optional<Item> entity = getPlacedItem(b);
            if (entity.isPresent()) {
                Item stack = entity.get();
                if (stack.isValid()) {
                    stack.removeMetadata("no_pickup", Slimefun.instance());
                    b.getWorld().dropItem(b.getLocation(), getOriginalItemStack(stack));
                    stack.remove();
                }
            }
        }
    };
}
Also used : Item(org.bukkit.entity.Item) SimpleSlimefunItem(io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem) Nonnull(javax.annotation.Nonnull) Block(org.bukkit.block.Block) SimpleBlockBreakHandler(io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler) Nonnull(javax.annotation.Nonnull)

Example 2 with SimpleBlockBreakHandler

use of io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler in project Slimefun4 by Slimefun.

the class GEOMiner method onBlockBreak.

@Nonnull
private BlockBreakHandler onBlockBreak() {
    return new SimpleBlockBreakHandler() {

        @Override
        public void onBlockBreak(@Nonnull Block b) {
            removeHologram(b);
            BlockMenu inv = BlockStorage.getInventory(b);
            if (inv != null) {
                inv.dropItems(b.getLocation(), OUTPUT_SLOTS);
            }
            processor.endOperation(b);
        }
    };
}
Also used : BlockMenu(me.mrCookieSlime.Slimefun.api.inventory.BlockMenu) Nonnull(javax.annotation.Nonnull) Block(org.bukkit.block.Block) InventoryBlock(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock) SimpleBlockBreakHandler(io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler) Nonnull(javax.annotation.Nonnull)

Example 3 with SimpleBlockBreakHandler

use of io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler in project Slimefun4 by Slimefun.

the class AGenerator method onBlockBreak.

@Nonnull
protected BlockBreakHandler onBlockBreak() {
    return new SimpleBlockBreakHandler() {

        @Override
        public void onBlockBreak(Block b) {
            BlockMenu inv = BlockStorage.getInventory(b);
            if (inv != null) {
                inv.dropItems(b.getLocation(), getInputSlots());
                inv.dropItems(b.getLocation(), getOutputSlots());
            }
            processor.endOperation(b);
        }
    };
}
Also used : BlockMenu(me.mrCookieSlime.Slimefun.api.inventory.BlockMenu) Block(org.bukkit.block.Block) SimpleBlockBreakHandler(io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler) Nonnull(javax.annotation.Nonnull)

Example 4 with SimpleBlockBreakHandler

use of io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler in project DynaTech by ProfElements.

the class AMachineGenerator method onBreak.

private BlockBreakHandler onBreak() {
    return new SimpleBlockBreakHandler() {

        @Override
        public void onBlockBreak(Block b) {
            BlockMenu inv = BlockStorage.getInventory(b);
            if (inv != null) {
                inv.dropItems(b.getLocation(), getInputSlots());
                inv.dropItems(b.getLocation(), getOutputSlots());
            }
            processing.remove(b);
            progress.remove(b);
        }
    };
}
Also used : BlockMenu(me.mrCookieSlime.Slimefun.api.inventory.BlockMenu) Block(org.bukkit.block.Block) SimpleBlockBreakHandler(io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler)

Example 5 with SimpleBlockBreakHandler

use of io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler in project BedrockTechnology by CTimet.

the class BektAContainerOneSlot method onBlockBreak.

protected BlockBreakHandler onBlockBreak() {
    return new SimpleBlockBreakHandler() {

        @Override
        public void onBlockBreak(Block b) {
            BlockMenu inv = BlockStorage.getInventory(b);
            if (inv != null) {
                // inv.dropItems(b.getLocation(), getInputSlots());
                inv.dropItems(b.getLocation(), getOutputSlots());
            }
            processor.endOperation(b);
        }
    };
}
Also used : BlockMenu(me.mrCookieSlime.Slimefun.api.inventory.BlockMenu) Block(org.bukkit.block.Block) InventoryBlock(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock) SimpleBlockBreakHandler(io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler)

Aggregations

SimpleBlockBreakHandler (io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler)14 Block (org.bukkit.block.Block)14 BlockMenu (me.mrCookieSlime.Slimefun.api.inventory.BlockMenu)13 Nonnull (javax.annotation.Nonnull)10 InventoryBlock (me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock)6 InventoryBlock (dev.j3fftw.extrautils.interfaces.InventoryBlock)1 SimpleSlimefunItem (io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem)1 Item (org.bukkit.entity.Item)1