Search in sources :

Example 1 with GeneratableBlockInfo

use of team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo in project ChocolateQuestRepoured by TeamChocoQuest.

the class PreparableBossInfo method prepareDebug.

@Override
protected GeneratablePosInfo prepareDebug(World world, DungeonPlacement placement, BlockPos pos) {
    TileEntityBoss tileEntity = new TileEntityBoss();
    if (this.bossTag != null) {
        ItemStack stack = new ItemStack(CQRItems.SOUL_BOTTLE);
        CompoundNBT tag = new CompoundNBT();
        tag.setTag(ItemSoulBottle.ENTITY_IN_TAG, this.bossTag);
        stack.setTagCompound(tag);
        tileEntity.inventory.setStackInSlot(0, stack);
    }
    return new GeneratableBlockInfo(pos, CQRBlocks.BOSS_BLOCK.getDefaultState(), tileEntity);
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT) TileEntityBoss(team.cqr.cqrepoured.tileentity.TileEntityBoss) ItemStack(net.minecraft.item.ItemStack) GeneratableBlockInfo(team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo)

Example 2 with GeneratableBlockInfo

use of team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo in project ChocolateQuestRepoured by TeamChocoQuest.

the class PreparableLootChestInfo method prepare.

@Override
protected GeneratablePosInfo prepare(World world, DungeonPlacement placement, BlockPos pos) {
    BlockState state = Blocks.CHEST.getDefaultState().withProperty(ChestBlock.FACING, this.facing);
    state = state.withMirror(placement.getMirror()).withRotation(placement.getRotation());
    TileEntity tileEntity = state.getBlock().createTileEntity(world, state);
    if (tileEntity instanceof ChestTileEntity) {
        long seed = WorldDungeonGenerator.getSeed(world, pos.getX(), pos.getZ());
        ((ChestTileEntity) tileEntity).setLootTable(this.lootTable, seed);
    }
    return new GeneratableBlockInfo(pos, state, tileEntity);
}
Also used : ChestTileEntity(net.minecraft.tileentity.ChestTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) ChestTileEntity(net.minecraft.tileentity.ChestTileEntity) GeneratableBlockInfo(team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo)

Example 3 with GeneratableBlockInfo

use of team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo in project ChocolateQuestRepoured by TeamChocoQuest.

the class PreparableSpawnerInfo method prepare.

@Override
protected GeneratablePosInfo prepare(World world, DungeonPlacement placement, BlockPos pos) {
    BlockState state;
    TileEntity tileEntity;
    BlockPos p = pos.toImmutable();
    if (this.tileEntityData.getBoolean("vanillaSpawner")) {
        state = Blocks.MOB_SPAWNER.getDefaultState();
        tileEntity = state.getBlock().createTileEntity(world, state);
        if (tileEntity instanceof MobSpawnerTileEntity) {
            this.vanillaSpawnerReadFromNBT(world, placement, p, (MobSpawnerTileEntity) tileEntity);
        }
    } else {
        state = CQRBlocks.SPAWNER.getDefaultState();
        tileEntity = state.getBlock().createTileEntity(world, state);
        if (tileEntity instanceof TileEntitySpawner) {
            this.cqrSpawnerReadFromNBT(world, placement, p, (TileEntitySpawner) tileEntity);
        }
    }
    return new GeneratableBlockInfo(p, state, tileEntity);
}
Also used : MobSpawnerTileEntity(net.minecraft.tileentity.MobSpawnerTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) BlockState(net.minecraft.block.BlockState) BlockPos(net.minecraft.util.math.BlockPos) MobSpawnerTileEntity(net.minecraft.tileentity.MobSpawnerTileEntity) TileEntitySpawner(team.cqr.cqrepoured.tileentity.TileEntitySpawner) GeneratableBlockInfo(team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo)

Example 4 with GeneratableBlockInfo

use of team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo in project ChocolateQuestRepoured by TeamChocoQuest.

the class PreparableSpawnerInfo method prepareDebug.

@Override
protected GeneratablePosInfo prepareDebug(World world, DungeonPlacement placement, BlockPos pos) {
    BlockState transformedState = CQRBlocks.SPAWNER.getDefaultState().withMirror(placement.getMirror()).withRotation(placement.getRotation());
    TileEntity tileEntity = null;
    if (this.tileEntityData != null) {
        tileEntity = transformedState.getBlock().createTileEntity(world, transformedState);
        if (tileEntity != null) {
            this.tileEntityData.setInteger("x", pos.getX());
            this.tileEntityData.setInteger("y", pos.getY());
            this.tileEntityData.setInteger("z", pos.getZ());
            tileEntity.readFromNBT(this.tileEntityData);
            tileEntity.mirror(placement.getMirror());
            tileEntity.rotate(placement.getRotation());
            this.tileEntityData.removeTag("x");
            this.tileEntityData.removeTag("y");
            this.tileEntityData.removeTag("z");
        }
    }
    return new GeneratableBlockInfo(pos, transformedState, tileEntity);
}
Also used : MobSpawnerTileEntity(net.minecraft.tileentity.MobSpawnerTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) BlockState(net.minecraft.block.BlockState) GeneratableBlockInfo(team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo)

Example 5 with GeneratableBlockInfo

use of team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo in project ChocolateQuestRepoured by TeamChocoQuest.

the class PreparableLootChestInfo method prepareDebug.

@Override
protected GeneratablePosInfo prepareDebug(World world, DungeonPlacement placement, BlockPos pos) {
    BlockExporterChest block = BlockExporterChest.getExporterChests().stream().filter(BlockExporterChestCQR.class::isInstance).filter(b -> ((BlockExporterChestCQR) b).getLootTable().equals(this.lootTable)).findFirst().orElse(CQRBlocks.EXPORTER_CHEST_CUSTOM);
    BlockState state = block.getDefaultState().withProperty(HorizontalBlock.FACING, this.facing);
    state = state.withMirror(placement.getMirror()).withRotation(placement.getRotation());
    if (block != CQRBlocks.EXPORTER_CHEST_CUSTOM) {
        return new GeneratableBlockInfo(pos, state, null);
    }
    TileEntityExporterChestCustom tileEntity = new TileEntityExporterChestCustom();
    tileEntity.setLootTable(this.lootTable);
    return new GeneratableBlockInfo(pos, state, tileEntity);
}
Also used : TileEntityExporterChestCustom(team.cqr.cqrepoured.tileentity.TileEntityExporterChestCustom) BlockExporterChest(team.cqr.cqrepoured.block.BlockExporterChest) BlockExporterChestCQR(team.cqr.cqrepoured.block.BlockExporterChestCQR) GeneratableBlockInfo(team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo)

Aggregations

GeneratableBlockInfo (team.cqr.cqrepoured.world.structure.generation.generation.generatable.GeneratableBlockInfo)6 BlockState (net.minecraft.block.BlockState)3 TileEntity (net.minecraft.tileentity.TileEntity)3 MobSpawnerTileEntity (net.minecraft.tileentity.MobSpawnerTileEntity)2 ItemStack (net.minecraft.item.ItemStack)1 CompoundNBT (net.minecraft.nbt.CompoundNBT)1 ChestTileEntity (net.minecraft.tileentity.ChestTileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 BlockExporterChest (team.cqr.cqrepoured.block.BlockExporterChest)1 BlockExporterChestCQR (team.cqr.cqrepoured.block.BlockExporterChestCQR)1 TileEntityBoss (team.cqr.cqrepoured.tileentity.TileEntityBoss)1 TileEntityExporterChestCustom (team.cqr.cqrepoured.tileentity.TileEntityExporterChestCustom)1 TileEntityMap (team.cqr.cqrepoured.tileentity.TileEntityMap)1 TileEntitySpawner (team.cqr.cqrepoured.tileentity.TileEntitySpawner)1