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);
}
}
}
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();
}
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;
}
}
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);
}
}
}
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);
}
}
}
Aggregations