Search in sources :

Example 1 with EnderChestBlockEntity

use of net.minecraft.world.level.block.entity.EnderChestBlockEntity in project UltraCosmetics by iSach.

the class EntityUtil method playChestAnimation.

@Override
public void playChestAnimation(Block b, boolean open, TreasureChestDesign design) {
    Location location = b.getLocation();
    Level world = ((CraftWorld) location.getWorld()).getHandle();
    BlockPos position = new BlockPos(location.getX(), location.getY(), location.getZ());
    if (design.getChestType() == ChestType.ENDER) {
        EnderChestBlockEntity tileChest = (EnderChestBlockEntity) world.getBlockEntity(position);
        world.blockEvent(position, tileChest.getBlockState().getBlock(), 1, open ? 1 : 0);
    } else {
        ChestBlockEntity tileChest = (ChestBlockEntity) world.getBlockEntity(position);
        world.blockEvent(position, tileChest.getBlockState().getBlock(), 1, open ? 1 : 0);
    }
}
Also used : ChestBlockEntity(net.minecraft.world.level.block.entity.ChestBlockEntity) EnderChestBlockEntity(net.minecraft.world.level.block.entity.EnderChestBlockEntity) EnderChestBlockEntity(net.minecraft.world.level.block.entity.EnderChestBlockEntity) Level(net.minecraft.world.level.Level) BlockPos(net.minecraft.core.BlockPos) CraftWorld(org.bukkit.craftbukkit.v1_18_R2.CraftWorld) Location(org.bukkit.Location)

Example 2 with EnderChestBlockEntity

use of net.minecraft.world.level.block.entity.EnderChestBlockEntity in project UltraCosmetics by iSach.

the class EntityUtil method playChestAnimation.

@Override
public void playChestAnimation(Block b, boolean open, TreasureChestDesign design) {
    Location location = b.getLocation();
    Level world = ((CraftWorld) location.getWorld()).getHandle();
    BlockPos position = new BlockPos(location.getX(), location.getY(), location.getZ());
    if (design.getChestType() == ChestType.ENDER) {
        EnderChestBlockEntity tileChest = (EnderChestBlockEntity) world.getBlockEntity(position);
        world.blockEvent(position, tileChest.getBlockState().getBlock(), 1, open ? 1 : 0);
    } else {
        ChestBlockEntity tileChest = (ChestBlockEntity) world.getBlockEntity(position);
        world.blockEvent(position, tileChest.getBlockState().getBlock(), 1, open ? 1 : 0);
    }
}
Also used : ChestBlockEntity(net.minecraft.world.level.block.entity.ChestBlockEntity) EnderChestBlockEntity(net.minecraft.world.level.block.entity.EnderChestBlockEntity) EnderChestBlockEntity(net.minecraft.world.level.block.entity.EnderChestBlockEntity) Level(net.minecraft.world.level.Level) BlockPos(net.minecraft.core.BlockPos) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld) Location(org.bukkit.Location)

Aggregations

BlockPos (net.minecraft.core.BlockPos)2 Level (net.minecraft.world.level.Level)2 ChestBlockEntity (net.minecraft.world.level.block.entity.ChestBlockEntity)2 EnderChestBlockEntity (net.minecraft.world.level.block.entity.EnderChestBlockEntity)2 Location (org.bukkit.Location)2 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)1 CraftWorld (org.bukkit.craftbukkit.v1_18_R2.CraftWorld)1