use of cn.nukkit.blockentity.BlockEntityHopper in project Nukkit by Nukkit.
the class BlockHopper method place.
@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
BlockFace facing = face.getOpposite();
if (facing == BlockFace.UP) {
facing = BlockFace.DOWN;
}
this.setDamage(facing.getIndex());
boolean powered = this.level.isBlockPowered(this);
if (powered == this.isEnabled()) {
this.setEnabled(!powered);
}
this.level.setBlock(this, this);
CompoundTag nbt = new CompoundTag().putList(new ListTag<>("Items")).putString("id", BlockEntity.HOPPER).putInt("x", (int) this.x).putInt("y", (int) this.y).putInt("z", (int) this.z);
new BlockEntityHopper(this.level.getChunk(this.getFloorX() >> 4, this.getFloorZ() >> 4), nbt);
return true;
}
Aggregations