Massive rework of configs, items and blocks.

I redone where the items/blocsks are stored and how the configs are
handled to clean up it and give space. You can change the config line to
AWWayofTime if you want to keep the compatibility with old configs. Now
you reference the blocks from the ModBlocks and Items from the ModItems.
This commit is contained in:
Fenn 2014-01-17 21:05:38 +00:00
parent 8601e9faff
commit e3644f2d2b
304 changed files with 3941 additions and 5108 deletions

View file

@ -1,26 +1,17 @@
package WayofTime.alchemicalWizardry.common.entity.mob;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ModItems;
import net.minecraft.block.BlockColored;
import net.minecraft.client.model.ModelIronGolem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@ -32,8 +23,7 @@ import net.minecraft.pathfinding.PathEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class EntityBileDemon extends EntityDemon
{
public class EntityBileDemon extends EntityDemon {
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
private static float maxTamedHealth = 100.0F;
@ -75,8 +65,7 @@ public class EntityBileDemon extends EntityDemon
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -102,8 +91,7 @@ public class EntityBileDemon extends EntityDemon
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -121,8 +109,8 @@ public class EntityBileDemon extends EntityDemon
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -140,8 +128,8 @@ public class EntityBileDemon extends EntityDemon
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("attackTimer", (byte)attackTimer);
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
par1NBTTagCompound.setByte("attackTimer", (byte) attackTimer);
}
/**
@ -249,8 +237,7 @@ public class EntityBileDemon extends EntityDemon
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -267,8 +254,8 @@ public class EntityBileDemon extends EntityDemon
public boolean attackEntityAsMob(Entity par1Entity)
{
this.attackTimer = 10;
this.worldObj.setEntityState(this, (byte)4);
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(7 + this.rand.nextInt(15)));
this.worldObj.setEntityState(this, (byte) 4);
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15)));
if (flag)
{
@ -286,8 +273,7 @@ public class EntityBileDemon extends EntityDemon
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -306,7 +292,7 @@ public class EntityBileDemon extends EntityDemon
{
if (Item.itemsList[itemstack.itemID] instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
ItemFood itemfood = (ItemFood) Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < this.maxTamedHealth)
{
@ -315,11 +301,11 @@ public class EntityBileDemon extends EntityDemon
--itemstack.stackSize;
}
this.heal((float)itemfood.getHealAmount());
this.heal((float) itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
return true;
@ -327,21 +313,20 @@ public class EntityBileDemon extends EntityDemon
}
}
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
{
if (!this.worldObj.isRemote)
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setTarget((Entity) null);
this.setAttackTarget((EntityLivingBase) null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
}
else if (itemstack != null && itemstack.itemID == AlchemicalWizardry.weakBloodOrb.itemID && !this.isAngry())
} else if (itemstack != null && itemstack.itemID == ModItems.weakBloodOrb.itemID && !this.isAngry())
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
@ -350,7 +335,7 @@ public class EntityBileDemon extends EntityDemon
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
if (!this.worldObj.isRemote)
@ -358,18 +343,17 @@ public class EntityBileDemon extends EntityDemon
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(this.maxTamedHealth);
this.setOwner(par1EntityPlayer.getCommandSenderName());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
this.worldObj.setEntityState(this, (byte) 7);
} else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
this.worldObj.setEntityState(this, (byte) 6);
}
}
@ -406,11 +390,10 @@ public class EntityBileDemon extends EntityDemon
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -427,7 +410,7 @@ public class EntityBileDemon extends EntityDemon
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -442,11 +425,10 @@ public class EntityBileDemon extends EntityDemon
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -478,7 +460,7 @@ public class EntityBileDemon extends EntityDemon
{
if (par1EntityLivingBase instanceof EntityBileDemon)
{
EntityBileDemon entitywolf = (EntityBileDemon)par1EntityLivingBase;
EntityBileDemon entitywolf = (EntityBileDemon) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -486,9 +468,8 @@ public class EntityBileDemon extends EntityDemon
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
}
else
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
} else
{
return false;
}

View file

@ -1,64 +1,19 @@
package WayofTime.alchemicalWizardry.common.entity.mob;
import java.util.Calendar;
import java.util.UUID;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.ModItems;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityLivingData;
import net.minecraft.entity.EntityOwnable;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIBeg;
import net.minecraft.entity.ai.EntityAIBreakDoor;
import net.minecraft.entity.ai.EntityAIFleeSun;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIMoveThroughVillage;
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAIRestrictSun;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITargetNonTamed;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.AttributeInstance;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.RangedAttribute;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@ -67,16 +22,10 @@ import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.stats.AchievementList;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderHell;
public class EntityBoulderFist extends EntityDemon
{
public class EntityBoulderFist extends EntityDemon {
//private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
@ -125,8 +74,7 @@ public class EntityBoulderFist extends EntityDemon
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -152,8 +100,7 @@ public class EntityBoulderFist extends EntityDemon
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -171,8 +118,8 @@ public class EntityBoulderFist extends EntityDemon
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -190,7 +137,7 @@ public class EntityBoulderFist extends EntityDemon
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
}
/**
@ -289,8 +236,7 @@ public class EntityBoulderFist extends EntityDemon
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -307,7 +253,7 @@ public class EntityBoulderFist extends EntityDemon
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 6 : 7;
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
public void setTamed(boolean par1)
@ -317,8 +263,7 @@ public class EntityBoulderFist extends EntityDemon
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -337,7 +282,7 @@ public class EntityBoulderFist extends EntityDemon
{
if (Item.itemsList[itemstack.itemID] instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
ItemFood itemfood = (ItemFood) Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < this.maxTamedHealth)
{
@ -346,11 +291,11 @@ public class EntityBoulderFist extends EntityDemon
--itemstack.stackSize;
}
this.heal((float)itemfood.getHealAmount());
this.heal((float) itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
return true;
@ -358,21 +303,20 @@ public class EntityBoulderFist extends EntityDemon
}
}
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
{
if (!this.worldObj.isRemote)
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setTarget((Entity) null);
this.setAttackTarget((EntityLivingBase) null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
}
else if (itemstack != null && itemstack.itemID == AlchemicalWizardry.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
} else if (itemstack != null && itemstack.itemID == ModItems.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
@ -381,7 +325,7 @@ public class EntityBoulderFist extends EntityDemon
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
if (!this.worldObj.isRemote)
@ -389,18 +333,17 @@ public class EntityBoulderFist extends EntityDemon
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(this.maxTamedHealth);
this.setOwner(par1EntityPlayer.getCommandSenderName());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
this.worldObj.setEntityState(this, (byte) 7);
} else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
this.worldObj.setEntityState(this, (byte) 6);
}
}
@ -437,11 +380,10 @@ public class EntityBoulderFist extends EntityDemon
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -458,7 +400,7 @@ public class EntityBoulderFist extends EntityDemon
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -473,11 +415,10 @@ public class EntityBoulderFist extends EntityDemon
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -509,7 +450,7 @@ public class EntityBoulderFist extends EntityDemon
{
if (par1EntityLivingBase instanceof EntityBoulderFist)
{
EntityBoulderFist entitywolf = (EntityBoulderFist)par1EntityLivingBase;
EntityBoulderFist entitywolf = (EntityBoulderFist) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -517,9 +458,8 @@ public class EntityBoulderFist extends EntityDemon
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
}
else
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
} else
{
return false;
}

View file

@ -1,17 +1,17 @@
package WayofTime.alchemicalWizardry.common.entity.mob;
import WayofTime.alchemicalWizardry.common.IDemon;
import WayofTime.alchemicalWizardry.common.ModItems;
import WayofTime.alchemicalWizardry.common.items.DemonPlacer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.IDemon;
import WayofTime.alchemicalWizardry.common.items.DemonPlacer;
public class EntityDemon extends EntityTameable implements IDemon
{
public class EntityDemon extends EntityTameable implements IDemon {
private boolean isAggro;
private int demonID;
@ -48,7 +48,7 @@ public class EntityDemon extends EntityTameable implements IDemon
protected void dropFewItems(boolean par1, int par2)
{
ItemStack drop = new ItemStack(AlchemicalWizardry.demonPlacer, 1, this.getDemonID());
ItemStack drop = new ItemStack(ModItems.demonPlacer, 1, this.getDemonID());
DemonPlacer.setOwnerName(drop, this.getOwnerName());
if (this.hasCustomNameTag())
@ -78,8 +78,7 @@ public class EntityDemon extends EntityTameable implements IDemon
if (isSitting)
{
chatmessagecomponent.addText("I will stay here for now, Master.");
}
else
} else
{
chatmessagecomponent.addText("I shall follow and protect you!");
}
@ -92,4 +91,10 @@ public class EntityDemon extends EntityTameable implements IDemon
{
return this.demonID;
}
@Override
public Entity getOwner()
{
return func_130012_q();
}
}

View file

@ -9,8 +9,7 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class EntityEarthElemental extends EntityElemental implements IMob
{
public class EntityEarthElemental extends EntityElemental implements IMob {
public EntityEarthElemental(World world)
{
super(world, AlchemicalWizardry.entityEarthElementalID);
@ -20,9 +19,9 @@ public class EntityEarthElemental extends EntityElemental implements IMob
{
if (target instanceof EntityLivingBase)
{
((EntityLivingBase)target).attackEntityFrom(DamageSource.causeMobDamage(this), 10);
((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 4));
((EntityLivingBase)target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
((EntityLivingBase) target).attackEntityFrom(DamageSource.causeMobDamage(this), 10);
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 4));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
}
}
}

View file

@ -1,27 +1,16 @@
package WayofTime.alchemicalWizardry.common.entity.mob;
import java.util.List;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityAnimal;
@ -29,22 +18,17 @@ import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityLargeFireball;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityElemental extends EntityDemon
{
import java.util.List;
public class EntityElemental extends EntityDemon {
//private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
@ -73,33 +57,40 @@ public class EntityElemental extends EntityDemon
public double waypointZ;
private Entity targetedEntity;
/** Cooldown time between target loss and new target aquirement. */
/**
* Cooldown time between target loss and new target aquirement.
*/
private int aggroCooldown;
public int prevAttackCounter;
public int attackCounter;
/** The explosion radius of spawned fireballs. */
/**
* The explosion radius of spawned fireballs.
*/
//private int explosionStrength = 1;
//
// private int heightOffsetUpdateTime;
// private float heightOffset = 0.5F;
// private int field_70846_g;
protected void dropFewItems(boolean par1, int par2)
{
if (worldObj.rand.nextFloat() < (1 - Math.pow(0.6f, par2 + 1)))
{
this.entityDropItem(new ItemStack(AlchemicalWizardry.demonBloodShard, 1, 0), 0.0f);
this.entityDropItem(new ItemStack(ModItems.demonBloodShard, 1, 0), 0.0f);
}
}
protected void fall(float par1) {}
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
*/
protected void updateFallState(double par1, boolean par3) {}
protected void updateFallState(double par1, boolean par3)
{
}
/**
* Moves the entity based on the specified heading. Args: strafe, forward
@ -113,16 +104,14 @@ public class EntityElemental extends EntityDemon
this.motionX *= 0.800000011920929D;
this.motionY *= 0.800000011920929D;
this.motionZ *= 0.800000011920929D;
}
else if (this.handleLavaMovement())
} else if (this.handleLavaMovement())
{
this.moveFlying(par1, par2, 0.02F);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.5D;
this.motionY *= 0.5D;
this.motionZ *= 0.5D;
}
else
} else
{
float f2 = 0.91F;
@ -153,9 +142,9 @@ public class EntityElemental extends EntityDemon
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= (double)f2;
this.motionY *= (double)f2;
this.motionZ *= (double)f2;
this.motionX *= (double) f2;
this.motionY *= (double) f2;
this.motionZ *= (double) f2;
}
double d0 = this.posX - this.prevPosX;
@ -203,27 +192,26 @@ public class EntityElemental extends EntityDemon
if (d3 < 1.0D || d3 > 3600.0D)
{
this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
}
if (this.courseChangeCooldown-- <= 0)
{
this.courseChangeCooldown += this.rand.nextInt(5) + 2;
d3 = (double)MathHelper.sqrt_double(d3);
d3 = (double) MathHelper.sqrt_double(d3);
if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3))
{
this.motionX += d0 / d3 * 0.1D;
this.motionY += d1 / d3 * 0.1D;
this.motionZ += d2 / d3 * 0.1D;
}
else
} else
{
this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
}
}
@ -247,9 +235,9 @@ public class EntityElemental extends EntityDemon
if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4)
{
double d5 = this.targetedEntity.posX - this.posX;
double d6 = this.targetedEntity.boundingBox.minY + (double)(this.targetedEntity.height / 2.0F) - (this.posY + (double)(this.height / 2.0F));
double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - (this.posY + (double) (this.height / 2.0F));
double d7 = this.targetedEntity.posZ - this.posZ;
this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(d5, d7)) * 180.0F / (float)Math.PI;
this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI;
if (this.courseChangeCooldown <= 0)
{
@ -261,12 +249,11 @@ public class EntityElemental extends EntityDemon
this.motionX += d5 / d3 * 0.1D;
this.motionY += d6 / d3 * 0.1D;
this.motionZ += d7 / d3 * 0.1D;
}
else
} else
{
this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.motionX += d5 / d3 * 0.1D;
this.motionY += d6 / d3 * 0.1D;
this.motionZ += d7 / d3 * 0.1D;
@ -285,20 +272,18 @@ public class EntityElemental extends EntityDemon
if (this.attackCounter >= 10)
{
this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1008, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1008, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
this.inflictEffectOnEntity(this.targetedEntity);
this.attackCounter = -40;
}
}
}
else if (this.attackCounter > 0)
} else if (this.attackCounter > 0)
{
--this.attackCounter;
}
}
else
} else
{
this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI;
this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float) Math.PI;
if (this.attackCounter > 0)
{
@ -309,7 +294,7 @@ public class EntityElemental extends EntityDemon
if (!this.worldObj.isRemote)
{
byte b0 = this.dataWatcher.getWatchableObjectByte(25);
byte b1 = (byte)(this.attackCounter > 10 ? 1 : 0);
byte b1 = (byte) (this.attackCounter > 10 ? 1 : 0);
if (b0 != b1)
{
@ -328,7 +313,7 @@ public class EntityElemental extends EntityDemon
double d6 = (this.waypointZ - this.posZ) / par7;
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
for (int i = 1; (double)i < par7; ++i)
for (int i = 1; (double) i < par7; ++i)
{
axisalignedbb.offset(d4, d5, d6);
@ -356,7 +341,7 @@ public class EntityElemental extends EntityDemon
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
}
/**
@ -386,8 +371,7 @@ public class EntityElemental extends EntityDemon
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -413,8 +397,7 @@ public class EntityElemental extends EntityDemon
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -432,9 +415,9 @@ public class EntityElemental extends EntityDemon
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(25, Byte.valueOf((byte)0));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(25, Byte.valueOf((byte) 0));
}
/**
@ -525,8 +508,7 @@ public class EntityElemental extends EntityDemon
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -543,7 +525,7 @@ public class EntityElemental extends EntityDemon
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 6 : 7;
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
public void setTamed(boolean par1)
@ -553,8 +535,7 @@ public class EntityElemental extends EntityDemon
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -591,11 +572,10 @@ public class EntityElemental extends EntityDemon
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -612,7 +592,7 @@ public class EntityElemental extends EntityDemon
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -627,11 +607,10 @@ public class EntityElemental extends EntityDemon
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -664,7 +643,7 @@ public class EntityElemental extends EntityDemon
{
if (par1EntityLivingBase instanceof EntityBoulderFist)
{
EntityBoulderFist entitywolf = (EntityBoulderFist)par1EntityLivingBase;
EntityBoulderFist entitywolf = (EntityBoulderFist) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -672,10 +651,9 @@ public class EntityElemental extends EntityDemon
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
//return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).func_96122_a((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).func_110248_bS();
}
else
} else
{
return false;
}
@ -704,30 +682,30 @@ public class EntityElemental extends EntityDemon
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 0));
}
}
public static Entity getClosestVulnerableMonsterToEntity(Entity par1Entity, double par2)
{
double d4 = -1.0D;
double par1 = par1Entity.posX;
double par3 = par1Entity.posY;
double par5 = par1Entity.posZ;
double d4 = -1.0D;
double par1 = par1Entity.posX;
double par3 = par1Entity.posY;
double par5 = par1Entity.posZ;
EntityLivingBase entityLiving = null;
World world = par1Entity.worldObj;
double range = Math.sqrt(par2);
double verticalRange = Math.sqrt(par2);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(par1 - 0.5f, par3 - 0.5f, par5 - 0.5f, par1 + 0.5f, par3 + 0.5f, par5 + 0.5f).expand(range, verticalRange, range));
if(entities == null)
if (entities == null)
{
return null;
return null;
}
for (int i = 0; i < entities.size(); ++i)
{
EntityLivingBase entityLiving1 = entities.get(i);
if (!(entityLiving1 instanceof EntityPlayer && ((EntityPlayer)entityLiving1).capabilities.disableDamage) && entityLiving1.isEntityAlive())
if (!(entityLiving1 instanceof EntityPlayer && ((EntityPlayer) entityLiving1).capabilities.disableDamage) && entityLiving1.isEntityAlive())
{
double d5 = entityLiving1.getDistanceSq(par1, par3, par5);
double d6 = par2;
@ -739,30 +717,30 @@ public class EntityElemental extends EntityDemon
if (entityLiving1.isInvisible())
{
float f = entityLiving1 instanceof EntityPlayer ? ((EntityPlayer)entityLiving1).getArmorVisibility() : 1.0f;
float f = entityLiving1 instanceof EntityPlayer ? ((EntityPlayer) entityLiving1).getArmorVisibility() : 1.0f;
if (f < 0.1F)
{
f = 0.1F;
}
d6 *= (double)(0.7F * f);
d6 *= (double) (0.7F * f);
}
if ((par2 < 0.0D || d5 < d6 * d6) && (d4 == -1.0D || d5 < d4))
{
if(par1Entity != entityLiving1)
{
d4 = d5;
if (par1Entity != entityLiving1)
{
d4 = d5;
entityLiving = entityLiving1;
}
}
}
}
}
return entityLiving;
}
@Override
public int getTotalArmorValue() //TODO
{

View file

@ -1,64 +1,17 @@
package WayofTime.alchemicalWizardry.common.entity.mob;
import java.util.Calendar;
import java.util.UUID;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.ModItems;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityLivingData;
import net.minecraft.entity.EntityOwnable;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIBeg;
import net.minecraft.entity.ai.EntityAIBreakDoor;
import net.minecraft.entity.ai.EntityAIFleeSun;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIMoveThroughVillage;
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAIRestrictSun;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITargetNonTamed;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.AttributeInstance;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.RangedAttribute;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@ -67,16 +20,10 @@ import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.stats.AchievementList;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderHell;
public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob, Player
{
public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob, Player {
private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
@ -125,8 +72,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -152,8 +98,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -171,8 +116,8 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -190,7 +135,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
}
/**
@ -289,8 +234,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -307,7 +251,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 4 : 2;
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
public void setTamed(boolean par1)
@ -317,8 +261,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -337,7 +280,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
{
if (Item.itemsList[itemstack.itemID] instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
ItemFood itemfood = (ItemFood) Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < this.maxTamedHealth)
{
@ -346,11 +289,11 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
--itemstack.stackSize;
}
this.heal((float)itemfood.getHealAmount());
this.heal((float) itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
return true;
@ -364,15 +307,14 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setTarget((Entity) null);
this.setAttackTarget((EntityLivingBase) null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
}
else if (itemstack != null && itemstack.itemID == AlchemicalWizardry.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
} else if (itemstack != null && itemstack.itemID == ModItems.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
@ -381,7 +323,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
if (!this.worldObj.isRemote)
@ -389,18 +331,17 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(this.maxTamedHealth);
this.setOwner(par1EntityPlayer.getCommandSenderName());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
this.worldObj.setEntityState(this, (byte) 7);
} else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
this.worldObj.setEntityState(this, (byte) 6);
}
}
@ -437,11 +378,10 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -458,7 +398,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -473,11 +413,10 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -509,7 +448,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
{
if (par1EntityLivingBase instanceof EntityFallenAngel)
{
EntityFallenAngel entitywolf = (EntityFallenAngel)par1EntityLivingBase;
EntityFallenAngel entitywolf = (EntityFallenAngel) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -517,9 +456,8 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob,
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
}
else
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
} else
{
return false;
}

View file

@ -4,14 +4,10 @@ import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
public class EntityFireElemental extends EntityElemental implements IMob
{
public class EntityFireElemental extends EntityElemental implements IMob {
public EntityFireElemental(World world)
{
super(world, AlchemicalWizardry.entityFireElementalID);
@ -22,8 +18,8 @@ public class EntityFireElemental extends EntityElemental implements IMob
{
if (target instanceof EntityLivingBase)
{
((EntityLivingBase)target).setFire(10);
((EntityLivingBase)target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
((EntityLivingBase) target).setFire(10);
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
}
}
}

View file

@ -4,16 +4,12 @@ import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
public class EntityHolyElemental extends EntityElemental implements IMob
{
public class EntityHolyElemental extends EntityElemental implements IMob {
public EntityHolyElemental(World world)
{
super(world, AlchemicalWizardry.entityHolyElementalID);
@ -23,9 +19,9 @@ public class EntityHolyElemental extends EntityElemental implements IMob
{
if (target instanceof EntityLivingBase)
{
((EntityLivingBase)target).attackEntityFrom(DamageSource.causeMobDamage(this), 15);
((EntityLivingBase)target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.poison.id, 100, 1));
((EntityLivingBase) target).attackEntityFrom(DamageSource.causeMobDamage(this), 15);
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.poison.id, 100, 1));
}
}
}

View file

@ -2,24 +2,12 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.ModItems;
import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityAnimal;
@ -35,8 +23,7 @@ import net.minecraft.pathfinding.PathEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
{
public class EntityIceDemon extends EntityDemon implements IRangedAttackMob {
private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 30, 50, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
@ -85,8 +72,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -112,8 +98,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -131,8 +116,8 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -150,7 +135,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
}
/**
@ -226,11 +211,11 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
{
if (worldObj.rand.nextFloat() < 0.25f)
{
int blockID = worldObj.getBlockId((int)posX + i, (int)posY + j, (int)posZ + k);
int blockID = worldObj.getBlockId((int) posX + i, (int) posY + j, (int) posZ + k);
if (blockID == Block.waterStill.blockID || blockID == Block.waterMoving.blockID)
{
worldObj.setBlock((int)posX + i, (int)posY + j, (int)posZ + k, Block.ice.blockID);
worldObj.setBlock((int) posX + i, (int) posY + j, (int) posZ + k, Block.ice.blockID);
}
}
}
@ -268,8 +253,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -286,7 +270,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 4 : 2;
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
public void setTamed(boolean par1)
@ -296,8 +280,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -316,7 +299,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
{
if (Item.itemsList[itemstack.itemID] instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
ItemFood itemfood = (ItemFood) Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < this.maxTamedHealth)
{
@ -325,11 +308,11 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
--itemstack.stackSize;
}
this.heal((float)itemfood.getHealAmount());
this.heal((float) itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
return true;
@ -343,15 +326,14 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setTarget((Entity) null);
this.setAttackTarget((EntityLivingBase) null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
}
else if (itemstack != null && itemstack.itemID == AlchemicalWizardry.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
} else if (itemstack != null && itemstack.itemID == ModItems.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
@ -360,7 +342,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
if (!this.worldObj.isRemote)
@ -368,18 +350,17 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(this.maxTamedHealth);
this.setOwner(par1EntityPlayer.getCommandSenderName());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
this.worldObj.setEntityState(this, (byte) 7);
} else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
this.worldObj.setEntityState(this, (byte) 6);
}
}
@ -416,11 +397,10 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -437,7 +417,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -452,11 +432,10 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -488,7 +467,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
{
if (par1EntityLivingBase instanceof EntityIceDemon)
{
EntityIceDemon entitywolf = (EntityIceDemon)par1EntityLivingBase;
EntityIceDemon entitywolf = (EntityIceDemon) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -496,9 +475,8 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
}
else
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
} else
{
return false;
}

View file

@ -2,30 +2,17 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.ModItems;
import net.minecraft.block.BlockColored;
import net.minecraft.client.model.ModelIronGolem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITargetNonTamed;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@ -36,10 +23,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.Player;
public class EntityLowerGuardian extends EntityDemon
{
public class EntityLowerGuardian extends EntityDemon {
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
private static float maxTamedHealth = 50.0F;
@ -84,8 +69,7 @@ public class EntityLowerGuardian extends EntityDemon
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -111,8 +95,7 @@ public class EntityLowerGuardian extends EntityDemon
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -130,8 +113,8 @@ public class EntityLowerGuardian extends EntityDemon
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -149,8 +132,8 @@ public class EntityLowerGuardian extends EntityDemon
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("attackTimer", (byte)attackTimer);
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
par1NBTTagCompound.setByte("attackTimer", (byte) attackTimer);
par1NBTTagCompound.setBoolean("isAggro", this.isAggro());
}
@ -260,8 +243,7 @@ public class EntityLowerGuardian extends EntityDemon
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -278,8 +260,8 @@ public class EntityLowerGuardian extends EntityDemon
public boolean attackEntityAsMob(Entity par1Entity)
{
this.attackTimer = 10;
this.worldObj.setEntityState(this, (byte)4);
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(7 + this.rand.nextInt(15)));
this.worldObj.setEntityState(this, (byte) 4);
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15)));
if (flag)
{
@ -297,8 +279,7 @@ public class EntityLowerGuardian extends EntityDemon
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -317,7 +298,7 @@ public class EntityLowerGuardian extends EntityDemon
{
if (Item.itemsList[itemstack.itemID] instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
ItemFood itemfood = (ItemFood) Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectInt(18) < this.maxTamedHealth)
{
@ -326,11 +307,11 @@ public class EntityLowerGuardian extends EntityDemon
--itemstack.stackSize;
}
this.heal((float)itemfood.getHealAmount());
this.heal((float) itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
return true;
@ -344,15 +325,14 @@ public class EntityLowerGuardian extends EntityDemon
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setTarget((Entity) null);
this.setAttackTarget((EntityLivingBase) null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
}
else if (itemstack != null && itemstack.itemID == AlchemicalWizardry.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
} else if (itemstack != null && itemstack.itemID == ModItems.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
@ -361,7 +341,7 @@ public class EntityLowerGuardian extends EntityDemon
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
if (!this.worldObj.isRemote)
@ -369,18 +349,17 @@ public class EntityLowerGuardian extends EntityDemon
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(this.maxTamedHealth);
this.setOwner(par1EntityPlayer.getCommandSenderName());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
this.worldObj.setEntityState(this, (byte) 7);
} else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
this.worldObj.setEntityState(this, (byte) 6);
}
}
@ -417,11 +396,10 @@ public class EntityLowerGuardian extends EntityDemon
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -438,7 +416,7 @@ public class EntityLowerGuardian extends EntityDemon
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -453,11 +431,10 @@ public class EntityLowerGuardian extends EntityDemon
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -489,7 +466,7 @@ public class EntityLowerGuardian extends EntityDemon
{
if (par1EntityLivingBase instanceof EntityLowerGuardian)
{
EntityLowerGuardian entitywolf = (EntityLowerGuardian)par1EntityLivingBase;
EntityLowerGuardian entitywolf = (EntityLowerGuardian) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -497,9 +474,8 @@ public class EntityLowerGuardian extends EntityDemon
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
}
else
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
} else
{
return false;
}

View file

@ -2,22 +2,14 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.ModItems;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityAnimal;
@ -33,8 +25,7 @@ import net.minecraft.pathfinding.PathEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class EntityShade extends EntityDemon
{
public class EntityShade extends EntityDemon {
//private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
@ -83,8 +74,7 @@ public class EntityShade extends EntityDemon
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -110,8 +100,7 @@ public class EntityShade extends EntityDemon
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -129,8 +118,8 @@ public class EntityShade extends EntityDemon
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -148,7 +137,7 @@ public class EntityShade extends EntityDemon
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
}
/**
@ -247,8 +236,7 @@ public class EntityShade extends EntityDemon
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -265,7 +253,7 @@ public class EntityShade extends EntityDemon
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 6 : 7;
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
public void setTamed(boolean par1)
@ -275,8 +263,7 @@ public class EntityShade extends EntityDemon
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -295,7 +282,7 @@ public class EntityShade extends EntityDemon
{
if (Item.itemsList[itemstack.itemID] instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
ItemFood itemfood = (ItemFood) Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < this.maxTamedHealth)
{
@ -304,11 +291,11 @@ public class EntityShade extends EntityDemon
--itemstack.stackSize;
}
this.heal((float)itemfood.getHealAmount());
this.heal((float) itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
return true;
@ -316,21 +303,20 @@ public class EntityShade extends EntityDemon
}
}
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
{
if (!this.worldObj.isRemote)
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setTarget((Entity) null);
this.setAttackTarget((EntityLivingBase) null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
}
else if (itemstack != null && itemstack.itemID == AlchemicalWizardry.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
} else if (itemstack != null && itemstack.itemID == ModItems.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
@ -339,7 +325,7 @@ public class EntityShade extends EntityDemon
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
if (!this.worldObj.isRemote)
@ -347,18 +333,17 @@ public class EntityShade extends EntityDemon
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(this.maxTamedHealth);
this.setOwner(par1EntityPlayer.getCommandSenderName());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
this.worldObj.setEntityState(this, (byte) 7);
} else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
this.worldObj.setEntityState(this, (byte) 6);
}
}
@ -395,11 +380,10 @@ public class EntityShade extends EntityDemon
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -416,7 +400,7 @@ public class EntityShade extends EntityDemon
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -431,11 +415,10 @@ public class EntityShade extends EntityDemon
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -467,7 +450,7 @@ public class EntityShade extends EntityDemon
{
if (par1EntityLivingBase instanceof EntityBoulderFist)
{
EntityBoulderFist entitywolf = (EntityBoulderFist)par1EntityLivingBase;
EntityBoulderFist entitywolf = (EntityBoulderFist) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -475,9 +458,8 @@ public class EntityShade extends EntityDemon
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
}
else
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
} else
{
return false;
}

View file

@ -8,8 +8,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class EntityShadeElemental extends EntityElemental implements IMob
{
public class EntityShadeElemental extends EntityElemental implements IMob {
public EntityShadeElemental(World world)
{
super(world, AlchemicalWizardry.entityShadeElementalID);
@ -19,9 +18,9 @@ public class EntityShadeElemental extends EntityElemental implements IMob
{
if (target instanceof EntityLivingBase)
{
((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 1));
((EntityLivingBase)target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.nightVision.id, 100, 0));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 1));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.nightVision.id, 100, 0));
}
}
}

View file

@ -2,28 +2,16 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.ModItems;
import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile;
import cpw.mods.fml.common.network.Player;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@ -34,10 +22,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.Player;
public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackMob, Player
{
public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackMob, Player {
private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 25, 25, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
@ -86,8 +72,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -113,8 +98,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -132,8 +116,8 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -151,7 +135,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
}
/**
@ -249,8 +233,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -267,7 +250,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 4 : 2;
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
public void setTamed(boolean par1)
@ -277,8 +260,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -297,7 +279,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
{
if (Item.itemsList[itemstack.itemID] instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
ItemFood itemfood = (ItemFood) Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < this.maxTamedHealth)
{
@ -306,11 +288,11 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
--itemstack.stackSize;
}
this.heal((float)itemfood.getHealAmount());
this.heal((float) itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
return true;
@ -318,21 +300,20 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
}
}
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
{
if (!this.worldObj.isRemote)
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setTarget((Entity) null);
this.setAttackTarget((EntityLivingBase) null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
}
else if (itemstack != null && itemstack.itemID == AlchemicalWizardry.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
} else if (itemstack != null && itemstack.itemID == ModItems.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
@ -341,7 +322,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
if (!this.worldObj.isRemote)
@ -349,18 +330,17 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(this.maxTamedHealth);
this.setOwner(par1EntityPlayer.getCommandSenderName());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
this.worldObj.setEntityState(this, (byte) 7);
} else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
this.worldObj.setEntityState(this, (byte) 6);
}
}
@ -397,11 +377,10 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -418,7 +397,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -433,11 +412,10 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -469,7 +447,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
{
if (par1EntityLivingBase instanceof EntitySmallEarthGolem)
{
EntitySmallEarthGolem entitywolf = (EntitySmallEarthGolem)par1EntityLivingBase;
EntitySmallEarthGolem entitywolf = (EntitySmallEarthGolem) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -477,9 +455,8 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
}
else
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
} else
{
return false;
}

View file

@ -7,8 +7,7 @@ import net.minecraft.entity.monster.IMob;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class EntityWaterElemental extends EntityElemental implements IMob
{
public class EntityWaterElemental extends EntityElemental implements IMob {
public EntityWaterElemental(World world)
{
super(world, AlchemicalWizardry.entityWaterElementalID);
@ -18,8 +17,8 @@ public class EntityWaterElemental extends EntityElemental implements IMob
{
if (target instanceof EntityLivingBase)
{
((EntityLivingBase)target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 2));
((EntityLivingBase)target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 2));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
}
}
}

View file

@ -2,29 +2,16 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.ModItems;
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
import cpw.mods.fml.common.network.Player;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@ -35,10 +22,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.Player;
public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackMob, Player
{
public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackMob, Player {
private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
@ -87,8 +72,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -114,8 +98,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
if (par1EntityLivingBase == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
} else if (!this.isTamed())
{
this.setAngry(true);
}
@ -133,8 +116,8 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1)));
this.dataWatcher.addObject(19, new Byte((byte) 0));
this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -152,7 +135,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor());
par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor());
}
/**
@ -194,6 +177,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
{
return "mob.blaze.death";
}
/**
* Returns the volume for the sounds this mob makes.
*/
@ -249,8 +233,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
if (this.isEntityInvulnerable())
{
return false;
}
else
} else
{
Entity entity = par1DamageSource.getEntity();
this.aiSit.setSitting(false);
@ -267,7 +250,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 4 : 2;
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
public void setTamed(boolean par1)
@ -277,8 +260,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
if (par1)
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxTamedHealth);
}
else
} else
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(this.maxUntamedHealth);
}
@ -297,7 +279,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
{
if (Item.itemsList[itemstack.itemID] instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
ItemFood itemfood = (ItemFood) Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < this.maxTamedHealth)
{
@ -306,11 +288,11 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
--itemstack.stackSize;
}
this.heal((float)itemfood.getHealAmount());
this.heal((float) itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
return true;
@ -318,21 +300,20 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
}
}
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.isBreedingItem(itemstack))
{
if (!this.worldObj.isRemote)
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setTarget((Entity) null);
this.setAttackTarget((EntityLivingBase) null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
}
else if (itemstack != null && itemstack.itemID == AlchemicalWizardry.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
} else if (itemstack != null && itemstack.itemID == ModItems.weakBloodOrb.itemID && !this.isAngry() && !this.isAggro())
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
@ -341,7 +322,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
}
if (!this.worldObj.isRemote)
@ -349,18 +330,17 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.setPathToEntity((PathEntity) null);
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(this.maxTamedHealth);
this.setOwner(par1EntityPlayer.getCommandSenderName());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
this.worldObj.setEntityState(this, (byte) 7);
} else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
this.worldObj.setEntityState(this, (byte) 6);
}
}
@ -397,11 +377,10 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
if (par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
} else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
}
}
@ -418,7 +397,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
*/
public void setCollarColor(int par1)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15)));
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (par1 & 15)));
}
/**
@ -433,11 +412,10 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
{
if (par1)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
} else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
}
}
@ -469,7 +447,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
{
if (par1EntityLivingBase instanceof EntityWingedFireDemon)
{
EntityWingedFireDemon entitywolf = (EntityWingedFireDemon)par1EntityLivingBase;
EntityWingedFireDemon entitywolf = (EntityWingedFireDemon) par1EntityLivingBase;
if (entitywolf.isTamed() && entitywolf.func_130012_q() == par2EntityLivingBase)
{
@ -477,9 +455,8 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
}
}
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
}
else
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
} else
{
return false;
}
@ -498,7 +475,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM
double xCoord;
double yCoord;
double zCoord;
this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
this.worldObj.spawnEntityInWorld(hol);
}