Search in sources :

Example 1 with DendroPotion

use of com.ferreusveritas.dynamictrees.items.DendroPotion in project DynamicTrees by DynamicTreesTeam.

the class CommandCreateTransformPotion method execute.

@Override
public void execute(World world, ICommandSender sender, String[] args) throws CommandException {
    if (args.length < 4) {
        throw new WrongUsageException("commands.dynamictrees.createtransformpotion.usage");
    }
    BlockPos pos = BlockPos.ORIGIN;
    Species species = null;
    for (int arg = 0; arg < args.length; arg++) {
        switch(arg) {
            case 3:
                pos = CommandBase.parseBlockPos(sender, args, 1, false);
                break;
            case 4:
                species = TreeRegistry.findSpeciesSloppy(args[4]);
                if (species == Species.NULLSPECIES) {
                    throw new CommandException("commands.dynamictrees.setree.specieserror", args[4]);
                }
                break;
        }
    }
    final DendroPotion dendroPotion = ModItems.dendroPotion;
    // Create the transform potion.
    final ItemStack dendroPotionStack = new ItemStack(dendroPotion, 1, DendroPotion.DendroPotionType.TRANSFORM.getIndex());
    // Tell it to set the target species to the given species.
    dendroPotion.setTargetSpecies(dendroPotionStack, species);
    // Spawn potion in the world.
    ItemUtils.spawnItemStack(world, pos, dendroPotionStack, true);
}
Also used : WrongUsageException(net.minecraft.command.WrongUsageException) DendroPotion(com.ferreusveritas.dynamictrees.items.DendroPotion) BlockPos(net.minecraft.util.math.BlockPos) CommandException(net.minecraft.command.CommandException) ItemStack(net.minecraft.item.ItemStack) Species(com.ferreusveritas.dynamictrees.trees.Species)

Example 2 with DendroPotion

use of com.ferreusveritas.dynamictrees.items.DendroPotion in project DynamicTrees by DynamicTreesTeam.

the class ModItems method preInit.

public static void preInit() {
    // Potions
    dendroPotion = new DendroPotion();
    // Dirt Bucket
    dirtBucket = new DirtBucket();
    // Creative Mode Staff
    treeStaff = new Staff();
}
Also used : DendroPotion(com.ferreusveritas.dynamictrees.items.DendroPotion) Staff(com.ferreusveritas.dynamictrees.items.Staff) DirtBucket(com.ferreusveritas.dynamictrees.items.DirtBucket)

Aggregations

DendroPotion (com.ferreusveritas.dynamictrees.items.DendroPotion)2 DirtBucket (com.ferreusveritas.dynamictrees.items.DirtBucket)1 Staff (com.ferreusveritas.dynamictrees.items.Staff)1 Species (com.ferreusveritas.dynamictrees.trees.Species)1 CommandException (net.minecraft.command.CommandException)1 WrongUsageException (net.minecraft.command.WrongUsageException)1 ItemStack (net.minecraft.item.ItemStack)1 BlockPos (net.minecraft.util.math.BlockPos)1