Search in sources :

Example 71 with GlowBlock

use of net.glowstone.block.GlowBlock in project Glowstone by GlowstoneMC.

the class GlowDispenser method dispense.

@Override
public boolean dispense() {
    GlowBlock block = getBlock();
    int dispenseSlot = getDispenseSlot();
    if (dispenseSlot < 0) {
        block.getWorld().playEffect(block.getLocation(), Effect.CLICK1, 0);
        return false;
    }
    ItemStack origItems = getInventory().getItem(dispenseSlot);
    DispenseBehavior behavior = getDispenseBehaviorRegistry().getBehavior(origItems.getType());
    ItemStack result = behavior.dispense(block, origItems);
    getInventory().setItem(dispenseSlot, result);
    return true;
}
Also used : GlowBlock(net.glowstone.block.GlowBlock) ItemStack(org.bukkit.inventory.ItemStack)

Example 72 with GlowBlock

use of net.glowstone.block.GlowBlock in project Glowstone by GlowstoneMC.

the class BlockStateDelegate method backupBlockState.

/**
     * Backups a block state.
     *
     * @param block the block which state should be backup
     */
public void backupBlockState(Block block) {
    blockStateMap.remove(block.getLocation());
    blockStateBackupMap.put(block.getLocation(), new GlowBlockState((GlowBlock) block));
}
Also used : GlowBlock(net.glowstone.block.GlowBlock) GlowBlockState(net.glowstone.block.GlowBlockState)

Aggregations

GlowBlock (net.glowstone.block.GlowBlock)72 BlockFace (org.bukkit.block.BlockFace)23 GlowBlockState (net.glowstone.block.GlowBlockState)21 Block (org.bukkit.block.Block)16 GlowWorld (net.glowstone.GlowWorld)14 MaterialData (org.bukkit.material.MaterialData)13 ItemTable (net.glowstone.block.ItemTable)10 BlockType (net.glowstone.block.blocktype.BlockType)7 ItemType (net.glowstone.block.itemtype.ItemType)7 Material (org.bukkit.Material)7 Vector (org.bukkit.util.Vector)7 BlockEntity (net.glowstone.block.entity.BlockEntity)6 ItemStack (org.bukkit.inventory.ItemStack)6 BlockVector (org.bukkit.util.BlockVector)5 Message (com.flowpowered.network.Message)4 IOException (java.io.IOException)4 GlowPlayer (net.glowstone.entity.GlowPlayer)4 Title (com.destroystokyo.paper.Title)3 ByteBufUtils (com.flowpowered.network.util.ByteBufUtils)3 Preconditions (com.google.common.base.Preconditions)3