Search in sources :

Example 1 with TileEntity

use of net.minecraft.world.level.block.entity.TileEntity in project dynmap by webbukkit.

the class BukkitVersionHelperSpigot117 method readTileEntityNBT.

@Override
public Object readTileEntityNBT(Object te) {
    TileEntity tileent = (TileEntity) te;
    NBTTagCompound nbt = new NBTTagCompound();
    // readNBT
    tileent.save(nbt);
    return nbt;
}
Also used : TileEntity(net.minecraft.world.level.block.entity.TileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 2 with TileEntity

use of net.minecraft.world.level.block.entity.TileEntity in project dynmap by webbukkit.

the class BukkitVersionHelperSpigot118 method readTileEntityNBT.

@Override
public Object readTileEntityNBT(Object te) {
    TileEntity tileent = (TileEntity) te;
    NBTTagCompound nbt = tileent.n();
    return nbt;
}
Also used : TileEntity(net.minecraft.world.level.block.entity.TileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 3 with TileEntity

use of net.minecraft.world.level.block.entity.TileEntity in project dynmap by webbukkit.

the class BukkitVersionHelperSpigot118_2 method readTileEntityNBT.

@Override
public Object readTileEntityNBT(Object te) {
    TileEntity tileent = (TileEntity) te;
    NBTTagCompound nbt = tileent.n();
    return nbt;
}
Also used : TileEntity(net.minecraft.world.level.block.entity.TileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 4 with TileEntity

use of net.minecraft.world.level.block.entity.TileEntity in project WildChests by BG-Software-LLC.

the class NMSInventory_v1_17_R1 method updateTileEntity.

@Override
public void updateTileEntity(Chest chest) {
    Location loc = chest.getLocation();
    World world = ((CraftWorld) loc.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    TileEntity tileEntity = world.getTileEntity(blockPosition);
    TileEntityWildChest tileEntityWildChest;
    if (tileEntity instanceof TileEntityWildChest) {
        tileEntityWildChest = (TileEntityWildChest) tileEntity;
        ((WChest) chest).setTileEntityContainer(tileEntityWildChest);
    } else {
        tileEntityWildChest = new TileEntityWildChest(chest, world, blockPosition);
        world.removeTileEntity(blockPosition);
        world.setTileEntity(tileEntityWildChest);
        Chunk chunk = world.getChunkAtWorldCoords(blockPosition);
        world.a(CREATE_TICKING_BLOCK.invoke(chunk, tileEntityWildChest, tileEntityWildChest));
    }
}
Also used : TileEntity(net.minecraft.world.level.block.entity.TileEntity) BlockPosition(net.minecraft.core.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld) World(net.minecraft.world.level.World) WChest(com.bgsoftware.wildchests.objects.chests.WChest) Chunk(net.minecraft.world.level.chunk.Chunk) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld) Location(org.bukkit.Location)

Example 5 with TileEntity

use of net.minecraft.world.level.block.entity.TileEntity in project WildChests by BG-Software-LLC.

the class NMSInventory_v1_17_R1 method removeTileEntity.

@Override
public void removeTileEntity(Chest chest) {
    Location loc = chest.getLocation();
    World world = ((CraftWorld) loc.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    TileEntity currentTileEntity = world.getTileEntity(blockPosition);
    if (currentTileEntity instanceof TileEntityWildChest)
        world.removeTileEntity(blockPosition);
}
Also used : TileEntity(net.minecraft.world.level.block.entity.TileEntity) BlockPosition(net.minecraft.core.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld) World(net.minecraft.world.level.World) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld) Location(org.bukkit.Location)

Aggregations

TileEntity (net.minecraft.world.level.block.entity.TileEntity)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 BlockPosition (net.minecraft.core.BlockPosition)2 World (net.minecraft.world.level.World)2 Location (org.bukkit.Location)2 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)2 WChest (com.bgsoftware.wildchests.objects.chests.WChest)1 Chunk (net.minecraft.world.level.chunk.Chunk)1