Search in sources :

Example 26 with EntityClayMan

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

the class EntityGeckoMount method updateEntityActionState.

@Override
public void updateEntityActionState() {
    if (riddenByEntity == null || !(riddenByEntity instanceof EntityClayMan)) {
        super.updateEntityActionState();
    } else {
        EntityClayMan rider = (EntityClayMan) riddenByEntity;
        this.isJumping = rider.isJumping();
        this.moveForward = rider.moveForward;
        this.moveStrafing = rider.moveStrafing;
        this.rotationYaw = this.prevRotationYaw = rider.rotationYaw;
        this.rotationPitch = this.prevRotationPitch = rider.rotationPitch;
        rider.renderYawOffset = this.renderYawOffset;
        this.riddenByEntity.fallDistance = 0.0F;
        if (rider.isDead || rider.getHealth() <= 0) {
            rider.mountEntity(null);
        }
    }
}
Also used : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Example 27 with EntityClayMan

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

the class EntityPegasusMount method onUpdate.

@Override
public void onUpdate() {
    if (this.worldObj.isRemote) {
        this.calcWingSwing();
    }
    this.jumpMovementFactor = this.getAIMoveSpeed() * (0.16277136F / (0.91F * 0.91F * 0.91F));
    this.fallDistance = 0.0F;
    if (this.motionY < -0.1D) {
        this.motionY = -0.1D;
    }
    if (this.riddenByEntity instanceof EntityClayMan && this.moveForward != 0.0F) {
        EntityClayMan rider = (EntityClayMan) this.riddenByEntity;
        double dist = Double.MAX_VALUE;
        if (rider.getEntityToAttack() != null) {
            dist = this.getDistanceSqToEntity(rider.getEntityToAttack());
        } else if (rider.getTargetFollowing() != null) {
            dist = this.getDistanceSqToEntity(rider.getTargetFollowing());
        }
        if (dist > 2.25D) {
            if (this.onGround) {
                this.motionY = 0.4D;
                this.isAirBorne = true;
            } else {
                int[] blockPos = new int[] { (int) posX, (int) posY - 1, (int) posZ };
                Block blockBelow = this.worldObj.getBlock(blockPos[0], blockPos[1], blockPos[2]);
                if (blockBelow != null && !blockBelow.isAir(this.worldObj, blockPos[0], blockPos[1], blockPos[2])) {
                    AxisAlignedBB aabb = blockBelow.getCollisionBoundingBoxFromPool(this.worldObj, blockPos[0], blockPos[1], blockPos[2]);
                    if (aabb == null || aabb.maxY > (this.posY - 1.0D)) {
                        this.motionY = 0.2D;
                        this.isAirBorne = true;
                    }
                }
            }
        }
    }
    super.onUpdate();
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) Block(net.minecraft.block.Block)

Example 28 with EntityClayMan

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

the class ItemClayManDoll 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++) {
            EntityClayMan dan = spawnClayMan(world, getTeam(stack).getTeamName(), 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 : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) Block(net.minecraft.block.Block)

Example 29 with EntityClayMan

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

the class ClientProxy method applyEffectNbt.

@Override
public void applyEffectNbt(int entityId, byte effectRenderId, NBTTagCompound nbt) {
    Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityId);
    if (entity instanceof EntityClayMan) {
        EntityClayMan pahimar = (EntityClayMan) entity;
        ASoldierEffect effect = SoldierEffects.getEffect(effectRenderId);
        if (pahimar.hasEffect(effect)) {
            pahimar.getEffect(effect).setNbtTag(nbt);
        } else {
            pahimar.addEffect(effect).setNbtTag(nbt);
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) ASoldierEffect(de.sanandrew.mods.claysoldiers.util.soldier.effect.ASoldierEffect)

Example 30 with EntityClayMan

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

the class ClientProxy method applyUpgradeNbt.

@Override
public void applyUpgradeNbt(int entityId, byte upgradeRenderId, NBTTagCompound nbt) {
    Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityId);
    if (entity instanceof EntityClayMan) {
        EntityClayMan pahimar = (EntityClayMan) entity;
        ASoldierUpgrade upgrade = SoldierUpgrades.getUpgrade(upgradeRenderId);
        if (pahimar.hasUpgrade(upgrade)) {
            pahimar.getUpgrade(upgrade).setNbtTag(nbt);
        } else {
            pahimar.addUpgrade(upgrade).setNbtTag(nbt);
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) ASoldierUpgrade(de.sanandrew.mods.claysoldiers.util.soldier.upgrade.ASoldierUpgrade)

Aggregations

EntityClayMan (de.sanandrew.mods.claysoldiers.entity.EntityClayMan)30 Entity (net.minecraft.entity.Entity)7 ISoldierProjectile (de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile)4 DamageSource (net.minecraft.util.DamageSource)4 Block (net.minecraft.block.Block)2 World (net.minecraft.world.World)2 RGBAValues (de.sanandrew.core.manpack.util.helpers.SAPUtils.RGBAValues)1 Quartet (de.sanandrew.core.manpack.util.javatuples.Quartet)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 EntityTurtleMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount)1 ClaymanTeam (de.sanandrew.mods.claysoldiers.util.soldier.ClaymanTeam)1 ASoldierEffect (de.sanandrew.mods.claysoldiers.util.soldier.effect.ASoldierEffect)1 SoldierEffectInst (de.sanandrew.mods.claysoldiers.util.soldier.effect.SoldierEffectInst)1 ASoldierUpgrade (de.sanandrew.mods.claysoldiers.util.soldier.upgrade.ASoldierUpgrade)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityThrowable (net.minecraft.entity.projectile.EntityThrowable)1