Search in sources :

Example 1 with TileEntityFlowerPot

use of net.minecraft.tileentity.TileEntityFlowerPot in project minecolonies by Minecolonies.

the class EntityAIStructureBuilder method getItemStacksOfTileEntity.

/**
     * Get itemStack of tileEntityData. Retrieve the data from the tileEntity.
     *
     * @param compound the tileEntity stored in a compound.
     * @return the list of itemstacks.
     */
private List<ItemStack> getItemStacksOfTileEntity(final NBTTagCompound compound) {
    final List<ItemStack> items = new ArrayList<>();
    final TileEntity tileEntity = TileEntity.create(world, compound);
    if (tileEntity instanceof TileEntityFlowerPot) {
        items.add(((TileEntityFlowerPot) tileEntity).getFlowerItemStack());
    } else if (tileEntity instanceof TileEntityLockable) {
        for (int i = 0; i < ((TileEntityLockable) tileEntity).getSizeInventory(); i++) {
            final ItemStack stack = ((TileEntityLockable) tileEntity).getStackInSlot(i);
            if (stack != null) {
                items.add(stack);
            }
        }
    }
    return items;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityLockable(net.minecraft.tileentity.TileEntityLockable) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot)

Example 2 with TileEntityFlowerPot

use of net.minecraft.tileentity.TileEntityFlowerPot in project minecolonies by Minecolonies.

the class EntityAIStructureBuilder method handleFlowerPots.

@Override
public void handleFlowerPots(@NotNull final BlockPos pos) {
    if (job.getStructure().getBlockInfo().tileentityData != null) {
        final TileEntityFlowerPot tileentityflowerpot = (TileEntityFlowerPot) world.getTileEntity(pos);
        tileentityflowerpot.readFromNBT(job.getStructure().getBlockInfo().tileentityData);
        world.setTileEntity(pos, tileentityflowerpot);
    }
}
Also used : TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot)

Example 3 with TileEntityFlowerPot

use of net.minecraft.tileentity.TileEntityFlowerPot in project minecolonies by Minecolonies.

the class ItemStackUtils method getItemStacksOfTileEntity.

/**
 * Get itemStack of tileEntityData. Retrieve the data from the tileEntity.
 *
 * @param compound the tileEntity stored in a compound.
 * @param world the world.
 * @return the list of itemstacks.
 */
public static List<ItemStack> getItemStacksOfTileEntity(final NBTTagCompound compound, final World world) {
    final List<ItemStack> items = new ArrayList<>();
    final TileEntity tileEntity = TileEntity.create(world, compound);
    if (tileEntity instanceof TileEntityFlowerPot) {
        items.add(((TileEntityFlowerPot) tileEntity).getFlowerItemStack());
    } else if (tileEntity instanceof TileEntityLockable) {
        for (int i = 0; i < ((TileEntityLockable) tileEntity).getSizeInventory(); i++) {
            final ItemStack stack = ((TileEntityLockable) tileEntity).getStackInSlot(i);
            if (stack != null) {
                items.add(stack);
            }
        }
    } else if (ChiselAndBitsCheck.isChiselAndBitsTileEntity(tileEntity)) {
        items.addAll(ChiselAndBitsCheck.getBitStacks(tileEntity));
    }
    return items;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityLockable(net.minecraft.tileentity.TileEntityLockable) ArrayList(java.util.ArrayList) TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot)

Example 4 with TileEntityFlowerPot

use of net.minecraft.tileentity.TileEntityFlowerPot in project Bewitchment by Um-Mitternacht.

the class TileEntityWitchAltar method getGain.

private int getGain(BlockPos pos, boolean[] types) {
    IBlockState blockState = getWorld().getBlockState(pos);
    if (blockState.getBlock().equals(Blocks.SKULL)) {
        if (types[0])
            return 0;
        types[0] = true;
        TileEntitySkull tes = (TileEntitySkull) world.getTileEntity(pos);
        switch(tes.getSkullType()) {
            case 0:
            case 2:
            case 4:
                // Zombie, Skeleton and creeper
                return 1;
            case 1:
            case 3:
                // Wither skull and player skull
                return 2;
            case 5:
                // Ender dragon
                return 4;
            default:
                return 0;
        }
    } else if (blockState.getBlock().equals(Blocks.TORCH)) {
        if (types[1])
            return 0;
        types[1] = true;
        return 1;
    } else if (blockState.getBlock().equals(Blocks.FLOWER_POT)) {
        if (blockState.getBlock().hasTileEntity(blockState)) {
            TileEntityFlowerPot tefp = (TileEntityFlowerPot) world.getTileEntity(pos);
            if (!tefp.getFlowerItemStack().isEmpty()) {
                if (types[2])
                    return 0;
                types[2] = true;
                return 1;
            }
        }
    // TODO: Change the way gems are stored on an altar. Use a ritual plate. Pick them up via the oredict, to increase mod support.
    } else if (blockState.getBlock().equals(Blocks.DIAMOND_BLOCK)) {
        return 325;
    } else if (blockState.getBlock().equals(Blocks.EMERALD_BLOCK)) {
        return 275;
    } else if (blockState.getBlock().equals(ModBlocks.moldavite_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.alexandrite_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.nuummite_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.garnet_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.amethyst_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.tourmaline_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.tigers_eye_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.malachite_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.bloodstone_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.jasper_block)) {
        return 225;
    } else if (blockState.getBlock().equals(Blocks.LAPIS_BLOCK)) {
        return 225;
    } else if (blockState.getBlock().equals(Blocks.QUARTZ_BLOCK)) {
        return 225;
    } else if (blockState.getBlock().equals(Blocks.REDSTONE_BLOCK)) {
        return 200;
    } else if (blockState.getBlock() instanceof BlockCandle) {
        if (types[1])
            return 0;
        types[1] = true;
        return 2;
    // } else if (blockState.getBlock().equals(ModBlocks.ritual_candle)) {
    // if (types[1]) return 0;
    // types[1]=true;
    // return 2;
    }
    return 0;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockCandle(com.bewitchment.common.block.tools.BlockCandle) TileEntitySkull(net.minecraft.tileentity.TileEntitySkull) TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot)

Example 5 with TileEntityFlowerPot

use of net.minecraft.tileentity.TileEntityFlowerPot in project ClaySoldiersMod by SanAndreasP.

the class WorldGenClayHut method insertFlower.

private static void insertFlower(World world, int potX, int potY, int potZ, ItemStack flower) {
    TileEntityFlowerPot pot = (TileEntityFlowerPot) world.getTileEntity(potX, potY, potZ);
    if (pot == null) {
        pot = new TileEntityFlowerPot();
        world.setTileEntity(potX, potY, potZ, pot);
    }
    pot.func_145964_a(flower.getItem(), flower.getItemDamage());
    pot.markDirty();
    world.markBlockForUpdate(potX, potY, potZ);
}
Also used : TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot)

Aggregations

TileEntityFlowerPot (net.minecraft.tileentity.TileEntityFlowerPot)6 ArrayList (java.util.ArrayList)2 TileEntity (net.minecraft.tileentity.TileEntity)2 TileEntityLockable (net.minecraft.tileentity.TileEntityLockable)2 BlockCandle (com.bewitchment.common.block.tools.BlockCandle)1 IBlockState (net.minecraft.block.state.IBlockState)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntitySkull (net.minecraft.tileentity.TileEntitySkull)1 ItemStackSnapshot (org.spongepowered.api.item.inventory.ItemStackSnapshot)1