cn.nukkit.blockentity.BlockEntityBrewingStand Java Examples

The following examples show how to use cn.nukkit.blockentity.BlockEntityBrewingStand. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Server.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
private void registerBlockEntities() {
    BlockEntity.registerBlockEntity(BlockEntity.FURNACE, BlockEntityFurnace.class);
    BlockEntity.registerBlockEntity(BlockEntity.CHEST, BlockEntityChest.class);
    BlockEntity.registerBlockEntity(BlockEntity.SIGN, BlockEntitySign.class);
    BlockEntity.registerBlockEntity(BlockEntity.ENCHANT_TABLE, BlockEntityEnchantTable.class);
    BlockEntity.registerBlockEntity(BlockEntity.SKULL, BlockEntitySkull.class);
    BlockEntity.registerBlockEntity(BlockEntity.FLOWER_POT, BlockEntityFlowerPot.class);
    BlockEntity.registerBlockEntity(BlockEntity.BREWING_STAND, BlockEntityBrewingStand.class);
    BlockEntity.registerBlockEntity(BlockEntity.ITEM_FRAME, BlockEntityItemFrame.class);
    BlockEntity.registerBlockEntity(BlockEntity.CAULDRON, BlockEntityCauldron.class);
    BlockEntity.registerBlockEntity(BlockEntity.ENDER_CHEST, BlockEntityEnderChest.class);
    BlockEntity.registerBlockEntity(BlockEntity.BEACON, BlockEntityBeacon.class);
    BlockEntity.registerBlockEntity(BlockEntity.SHULKER_BOX, BlockEntityShulkerBox.class);
    BlockEntity.registerBlockEntity(BlockEntity.MOB_SPAWNER, BlockEntityMobSpawner.class);
    BlockEntity.registerBlockEntity(BlockEntity.DISPENSER, BlockEntityDispenser.class);
    BlockEntity.registerBlockEntity(BlockEntity.DROPPER, BlockEntityDropper.class);
    BlockEntity.registerBlockEntity(BlockEntity.COMMAND_BLOCK, BlockEntityCommandBlock.class);
    BlockEntity.registerBlockEntity(BlockEntity.BANNER, BlockEntityBanner.class);
}
 
Example #2
Source File: BlockBrewingStand.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
    if (!block.down().isTransparent()) {
        getLevel().setBlock(block, this, true, true);

        CompoundTag nbt = new CompoundTag()
                .putList(new ListTag<>("Items"))
                .putString("id", BlockEntity.BREWING_STAND)
                .putInt("x", (int) this.x)
                .putInt("y", (int) this.y)
                .putInt("z", (int) this.z);

        if (item.hasCustomName()) {
            nbt.putString("CustomName", item.getCustomName());
        }

        if (item.hasCustomBlockData()) {
            Map<String, Tag> customData = item.getCustomBlockData().getTags();
            for (Map.Entry<String, Tag> tag : customData.entrySet()) {
                nbt.put(tag.getKey(), tag.getValue());
            }
        }

        new BlockEntityBrewingStand(getLevel().getChunk((int) this.x >> 4, (int) this.z >> 4), nbt);

        return true;
    }
    return false;
}
 
Example #3
Source File: BlockBrewingStand.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getComparatorInputOverride() {
    BlockEntity blockEntity = this.level.getBlockEntity(this);

    if (blockEntity instanceof BlockEntityBrewingStand) {
        return ContainerInventory.calculateRedstone(((BlockEntityBrewingStand) blockEntity).getInventory());
    }

    return super.getComparatorInputOverride();
}
 
Example #4
Source File: StartBrewEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public StartBrewEvent(BlockEntityBrewingStand blockEntity) {
    super(blockEntity.getInventory());
    this.brewingStand = blockEntity;

    this.ingredient = blockEntity.getInventory().getIngredient();

    this.potions = new Item[3];
    for (int i = 0; i < 3; i++) {
        this.potions[i] = blockEntity.getInventory().getItem(i);
    }
}
 
Example #5
Source File: BlockBrewingStand.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
    if (!block.down().isTransparent()) {
        getLevel().setBlock(block, this, true, true);

        CompoundTag nbt = new CompoundTag()
                .putList(new ListTag<>("Items"))
                .putString("id", BlockEntity.BREWING_STAND)
                .putInt("x", (int) this.x)
                .putInt("y", (int) this.y)
                .putInt("z", (int) this.z);

        if (item.hasCustomName()) {
            nbt.putString("CustomName", item.getCustomName());
        }

        if (item.hasCustomBlockData()) {
            Map<String, Tag> customData = item.getCustomBlockData().getTags();
            for (Map.Entry<String, Tag> tag : customData.entrySet()) {
                nbt.put(tag.getKey(), tag.getValue());
            }
        }

        BlockEntityBrewingStand brewing = (BlockEntityBrewingStand) BlockEntity.createBlockEntity(BlockEntity.BREWING_STAND, getLevel().getChunk((int) this.x >> 4, (int) this.z >> 4), nbt);
        return brewing != null;
    }
    return false;
}
 
Example #6
Source File: BlockBrewingStand.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getComparatorInputOverride() {
    BlockEntity blockEntity = this.level.getBlockEntity(this);

    if (blockEntity instanceof BlockEntityBrewingStand) {
        return ContainerInventory.calculateRedstone(((BlockEntityBrewingStand) blockEntity).getInventory());
    }

    return super.getComparatorInputOverride();
}
 
Example #7
Source File: BrewEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public BrewEvent(BlockEntityBrewingStand blockEntity) {
    super(blockEntity.getInventory());
    this.brewingStand = blockEntity;
    this.fuel = blockEntity.fuelAmount;

    this.ingredient = blockEntity.getInventory().getIngredient();

    this.potions = new Item[3];
    for (int i = 0; i < 3; i++) {
        this.potions[i] = blockEntity.getInventory().getItem(i);
    }
}
 
Example #8
Source File: BrewEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public BrewEvent(BlockEntityBrewingStand blockEntity) {
    super(blockEntity.getInventory());
    this.brewingStand = blockEntity;
    this.fuel = blockEntity.fuelAmount;

    this.ingredient = blockEntity.getInventory().getIngredient();

    this.potions = new Item[3];
    for (int i = 0; i < 3; i++) {
        this.potions[i] = blockEntity.getInventory().getItem(i);
    }
}
 
Example #9
Source File: StartBrewEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public StartBrewEvent(BlockEntityBrewingStand blockEntity) {
    super(blockEntity.getInventory());
    this.brewingStand = blockEntity;

    this.ingredient = blockEntity.getInventory().getIngredient();

    this.potions = new Item[3];
    for (int i = 0; i < 3; i++) {
        this.potions[i] = blockEntity.getInventory().getItem(i);
    }
}
 
Example #10
Source File: BlockBrewingStand.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
    if (!block.down().isTransparent()) {
        getLevel().setBlock(block, this, true, true);

        CompoundTag nbt = new CompoundTag()
                .putList(new ListTag<>("Items"))
                .putString("id", BlockEntity.BREWING_STAND)
                .putInt("x", (int) this.x)
                .putInt("y", (int) this.y)
                .putInt("z", (int) this.z);

        if (item.hasCustomName()) {
            nbt.putString("CustomName", item.getCustomName());
        }

        if (item.hasCustomBlockData()) {
            Map<String, Tag> customData = item.getCustomBlockData().getTags();
            for (Map.Entry<String, Tag> tag : customData.entrySet()) {
                nbt.put(tag.getKey(), tag.getValue());
            }
        }

        new BlockEntityBrewingStand(getLevel().getChunk((int) this.x >> 4, (int) this.z >> 4), nbt);

        return true;
    }
    return false;
}
 
Example #11
Source File: BlockBrewingStand.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getComparatorInputOverride() {
    BlockEntity blockEntity = this.level.getBlockEntity(this);

    if (blockEntity instanceof BlockEntityBrewingStand) {
        return ContainerInventory.calculateRedstone(((BlockEntityBrewingStand) blockEntity).getInventory());
    }

    return super.getComparatorInputOverride();
}
 
Example #12
Source File: StartBrewEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityBrewingStand getBrewingStand() {
    return brewingStand;
}
 
Example #13
Source File: BrewEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityBrewingStand getBrewingStand() {
    return brewingStand;
}
 
Example #14
Source File: BrewingInventory.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BlockEntityBrewingStand getHolder() {
    return (BlockEntityBrewingStand) this.holder;
}
 
Example #15
Source File: BrewingInventory.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BrewingInventory(BlockEntityBrewingStand brewingStand) {
    super(brewingStand, InventoryType.BREWING_STAND);
}
 
Example #16
Source File: StartBrewEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityBrewingStand getBrewingStand() {
    return brewingStand;
}
 
Example #17
Source File: BrewEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityBrewingStand getBrewingStand() {
    return brewingStand;
}
 
Example #18
Source File: BrewingInventory.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BlockEntityBrewingStand getHolder() {
    return (BlockEntityBrewingStand) this.holder;
}
 
Example #19
Source File: BrewingInventory.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BrewingInventory(BlockEntityBrewingStand brewingStand) {
    super(brewingStand, InventoryType.BREWING_STAND);
}
 
Example #20
Source File: BrewingInventory.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BlockEntityBrewingStand getHolder() {
    return (BlockEntityBrewingStand) this.holder;
}
 
Example #21
Source File: BrewingInventory.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public BrewingInventory(BlockEntityBrewingStand brewingStand) {
    super(brewingStand, InventoryType.BREWING_STAND);
}