Skip to content

Commit

Permalink
PZ 1.4a update
Browse files Browse the repository at this point in the history
  • Loading branch information
soultek101 committed Jan 23, 2015
1 parent 7d5c011 commit ea80129
Show file tree
Hide file tree
Showing 522 changed files with 76,274 additions and 563 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ buildscript {

apply plugin: 'forge'

version = "1.7.10-1.3c"
version = "1.7.10-1.4a"
group= "com.stek101.projectzulu" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ProjectZulu"

minecraft {
version = "1.7.10-10.13.1.1217"
version = "1.7.10-10.13.2.1230"
runDir = "eclipse"
}

Expand Down
Empty file added eclipse/.metadata/.lock
Empty file.
1,490 changes: 1,490 additions & 0 deletions eclipse/.metadata/.log

Large diffs are not rendered by default.

Binary file added eclipse/.metadata/.mylyn/repositories.xml.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
package com.stek101.projectzulu.common.mobs.entity;

import java.util.EnumSet;

import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;

import com.stek101.projectzulu.common.api.BlockList;
import com.stek101.projectzulu.common.api.CustomEntityList;
import com.stek101.projectzulu.common.core.DefaultProps;
import com.stek101.projectzulu.common.mobs.EntityAFightorFlight;
import com.stek101.projectzulu.common.mobs.entityai.EntityAIAttackOnCollide;
import com.stek101.projectzulu.common.mobs.entityai.EntityAIFlyingWander;
import com.stek101.projectzulu.common.mobs.entityai.EntityAIHurtByTarget;
import com.stek101.projectzulu.common.mobs.entityai.EntityAINearestAttackableTarget;
import com.stek101.projectzulu.common.mobs.entityai.EntityAIStayStill;

import cpw.mods.fml.common.Loader;

public class EntityPZBat extends EntityGenericAnimal implements IAnimals {
int stayStillTimer = 0;
private EntityAFightorFlight EAFF;
private float aggroLevel;
private double aggroRange;

public EntityPZBat(World par1World) {
super(par1World);
// noClip = true;
//this.setSize(0.5f, 0.5f);

float moveSpeed = 0.22f;
CustomEntityList entityEntry = CustomEntityList.getByName(EntityList.getEntityString(this));
if (entityEntry != null && entityEntry.modData.get().entityProperties != null) {
// TODO: Switch to this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()???
moveSpeed = entityEntry.modData.get().entityProperties.moveSpeed;
this.aggroLevel = entityEntry.modData.get().entityProperties.aggroLevel;
this.aggroRange = entityEntry.modData.get().entityProperties.aggroRange;
}

if (Math.round(this.aggroRange) != 0) {
EAFF = new EntityAFightorFlight().setEntity(this, worldObj, this.aggroLevel, this.aggroRange);
}

this.maxFlightHeight = 7;
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(2, new EntityAIStayStill(this, EntityStates.posture));
this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0f, false));
this.tasks.addTask(4, new EntityAIFlyingWander(this, (float) moveSpeed));
this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 16.0F));

targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, false));
targetTasks.addTask(2,
new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking),
EntityPlayer.class, 16.0F, 0, true));
}

@Override
public boolean defaultGrounded() {
return false;
}

/**
* Called when the mob is falling. Calculates and applies fall damage.
*/
@Override
protected void fall(float par1) {
}

/**
* Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance
* and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround
*/
@Override
protected void updateFallState(double par1, boolean par3) {
}

@Override
public int getTotalArmorValue() {
return 1;
}

/**
* Returns the sound this mob makes while it's alive.
*/
@Override
protected String getLivingSound() {
return DefaultProps.mobKey + ":" + DefaultProps.entitySounds + "birdhurt";
}

/**
* Returns the sound this mob makes when it is hurt.
*/
@Override
protected String getHurtSound() {
return DefaultProps.mobKey + ":" + DefaultProps.entitySounds + "bird";
}

@Override
public int getTalkInterval() {
return 120;
}

@Override
public void onLivingUpdate() {
super.onLivingUpdate();
if (Math.round(this.aggroRange) != 0) {
EAFF.updateEntityAFF(worldObj);
}
}

/**
* Plays step sound at given x, y, z for the entity
*/
@Override
protected void func_145780_a(int xCoord, int yCoord, int zCoord, Block stepBlock) {
this.worldObj.playSoundAtEntity(this, "sounds.birdplop", 1.0F, 1.0F);
}

@Override
public boolean isValidBreedingItem(ItemStack itemStack) {
return false;
}

@Override
public void updateAIState() {
if (stayStillTimer > 0) {
entityState = EntityStates.posture;
} else {
super.updateAIState();
}
}

@Override
protected void updateAITasks() {
super.updateAITasks();

/* If We are above Solid Ground, have a small Chance at Landing */
if (this.rand.nextInt(100) == 0
&& this.worldObj.getBlock(MathHelper.floor_double(this.posX), (int) this.posY - 1,
MathHelper.floor_double(this.posZ)).isNormalCube()) {
stayStillTimer = 400;
}

/* If Posing, Check if We should Stay Flee */
if (getEntityState() == EntityStates.posture) {
/* If we are not on a Normal Block, Fly Free */
if (!this.worldObj.getBlock(MathHelper.floor_double(this.posX), (int) this.posY - 1,
MathHelper.floor_double(this.posZ)).isNormalCube()) {
stayStillTimer = 0;
} else {
/* Chance to Chance Direction We are Facing ?--Do We Care?--? */
if (this.rand.nextInt(200) == 0) {
this.rotationYawHead = this.rand.nextInt(360);
}

/* If Player is nearby, Entity Should Fly away, think Pigeons */
if (this.worldObj.getClosestPlayerToEntity(this, 4.0D) != null || this.rand.nextInt(400) == 0) {
stayStillTimer = 0;
}
}
/*
* Deincrement stayStillTimer, if it hits zero Entity Should Fly : Note that timer is likely being set to
* max again by the initial shouldSit check
*/
stayStillTimer = Math.max(stayStillTimer - 1, 0);
}
}

/**
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
* prevent them from trampling crops
*/
@Override
protected boolean canTriggerWalking() {
return false;
}

// @Override
// protected boolean isValidLightLevel(World world, int xCoord, int yCoord, int zCoord) {
// return this.worldObj.getSavedLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord) < 1;
// }

@Override
protected boolean isValidLocation(World world, int xCoord, int yCoord, int zCoord) {
return worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord);
}

// @Override
// protected void dropRareDrop(int par1) {
// if (Loader.isModLoaded(DefaultProps.BlocksModId) && BlockList.mobHeads.isPresent()) {
// entityDropItem(new ItemStack(BlockList.mobHeads.get(), 1, 0), 1);
// }
// super.dropRareDrop(par1);
// }

@Override
public boolean attackEntityAsMob(Entity entity) {
boolean success = super.attackEntityAsMob(entity);
if (entity instanceof EntityLiving) {
((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.poison.id, 40, 1));
success = true;
}
return success;
}
}
Loading

0 comments on commit ea80129

Please sign in to comment.