Search in sources :

Example 1 with EntityGeckoMount

use of de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount in project ClaySoldiersMod by SanAndreasP.

the class ItemGeckoDoll method onItemUse.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int blockX, int blockY, int blockZ, int side, float offX, float offY, float offZ) {
    if (world.isRemote) {
        return true;
    } else {
        Block block = world.getBlock(blockX, blockY, blockZ);
        double entityOffY = 0.0D;
        int maxSpawns = stack.stackSize;
        if (player.isSneaking()) {
            maxSpawns = 1;
        }
        if (side == 1 && block.getRenderType() == 11) {
            entityOffY = 0.5D;
        }
        blockX += Facing.offsetsXForSide[side];
        blockY += Facing.offsetsYForSide[side];
        blockZ += Facing.offsetsZForSide[side];
        for (int i = 0; i < maxSpawns; i++) {
            EntityGeckoMount dan = spawnGecko(world, getType(stack), blockX + 0.5D, blockY + entityOffY, blockZ + 0.5D);
            if (dan != null) {
                if (stack.hasDisplayName()) {
                    dan.setCustomNameTag(stack.getDisplayName());
                }
                if (!player.capabilities.isCreativeMode) {
                    dan.dollItem = stack.splitStack(1);
                }
            }
        }
        return true;
    }
}
Also used : EntityGeckoMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount) Block(net.minecraft.block.Block)

Example 2 with EntityGeckoMount

use of de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount in project ClaySoldiersMod by SanAndreasP.

the class ItemGeckoDoll method spawnGecko.

/**
 * Spawns the gecko specified by the type in the location specified by the last three parameters.
 *
 * @param world the World the entity will spawn in
 * @param type  the type the bunny will be
 */
public static EntityGeckoMount spawnGecko(World world, EnumGeckoType type, double x, double y, double z) {
    EntityGeckoMount jordan = new EntityGeckoMount(world, type);
    jordan.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
    jordan.rotationYawHead = jordan.rotationYaw;
    jordan.renderYawOffset = jordan.rotationYaw;
    world.spawnEntityInWorld(jordan);
    jordan.playSound("step.wood", 1.0F, 1.0F);
    return jordan;
}
Also used : EntityGeckoMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount)

Example 3 with EntityGeckoMount

use of de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount in project ClaySoldiersMod by SanAndreasP.

the class BehaviorDollDispenseItem method doDispense.

private static void doDispense(World world, ItemStack stack, EnumFacing facing, IPosition position) {
    double x = position.getX();
    double y = position.getY() - (facing == EnumFacing.UP ? 0.0D : 0.3D);
    double z = position.getZ();
    if (stack.getItem() == RegistryItems.dollSoldier) {
        EntityClayMan spencer = ItemClayManDoll.spawnClayMan(world, ItemClayManDoll.getTeam(stack).getTeamName(), x, y, z);
        spencer.dollItem = stack;
    } else if (stack.getItem() == RegistryItems.dollHorseMount) {
        EntityHorseMount spencer = ItemHorseDoll.spawnHorse(world, ItemHorseDoll.getType(stack), ItemHorseDoll.isPegasus(stack), x, y, z);
        spencer.dollItem = stack;
    } else if (stack.getItem() == RegistryItems.dollTurtleMount) {
        EntityTurtleMount spencer = ItemTurtleDoll.spawnTurtle(world, ItemTurtleDoll.getType(stack), x, y, z);
        spencer.dollItem = stack;
    } else if (stack.getItem() == RegistryItems.dollGeckoMount) {
        EntityGeckoMount spencer = ItemGeckoDoll.spawnGecko(world, ItemGeckoDoll.getType(stack), x, y, z);
        spencer.dollItem = stack;
    } else if (stack.getItem() == RegistryItems.dollBunnyMount) {
        EntityBunnyMount spencer = ItemBunnyDoll.spawnBunny(world, ItemBunnyDoll.getType(stack), x, y, z);
        spencer.dollItem = stack;
    }
}
Also used : EntityHorseMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount) EntityTurtleMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) EntityGeckoMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount) EntityBunnyMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityBunnyMount)

Aggregations

EntityGeckoMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount)3 EntityClayMan (de.sanandrew.mods.claysoldiers.entity.EntityClayMan)1 EntityBunnyMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityBunnyMount)1 EntityHorseMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount)1 EntityTurtleMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount)1 Block (net.minecraft.block.Block)1