Permalink
Browse files

Added spawn config for wither witches.

  • Loading branch information...
1 parent 62c1344 commit b4402c5777b9f0a92a3ed0abb3c30f0170c30610 @CrazyPants CrazyPants committed Nov 4, 2014
View
@@ -1,7 +1,18 @@
-------------------------------------------
-Version 1.0.0.3 Beta
+Version 1.0.1
-------------------------------------------
+Changes
+- Added Wither Witch, throws wither potions
+- Added Withering Powder, dropped by Wither Witch, used to brew wither potions
+- Added zh_CN.lang (Mrkwtkr)
+
+Bugs
+- #4 Server crash due to use of classes unavailable on server
+- Fixed Fallen Steeds spawning without riders
+-------------------------------------------
+Version 1.0.0.3 Beta
+-------------------------------------------
- Mounted archer Fallen Knights will now attempt to stay out of melee range
- Ground archer Fallen Knights will switch to a sword when in melee range
- Added randomized Fallen Knights swords based on global difficulty and regional difficulty settings
View
@@ -1,2 +1,3 @@
concussion
melee
+potions
@@ -55,8 +55,16 @@ same id and 0 biomeTypes.
<biomeType name="JUNGLE" />
</entry>
- <entry id="FallenKnight" mobName="enderzoo.FallenKnight" rate="40" minGroupSize="1" maxGroupSize="4">
+ <entry id="FallenKnight" mobName="enderzoo.FallenKnight" rate="50" minGroupSize="1" maxGroupSize="4">
<biomeType name="PLAINS" />
</entry>
+
+ <entry id="WitherWitch" mobName="enderzoo.WitherWitch" rate="10" minGroupSize="1" maxGroupSize="1">
+ <biomeType name="FOREST" />
+ <biomeType name="SWAMP" />
+ <biomeType name="PLAINS" />
+ <biomeType name="HILLS" />
+ <biomeType name="MOUNTAIN" />
+ </entry>
</SpawnConfig>
@@ -48,7 +48,7 @@
private EntityLivingBase lastAttackTarget = null;
- private boolean firstUpdate = false;
+ private boolean firstUpdate = true;
private boolean isMounted = false;
public EntityFallenKnight(World world) {
@@ -83,7 +83,7 @@ private float getAttackRange() {
@Override
public void setCombatTask() {
tasks.removeTask(getAiAttackOnCollide());
- tasks.removeTask(getAiArrowAttack());
+ tasks.removeTask(getAiArrowAttack());
if(isRanged()) {
tasks.addTask(4, getAiArrowAttack());
} else {
@@ -125,15 +125,20 @@ protected String getDeathSound() {
@Override
public void onLivingUpdate() {
super.onLivingUpdate();
+
+ if(firstUpdate && !worldObj.isRemote) {
+ spawnMount();
+ }
+
if(isRiding()) {
EntityLiving entLiving = ((EntityLiving) ridingEntity);
if(lastAttackTarget != getAttackTarget() || firstUpdate) {
cancelCurrentTasks(entLiving);
- lastAttackTarget = getAttackTarget();
+ lastAttackTarget = getAttackTarget();
}
- }
+ }
firstUpdate = false;
-
+
if(!isMounted == isRiding()) {
getAiAttackOnCollide().resetTask();
getAiArrowAttack().resetTask();
@@ -143,12 +148,40 @@ public void onLivingUpdate() {
if(isBurning() && isRiding()) {
ridingEntity.setFire(8);
}
- if( Config.fallenKnightArchersSwitchToMelee && (!isMounted || !Config.fallKnightMountedArchesMaintainDistance)
+ if(Config.fallenKnightArchersSwitchToMelee && (!isMounted || !Config.fallKnightMountedArchesMaintainDistance)
&& getAttackTarget() != null && isRanged() && getDistanceSqToEntity(getAttackTarget()) < 5) {
setCurrentItemOrArmor(0, getSwordForLevel(getRandomEquipmentLevel()));
}
}
+ @Override
+ protected void despawnEntity() {
+ Entity mount = ridingEntity;
+ super.despawnEntity();
+ if(isDead && mount != null) {
+ mount.setDead();
+ }
+ }
+
+ private void spawnMount() {
+ EntityFallenMount mount = null;
+ if(Config.fallenMountEnabled && rand.nextFloat() <= Config.fallenKnightChanceMounted) {
+ mount = new EntityFallenMount(worldObj);
+ mount.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);
+ mount.onSpawnWithEgg((IEntityLivingData) null);
+ //NB: don;t check for entity collisions as we know the knight will collide
+ if(!EntityUtil.isSpaceAvailableForSpawn(worldObj, mount, false)) {
+ mount = null;
+ }
+ }
+ if(mount != null) {
+ setCanPickUpLoot(false);
+ setCanBreakDoors(false);
+ worldObj.spawnEntityInWorld(mount);
+ mountEntity(mount);
+ }
+ }
+
private boolean isRanged() {
ItemStack itemstack = this.getHeldItem();
return itemstack != null && itemstack.getItem() == Items.bow;
@@ -175,9 +208,9 @@ private void cancelCurrentTasks(EntityLiving ent) {
protected void addRandomArmor() {
float occupiedDiffcultyMultiplier = EntityUtil.getDifficultyMultiplierForLocation(worldObj, posX, posY, posZ);
-
+
int equipmentLevel = getRandomEquipmentLevel(occupiedDiffcultyMultiplier);
- int armorLevel = equipmentLevel;
+ int armorLevel = equipmentLevel;
if(armorLevel == 1) {
//Skip gold armor, I don't like it
armorLevel++;
@@ -200,7 +233,7 @@ protected void addRandomArmor() {
}
}
}
- if(rand.nextFloat() > Config.fallenKnightRangedRatio) {
+ if(rand.nextFloat() > Config.fallenKnightRangedRatio) {
setCurrentItemOrArmor(0, getSwordForLevel(equipmentLevel));
} else {
setCurrentItemOrArmor(0, new ItemStack(Items.bow));
@@ -257,30 +290,10 @@ public IEntityLivingData onSpawnWithEgg(IEntityLivingData livingData) {
setSkeletonType(0);
addRandomArmor();
enchantEquipment();
-
- EntityFallenMount mount = null;
- if(Config.fallenMountEnabled && rand.nextFloat() <= Config.fallenKnightChanceMounted) {
- mount = new EntityFallenMount(worldObj);
- mount.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);
- mount.onSpawnWithEgg((IEntityLivingData) null);
- //NB: don;t check for entity collisions as we know the knight will collide
- if(EntityUtil.isSpaceAvailableForSpawn(worldObj, mount, false)) {
- isMounted = true;
- }
- } else {
- isMounted = false;
- }
-
- if(isMounted) {
- setCanPickUpLoot(false);
- setCanBreakDoors(false);
- worldObj.spawnEntityInWorld(mount);
- mountEntity(mount);
- } else {
- float f = this.worldObj.func_147462_b(this.posX, this.posY, this.posZ);
- setCanPickUpLoot(this.rand.nextFloat() < 0.55F * f);
- setCanBreakDoors(rand.nextFloat() < f * 0.1F);
- }
+
+ float f = this.worldObj.func_147462_b(this.posX, this.posY, this.posZ);
+ setCanPickUpLoot(this.rand.nextFloat() < 0.55F * f);
+ setCanBreakDoors(rand.nextFloat() < f * 0.1F);
return livingData;
}
@@ -4,6 +4,7 @@
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderzoo.config.Config;
import net.minecraft.entity.Entity;
+import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
@@ -16,6 +17,7 @@
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
+import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -52,7 +54,7 @@ public EntityFallenMount(World world) {
findTargetAI = new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true);
attackAI = new EntityAIAttackOnCollide(this, EntityPlayer.class, MOUNTED_ATTACK_MOVE_SPEED, false);
- updateAttackAI();
+ updateAttackAI();
}
@Override
@@ -77,6 +79,34 @@ public boolean interact(EntityPlayer p_70085_1_) {
}
@Override
+ protected boolean canDespawn() {
+ return true;
+ }
+
+ @Override
+ public boolean canMateWith(EntityAnimal p_70878_1_) {
+ return false;
+ }
+
+ @Override
+ public boolean allowLeashing() {
+ return false;
+ }
+
+ @Override
+ public boolean isBreedingItem(ItemStack p_70877_1_) {
+ return false;
+ }
+
+ @Override
+ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) {
+ if(type == EnumCreatureType.monster) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
setHorseType(3);
setHorseSaddled(true);
@@ -66,8 +66,7 @@ public EntityWitherWitch(World world) {
this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(3, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
- this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
-
+ this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
}
@Override
@@ -142,7 +142,7 @@ private boolean isRunningAway() {
}
private boolean runAway() {
-
+System.out.println("EntityAIMountedArrowAttack.runAway: ");
if(!useRunAwayTactic) {
return false;
}
@@ -152,15 +152,14 @@ private boolean runAway() {
Vec3 entityPos = EntityUtil.getEntityPosition(entityHost);
targetDir = VecUtil.subtract(targetDir, entityPos);
targetDir = VecUtil.scale(targetDir, -1);
- targetDir.normalize();
+ targetDir = targetDir.normalize();
double distance = attackRange * 0.9;
targetDir = VecUtil.scale(targetDir, distance);
targetDir = VecUtil.add(targetDir, entityPos);
Point3i probePoint = new Point3i((int) Math.round(targetDir.xCoord), (int) Math.round(entityHost.posY), (int) Math.round(targetDir.zCoord));
-
Point3i target = new Point3i(probePoint);
World world = entityHost.worldObj;
@@ -181,10 +180,13 @@ private boolean runAway() {
return false;
}
+ System.out.println("EntityAIMountedArrowAttack.runAway: " + probePoint.x +"," + probePoint.y + "," + probePoint.z);
boolean res = getNavigator().tryMoveToXYZ(probePoint.x, probePoint.y, probePoint.z, mountedEntityMoveSpeed);
if(getNavigator().noPath()) {
+ System.out.println("EntityAIMountedArrowAttack.runAway: Failed running away path");
runningAwayTo = null;
} else {
+ System.out.println("EntityAIMountedArrowAttack.runAway: found running away point");
runningAwayTo = getNavigator().getPath().getFinalPathPoint();
}
return res;

0 comments on commit b4402c5

Please sign in to comment.