cn.nukkit.blockentity.BlockEntityFurnace Java Examples

The following examples show how to use cn.nukkit.blockentity.BlockEntityFurnace. 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: BlockFurnaceBurning.java    From Nukkit with GNU General Public License v3.0 6 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) {
    int[] faces = {2, 5, 3, 4};
    this.setDamage(faces[player != null ? player.getDirection().getHorizontalIndex() : 0]);
    this.getLevel().setBlock(block, this, true, true);
    CompoundTag nbt = new CompoundTag()
            .putList(new ListTag<>("Items"))
            .putString("id", BlockEntity.FURNACE)
            .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());
        }
    }

    BlockEntityFurnace furnace = (BlockEntityFurnace) BlockEntity.createBlockEntity(BlockEntity.FURNACE, this.getLevel().getChunk((int) (this.x) >> 4, (int) (this.z) >> 4), nbt);
    return furnace != null;
}
 
Example #3
Source File: BlockFurnaceBurning.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) {
    int faces[] = {4, 2, 5, 3};
    this.meta = faces[player != null ? player.getDirection().getHorizontalIndex() : 0];
    this.getLevel().setBlock(block, this, true, true);
    CompoundTag nbt = new CompoundTag()
            .putList(new ListTag<>("Items"))
            .putString("id", BlockEntity.FURNACE)
            .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 BlockEntityFurnace(this.getLevel().getChunk((int) (this.x) >> 4, (int) (this.z) >> 4), nbt);

    return true;
}
 
Example #4
Source File: BlockFurnaceBurning.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 BlockEntityFurnace) {
        return ContainerInventory.calculateRedstone(((BlockEntityFurnace) blockEntity).getInventory());
    }

    return super.getComparatorInputOverride();
}
 
Example #5
Source File: FurnaceSmeltEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public FurnaceSmeltEvent(BlockEntityFurnace furnace, Item source, Item result) {
    super(furnace.getBlock());
    this.source = source.clone();
    this.source.setCount(1);
    this.result = result;
    this.furnace = furnace;
}
 
Example #6
Source File: FurnaceSmeltEvent.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public FurnaceSmeltEvent(BlockEntityFurnace furnace, Item source, Item result) {
    super(furnace.getBlock());
    this.source = source.clone();
    this.source.setCount(1);
    this.result = result;
    this.furnace = furnace;
}
 
Example #7
Source File: BlockFurnaceBurning.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 BlockEntityFurnace) {
        return ContainerInventory.calculateRedstone(((BlockEntityFurnace) blockEntity).getInventory());
    }

    return super.getComparatorInputOverride();
}
 
Example #8
Source File: BlockFurnaceBurning.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 BlockEntityFurnace) {
        return ContainerInventory.calculateRedstone(((BlockEntityFurnace) blockEntity).getInventory());
    }

    return super.getComparatorInputOverride();
}
 
Example #9
Source File: BlockFurnaceBurning.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) {
    int faces[] = {2, 5, 3, 4};
    this.setDamage(faces[player != null ? player.getDirection().getHorizontalIndex() : 0]);
    this.getLevel().setBlock(block, this, true, true);
    CompoundTag nbt = new CompoundTag()
            .putList(new ListTag<>("Items"))
            .putString("id", BlockEntity.FURNACE)
            .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 BlockEntityFurnace(this.getLevel().getChunk((int) (this.x) >> 4, (int) (this.z) >> 4), nbt);

    return true;
}
 
Example #10
Source File: FurnaceSmeltEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public FurnaceSmeltEvent(BlockEntityFurnace furnace, Item source, Item result) {
    super(furnace.getBlock());
    this.source = source.clone();
    this.source.setCount(1);
    this.result = result;
    this.furnace = furnace;
}
 
Example #11
Source File: FurnaceSmeltEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityFurnace getFurnace() {
    return furnace;
}
 
Example #12
Source File: FurnaceBurnEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityFurnace getFurnace() {
    return furnace;
}
 
Example #13
Source File: FurnaceBurnEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public FurnaceBurnEvent(BlockEntityFurnace furnace, Item fuel, short burnTime) {
    super(furnace.getBlock());
    this.fuel = fuel;
    this.burnTime = burnTime;
    this.furnace = furnace;
}
 
Example #14
Source File: FurnaceInventory.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BlockEntityFurnace getHolder() {
    return (BlockEntityFurnace) this.holder;
}
 
Example #15
Source File: FurnaceInventory.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public FurnaceInventory(BlockEntityFurnace furnace) {
    super(furnace, InventoryType.FURNACE);
}
 
Example #16
Source File: FurnaceSmeltEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityFurnace getFurnace() {
    return furnace;
}
 
Example #17
Source File: FurnaceBurnEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityFurnace getFurnace() {
    return furnace;
}
 
Example #18
Source File: FurnaceBurnEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public FurnaceBurnEvent(BlockEntityFurnace furnace, Item fuel, short burnTime) {
    super(furnace.getBlock());
    this.fuel = fuel;
    this.burnTime = burnTime;
    this.furnace = furnace;
}
 
Example #19
Source File: FurnaceInventory.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BlockEntityFurnace getHolder() {
    return (BlockEntityFurnace) this.holder;
}
 
Example #20
Source File: FurnaceInventory.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public FurnaceInventory(BlockEntityFurnace furnace) {
    super(furnace, InventoryType.FURNACE);
}
 
Example #21
Source File: FurnaceSmeltEvent.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityFurnace getFurnace() {
    return furnace;
}
 
Example #22
Source File: FurnaceBurnEvent.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public BlockEntityFurnace getFurnace() {
    return furnace;
}
 
Example #23
Source File: FurnaceBurnEvent.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public FurnaceBurnEvent(BlockEntityFurnace furnace, Item fuel, short burnTime) {
    super(furnace.getBlock());
    this.fuel = fuel;
    this.burnTime = burnTime;
    this.furnace = furnace;
}
 
Example #24
Source File: FurnaceInventory.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BlockEntityFurnace getHolder() {
    return (BlockEntityFurnace) this.holder;
}
 
Example #25
Source File: FurnaceInventory.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public FurnaceInventory(BlockEntityFurnace furnace) {
    super(furnace, InventoryType.FURNACE);
}