Search in sources :

Example 1 with StackedSpawnerTileImpl

use of dev.rosewood.rosestacker.nms.v1_18_R1.spawner.StackedSpawnerTileImpl in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method injectStackedSpawnerTile.

@Override
public StackedSpawnerTile injectStackedSpawnerTile(Object stackedSpawnerObj) {
    StackedSpawner stackedSpawner = (StackedSpawner) stackedSpawnerObj;
    Block block = stackedSpawner.getBlock();
    ServerLevel level = ((CraftWorld) block.getWorld()).getHandle();
    BlockEntity blockEntity = level.getBlockEntity(new BlockPos(block.getX(), block.getY(), block.getZ()));
    if (blockEntity instanceof SpawnerBlockEntity) {
        SpawnerBlockEntity spawnerBlockEntity = (SpawnerBlockEntity) blockEntity;
        if (!(spawnerBlockEntity.getSpawner() instanceof StackedSpawnerTileImpl)) {
            StackedSpawnerTile stackedSpawnerTile = new StackedSpawnerTileImpl(spawnerBlockEntity.getSpawner(), spawnerBlockEntity, stackedSpawner);
            unsafe.putObject(spawnerBlockEntity, field_SpawnerBlockEntity_spawner_offset, stackedSpawnerTile);
            return stackedSpawnerTile;
        } else {
            StackedSpawnerTileImpl spawnerTile = (StackedSpawnerTileImpl) spawnerBlockEntity.getSpawner();
            spawnerTile.updateStackedSpawner(stackedSpawner);
            return spawnerTile;
        }
    }
    return null;
}
Also used : ServerLevel(net.minecraft.server.level.ServerLevel) SpawnerBlockEntity(net.minecraft.world.level.block.entity.SpawnerBlockEntity) StackedSpawner(dev.rosewood.rosestacker.stack.StackedSpawner) Block(org.bukkit.block.Block) BlockPos(net.minecraft.core.BlockPos) StackedSpawnerTileImpl(dev.rosewood.rosestacker.nms.v1_17_R1.spawner.StackedSpawnerTileImpl) StackedSpawnerTile(dev.rosewood.rosestacker.nms.spawner.StackedSpawnerTile) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld) SpawnerBlockEntity(net.minecraft.world.level.block.entity.SpawnerBlockEntity) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Example 2 with StackedSpawnerTileImpl

use of dev.rosewood.rosestacker.nms.v1_18_R1.spawner.StackedSpawnerTileImpl in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method injectStackedSpawnerTile.

@Override
public StackedSpawnerTile injectStackedSpawnerTile(Object stackedSpawnerObj) {
    StackedSpawner stackedSpawner = (StackedSpawner) stackedSpawnerObj;
    Block block = stackedSpawner.getBlock();
    WorldServer level = ((CraftWorld) block.getWorld()).getHandle();
    TileEntity blockEntity = level.getTileEntity(new BlockPosition(block.getX(), block.getY(), block.getZ()));
    if (blockEntity instanceof TileEntityMobSpawner) {
        TileEntityMobSpawner spawnerBlockEntity = (TileEntityMobSpawner) blockEntity;
        if (!(spawnerBlockEntity.getSpawner() instanceof StackedSpawnerTileImpl)) {
            StackedSpawnerTile stackedSpawnerTile = new StackedSpawnerTileImpl(spawnerBlockEntity.getSpawner(), spawnerBlockEntity, stackedSpawner);
            unsafe.putObject(spawnerBlockEntity, field_SpawnerBlockEntity_spawner_offset, stackedSpawnerTile);
            return stackedSpawnerTile;
        } else {
            StackedSpawnerTileImpl spawnerTile = (StackedSpawnerTileImpl) spawnerBlockEntity.getSpawner();
            spawnerTile.updateStackedSpawner(stackedSpawner);
            return spawnerTile;
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.server.v1_16_R2.TileEntity) StackedSpawner(dev.rosewood.rosestacker.stack.StackedSpawner) BlockPosition(net.minecraft.server.v1_16_R2.BlockPosition) Block(org.bukkit.block.Block) WorldServer(net.minecraft.server.v1_16_R2.WorldServer) TileEntityMobSpawner(net.minecraft.server.v1_16_R2.TileEntityMobSpawner) StackedSpawnerTileImpl(dev.rosewood.rosestacker.nms.v1_16_R2.spawner.StackedSpawnerTileImpl) StackedSpawnerTile(dev.rosewood.rosestacker.nms.spawner.StackedSpawnerTile) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld)

Example 3 with StackedSpawnerTileImpl

use of dev.rosewood.rosestacker.nms.v1_18_R1.spawner.StackedSpawnerTileImpl in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method injectStackedSpawnerTile.

@Override
public StackedSpawnerTile injectStackedSpawnerTile(Object stackedSpawnerObj) {
    StackedSpawner stackedSpawner = (StackedSpawner) stackedSpawnerObj;
    Block block = stackedSpawner.getBlock();
    ServerLevel level = ((CraftWorld) block.getWorld()).getHandle();
    BlockEntity blockEntity = level.getBlockEntity(new BlockPos(block.getX(), block.getY(), block.getZ()));
    if (blockEntity instanceof SpawnerBlockEntity) {
        SpawnerBlockEntity spawnerBlockEntity = (SpawnerBlockEntity) blockEntity;
        if (!(spawnerBlockEntity.getSpawner() instanceof StackedSpawnerTileImpl)) {
            StackedSpawnerTile stackedSpawnerTile = new StackedSpawnerTileImpl(spawnerBlockEntity.getSpawner(), spawnerBlockEntity, stackedSpawner);
            unsafe.putObject(spawnerBlockEntity, field_SpawnerBlockEntity_spawner_offset, stackedSpawnerTile);
            return stackedSpawnerTile;
        } else {
            StackedSpawnerTileImpl spawnerTile = (StackedSpawnerTileImpl) spawnerBlockEntity.getSpawner();
            spawnerTile.updateStackedSpawner(stackedSpawner);
            return spawnerTile;
        }
    }
    return null;
}
Also used : ServerLevel(net.minecraft.server.level.ServerLevel) SpawnerBlockEntity(net.minecraft.world.level.block.entity.SpawnerBlockEntity) StackedSpawner(dev.rosewood.rosestacker.stack.StackedSpawner) Block(org.bukkit.block.Block) BlockPos(net.minecraft.core.BlockPos) StackedSpawnerTileImpl(dev.rosewood.rosestacker.nms.v1_18_R2.spawner.StackedSpawnerTileImpl) StackedSpawnerTile(dev.rosewood.rosestacker.nms.spawner.StackedSpawnerTile) CraftWorld(org.bukkit.craftbukkit.v1_18_R2.CraftWorld) SpawnerBlockEntity(net.minecraft.world.level.block.entity.SpawnerBlockEntity) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Example 4 with StackedSpawnerTileImpl

use of dev.rosewood.rosestacker.nms.v1_18_R1.spawner.StackedSpawnerTileImpl in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method injectStackedSpawnerTile.

@Override
public StackedSpawnerTile injectStackedSpawnerTile(Object stackedSpawnerObj) {
    StackedSpawner stackedSpawner = (StackedSpawner) stackedSpawnerObj;
    Block block = stackedSpawner.getBlock();
    ServerLevel level = ((CraftWorld) block.getWorld()).getHandle();
    BlockEntity blockEntity = level.getBlockEntity(new BlockPos(block.getX(), block.getY(), block.getZ()));
    if (blockEntity instanceof SpawnerBlockEntity) {
        SpawnerBlockEntity spawnerBlockEntity = (SpawnerBlockEntity) blockEntity;
        if (!(spawnerBlockEntity.getSpawner() instanceof StackedSpawnerTileImpl)) {
            StackedSpawnerTile stackedSpawnerTile = new StackedSpawnerTileImpl(spawnerBlockEntity.getSpawner(), spawnerBlockEntity, stackedSpawner);
            unsafe.putObject(spawnerBlockEntity, field_SpawnerBlockEntity_spawner_offset, stackedSpawnerTile);
            return stackedSpawnerTile;
        } else {
            StackedSpawnerTileImpl spawnerTile = (StackedSpawnerTileImpl) spawnerBlockEntity.getSpawner();
            spawnerTile.updateStackedSpawner(stackedSpawner);
            return spawnerTile;
        }
    }
    return null;
}
Also used : ServerLevel(net.minecraft.server.level.ServerLevel) SpawnerBlockEntity(net.minecraft.world.level.block.entity.SpawnerBlockEntity) StackedSpawner(dev.rosewood.rosestacker.stack.StackedSpawner) Block(org.bukkit.block.Block) BlockPos(net.minecraft.core.BlockPos) StackedSpawnerTileImpl(dev.rosewood.rosestacker.nms.v1_18_R1.spawner.StackedSpawnerTileImpl) StackedSpawnerTile(dev.rosewood.rosestacker.nms.spawner.StackedSpawnerTile) CraftWorld(org.bukkit.craftbukkit.v1_18_R1.CraftWorld) SpawnerBlockEntity(net.minecraft.world.level.block.entity.SpawnerBlockEntity) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Example 5 with StackedSpawnerTileImpl

use of dev.rosewood.rosestacker.nms.v1_18_R1.spawner.StackedSpawnerTileImpl in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method injectStackedSpawnerTile.

@Override
public StackedSpawnerTile injectStackedSpawnerTile(Object stackedSpawnerObj) {
    StackedSpawner stackedSpawner = (StackedSpawner) stackedSpawnerObj;
    Block block = stackedSpawner.getBlock();
    WorldServer level = ((CraftWorld) block.getWorld()).getHandle();
    TileEntity blockEntity = level.getTileEntity(new BlockPosition(block.getX(), block.getY(), block.getZ()));
    if (blockEntity instanceof TileEntityMobSpawner) {
        TileEntityMobSpawner spawnerBlockEntity = (TileEntityMobSpawner) blockEntity;
        if (!(spawnerBlockEntity.getSpawner() instanceof StackedSpawnerTileImpl)) {
            StackedSpawnerTile stackedSpawnerTile = new StackedSpawnerTileImpl(spawnerBlockEntity.getSpawner(), spawnerBlockEntity, stackedSpawner);
            unsafe.putObject(spawnerBlockEntity, field_SpawnerBlockEntity_spawner_offset, stackedSpawnerTile);
            return stackedSpawnerTile;
        } else {
            StackedSpawnerTileImpl spawnerTile = (StackedSpawnerTileImpl) spawnerBlockEntity.getSpawner();
            spawnerTile.updateStackedSpawner(stackedSpawner);
            return spawnerTile;
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.server.v1_16_R3.TileEntity) StackedSpawner(dev.rosewood.rosestacker.stack.StackedSpawner) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) Block(org.bukkit.block.Block) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) TileEntityMobSpawner(net.minecraft.server.v1_16_R3.TileEntityMobSpawner) StackedSpawnerTileImpl(dev.rosewood.rosestacker.nms.v1_16_R3.spawner.StackedSpawnerTileImpl) StackedSpawnerTile(dev.rosewood.rosestacker.nms.spawner.StackedSpawnerTile) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Aggregations

StackedSpawnerTile (dev.rosewood.rosestacker.nms.spawner.StackedSpawnerTile)5 StackedSpawner (dev.rosewood.rosestacker.stack.StackedSpawner)5 Block (org.bukkit.block.Block)5 BlockPos (net.minecraft.core.BlockPos)3 ServerLevel (net.minecraft.server.level.ServerLevel)3 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)3 SpawnerBlockEntity (net.minecraft.world.level.block.entity.SpawnerBlockEntity)3 StackedSpawnerTileImpl (dev.rosewood.rosestacker.nms.v1_16_R2.spawner.StackedSpawnerTileImpl)1 StackedSpawnerTileImpl (dev.rosewood.rosestacker.nms.v1_16_R3.spawner.StackedSpawnerTileImpl)1 StackedSpawnerTileImpl (dev.rosewood.rosestacker.nms.v1_17_R1.spawner.StackedSpawnerTileImpl)1 StackedSpawnerTileImpl (dev.rosewood.rosestacker.nms.v1_18_R1.spawner.StackedSpawnerTileImpl)1 StackedSpawnerTileImpl (dev.rosewood.rosestacker.nms.v1_18_R2.spawner.StackedSpawnerTileImpl)1 BlockPosition (net.minecraft.server.v1_16_R2.BlockPosition)1 TileEntity (net.minecraft.server.v1_16_R2.TileEntity)1 TileEntityMobSpawner (net.minecraft.server.v1_16_R2.TileEntityMobSpawner)1 WorldServer (net.minecraft.server.v1_16_R2.WorldServer)1 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)1 TileEntity (net.minecraft.server.v1_16_R3.TileEntity)1 TileEntityMobSpawner (net.minecraft.server.v1_16_R3.TileEntityMobSpawner)1 WorldServer (net.minecraft.server.v1_16_R3.WorldServer)1