Search in sources :

Example 1 with EntityTurtleMount

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

the class ItemTurtleDoll method spawnTurtle.

/**
 * Spawns the horse 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 horse will be
 */
public static EntityTurtleMount spawnTurtle(World world, EnumTurtleType type, double x, double y, double z) {
    EntityTurtleMount jordan = new EntityTurtleMount(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.gravel", 1.0F, 1.0F);
    return jordan;
}
Also used : EntityTurtleMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount)

Example 2 with EntityTurtleMount

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

the class ItemTurtleDoll 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++) {
            EntityTurtleMount dan = spawnTurtle(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 : EntityTurtleMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount) Block(net.minecraft.block.Block)

Example 3 with EntityTurtleMount

use of de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount 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

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