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

View file

@ -1,8 +1,7 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import java.util.Iterator;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -11,28 +10,23 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.util.*;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Iterator;
import java.util.List;
//Shamelessly ripped off from x3n0ph0b3
public class EnergyBlastProjectile extends Entity implements IProjectile
{
public class EnergyBlastProjectile extends Entity implements IProjectile {
protected int xTile = -1;
protected int yTile = -1;
protected int zTile = -1;
protected int inTile = 0;
protected int inData = 0;
protected boolean inGround = false;
/** The owner of this arrow. */
/**
* The owner of this arrow.
*/
public EntityLivingBase shootingEntity;
protected int ticksInAir = 0;
protected int maxTicksInAir = 600;
@ -61,14 +55,14 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
float par3 = 0.8F;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
posX -= MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
posY -= 0.2D;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float)Math.PI);
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
this.projectileDamage = damage;
this.maxTicksInAir = 600;
@ -81,14 +75,14 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
float par3 = 0.8F;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
posX -= MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
posY -= 0.2D;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float)Math.PI);
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
this.projectileDamage = damage;
this.maxTicksInAir = maxTicksInAir;
@ -99,21 +93,21 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
super(par1World);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = par2EntityLivingBase;
this.posY = par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D;
this.posY = par2EntityLivingBase.posY + (double) par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D;
double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX;
double d1 = par3EntityLivingBase.boundingBox.minY + (double)(par3EntityLivingBase.height / 1.5F) - this.posY;
double d1 = par3EntityLivingBase.boundingBox.minY + (double) (par3EntityLivingBase.height / 1.5F) - this.posY;
double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ;
double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (d3 >= 1.0E-7D)
{
float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));
float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI));
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3);
this.yOffset = 0.0F;
float f4 = (float)d3 * 0.2F;
float f4 = (float) d3 * 0.2F;
this.setThrowableHeading(d0, d1, d2, par4, par5);
}
@ -124,7 +118,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
@Override
protected void entityInit()
{
dataWatcher.addObject(16, Byte.valueOf((byte)0));
dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
@ -148,8 +142,8 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
motionY = var3;
motionZ = var5;
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
prevRotationYaw = rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(var3, var10) * 180.0D / Math.PI);
prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
}
@Override
@ -178,8 +172,8 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
{
float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
prevRotationYaw = rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(par3, var7) * 180.0D / Math.PI);
prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch;
prevRotationYaw = rotationYaw;
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
@ -208,7 +202,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
while (i.hasNext())
{
EntityPlayer e = (EntityPlayer)i.next();
EntityPlayer e = (EntityPlayer) i.next();
double distance = e.getDistanceToEntity(this);
if (distance < closestDistance)
@ -226,8 +220,8 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
{
float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
prevRotationYaw = rotationYaw = (float)(Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(motionY, var1) * 180.0D / Math.PI);
prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI);
}
int var16 = worldObj.getBlockId(xTile, yTile, zTile);
@ -253,8 +247,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
// this.groundImpact();
// this.setDead();
}
}
else
} else
{
++ticksInAir;
@ -286,7 +279,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
while (var9.hasNext())
{
Entity var10 = (Entity)var9.next();
Entity var10 = (Entity) var9.next();
if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5))
{
@ -343,12 +336,12 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
par1NBTTagCompound.setShort("xTile", (short)xTile);
par1NBTTagCompound.setShort("yTile", (short)yTile);
par1NBTTagCompound.setShort("zTile", (short)zTile);
par1NBTTagCompound.setByte("inTile", (byte)inTile);
par1NBTTagCompound.setByte("inData", (byte)inData);
par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
par1NBTTagCompound.setShort("xTile", (short) xTile);
par1NBTTagCompound.setShort("yTile", (short) yTile);
par1NBTTagCompound.setShort("zTile", (short) zTile);
par1NBTTagCompound.setByte("inTile", (byte) inTile);
par1NBTTagCompound.setByte("inData", (byte) inData);
par1NBTTagCompound.setByte("inGround", (byte) (inGround ? 1 : 0));
par1NBTTagCompound.setInteger("ticksInAir", ticksInAir);
par1NBTTagCompound.setInteger("maxTicksInAir", maxTicksInAir);
par1NBTTagCompound.setInteger("projectileDamage", this.projectileDamage);
@ -414,11 +407,10 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
if (par1)
{
dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1)));
}
else
dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 | 1)));
} else
{
dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2)));
dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 & -2)));
}
}
@ -442,10 +434,9 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, (float)(0.1), true);
worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, (float) (0.1), true);
this.setDead();
}
}
@ -456,17 +447,16 @@ public class EnergyBlastProjectile extends Entity implements IProjectile
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
{
((EntityLivingBase)mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
}
doDamage(projectileDamage, mop);
worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, (float)(0.1), true);
worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, (float) (0.1), true);
}
spawnHitParticles("magicCrit", 8);

View file

@ -1,6 +1,6 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -11,8 +11,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityBloodLightProjectile extends EnergyBlastProjectile
{
public class EntityBloodLightProjectile extends EnergyBlastProjectile {
public EntityBloodLightProjectile(World par1World)
{
super(par1World);
@ -35,7 +34,7 @@ public class EntityBloodLightProjectile extends EnergyBlastProjectile
public EntityBloodLightProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
@ -55,8 +54,7 @@ public class EntityBloodLightProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
int sideHit = mop.sideHit;
int blockX = mop.blockX;
@ -65,32 +63,32 @@ public class EntityBloodLightProjectile extends EnergyBlastProjectile
if (sideHit == 0 && this.worldObj.isAirBlock(blockX, blockY - 1, blockZ))
{
this.worldObj.setBlock(blockX, blockY - 1, blockZ, AlchemicalWizardry.blockBloodLight.blockID);
this.worldObj.setBlock(blockX, blockY - 1, blockZ, ModBlocks.blockBloodLight.blockID);
}
if (sideHit == 1 && this.worldObj.isAirBlock(blockX, blockY + 1, blockZ))
{
this.worldObj.setBlock(blockX, blockY + 1, blockZ, AlchemicalWizardry.blockBloodLight.blockID);
this.worldObj.setBlock(blockX, blockY + 1, blockZ, ModBlocks.blockBloodLight.blockID);
}
if (sideHit == 2 && this.worldObj.isAirBlock(blockX, blockY, blockZ - 1))
{
this.worldObj.setBlock(blockX, blockY, blockZ - 1 , AlchemicalWizardry.blockBloodLight.blockID);
this.worldObj.setBlock(blockX, blockY, blockZ - 1, ModBlocks.blockBloodLight.blockID);
}
if (sideHit == 3 && this.worldObj.isAirBlock(blockX, blockY, blockZ + 1))
{
this.worldObj.setBlock(blockX, blockY, blockZ + 1 , AlchemicalWizardry.blockBloodLight.blockID);
this.worldObj.setBlock(blockX, blockY, blockZ + 1, ModBlocks.blockBloodLight.blockID);
}
if (sideHit == 4 && this.worldObj.isAirBlock(blockX - 1, blockY, blockZ))
{
this.worldObj.setBlock(blockX - 1, blockY, blockZ, AlchemicalWizardry.blockBloodLight.blockID);
this.worldObj.setBlock(blockX - 1, blockY, blockZ, ModBlocks.blockBloodLight.blockID);
}
if (sideHit == 5 && this.worldObj.isAirBlock(blockX + 1, blockY, blockZ))
{
this.worldObj.setBlock(blockX + 1, blockY, blockZ, AlchemicalWizardry.blockBloodLight.blockID);
this.worldObj.setBlock(blockX + 1, blockY, blockZ, ModBlocks.blockBloodLight.blockID);
}
//worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(0.1), true);
@ -106,33 +104,31 @@ public class EntityBloodLightProjectile extends EnergyBlastProjectile
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
{
//((EntityLivingBase)mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60,2));
((EntityLivingBase)mop).setFire(50);
((EntityLivingBase)mop).setRevengeTarget(shootingEntity);
((EntityLivingBase) mop).setFire(50);
((EntityLivingBase) mop).setRevengeTarget(shootingEntity);
if (((EntityLivingBase)mop).isPotionActive(Potion.fireResistance) || ((EntityLivingBase)mop).isImmuneToFire())
if (((EntityLivingBase) mop).isPotionActive(Potion.fireResistance) || ((EntityLivingBase) mop).isImmuneToFire())
{
((EntityLivingBase)mop).attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
}
else
((EntityLivingBase) mop).attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
} else
{
doDamage(projectileDamage, mop);
((EntityLivingBase)mop).hurtResistantTime = 0;
((EntityLivingBase) mop).hurtResistantTime = 0;
}
}
//worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(0.1), true);
}
if (worldObj.isAirBlock((int)this.posX, (int)this.posY, (int)this.posZ))
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
worldObj.setBlock((int)this.posX, (int)this.posY, (int)this.posZ, Block.fire.blockID);
worldObj.setBlock((int) this.posX, (int) this.posY, (int) this.posZ, Block.fire.blockID);
}
spawnHitParticles("magicCrit", 8);

View file

@ -1,19 +1,13 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile
{
public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile {
public EntityEnergyBazookaMainProjectile(World par1World)
{
super(par1World);
@ -36,7 +30,7 @@ public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile
public EntityEnergyBazookaMainProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
@ -56,10 +50,9 @@ public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, (float)(5.0f), false);
worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, (float) (5.0f), false);
this.spawnSecondaryProjectiles();
}
@ -73,8 +66,7 @@ public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -82,7 +74,7 @@ public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile
spawnSecondaryProjectiles();
}
worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, (float)(5.0f), false);
worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, (float) (5.0f), false);
}
spawnHitParticles("magicCrit", 8);

View file

@ -1,32 +1,29 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import java.util.Iterator;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.util.*;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectile implements IProjectile
{
import java.util.Iterator;
import java.util.List;
public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectile implements IProjectile {
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private int inTile = 0;
private int inData = 0;
private boolean inGround = false;
/** The owner of this arrow. */
/**
* The owner of this arrow.
*/
public EntityLivingBase shootingEntity;
private int ticksInAir = 0;
private int ricochetCounter = 0;
@ -56,14 +53,14 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
float par3 = 0.8F;
this.setSize(0.1F, 0.1F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
posX -= MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
posY -= 0.2D;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float)Math.PI);
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
this.damage = damage;
}
@ -71,7 +68,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
@Override
protected void entityInit()
{
dataWatcher.addObject(16, Byte.valueOf((byte)0));
dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
@ -95,8 +92,8 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
motionY = var3;
motionZ = var5;
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
prevRotationYaw = rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(var3, var10) * 180.0D / Math.PI);
prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
}
@Override
@ -125,8 +122,8 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
{
float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
prevRotationYaw = rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(par3, var7) * 180.0D / Math.PI);
prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch;
prevRotationYaw = rotationYaw;
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
@ -153,7 +150,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
while (i.hasNext())
{
EntityPlayer e = (EntityPlayer)i.next();
EntityPlayer e = (EntityPlayer) i.next();
double distance = e.getDistanceToEntity(this);
if (distance < closestDistance)
@ -171,8 +168,8 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
{
float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
prevRotationYaw = rotationYaw = (float)(Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(motionY, var1) * 180.0D / Math.PI);
prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI);
}
int var16 = worldObj.getBlockId(xTile, yTile, zTile);
@ -198,8 +195,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
// this.groundImpact();
// this.setDead();
}
}
else
} else
{
++ticksInAir;
@ -232,7 +228,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
while (var9.hasNext())
{
Entity var10 = (Entity)var9.next();
Entity var10 = (Entity) var9.next();
if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5))
{
@ -290,12 +286,12 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
par1NBTTagCompound.setShort("xTile", (short)xTile);
par1NBTTagCompound.setShort("yTile", (short)yTile);
par1NBTTagCompound.setShort("zTile", (short)zTile);
par1NBTTagCompound.setByte("inTile", (byte)inTile);
par1NBTTagCompound.setByte("inData", (byte)inData);
par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
par1NBTTagCompound.setShort("xTile", (short) xTile);
par1NBTTagCompound.setShort("yTile", (short) yTile);
par1NBTTagCompound.setShort("zTile", (short) zTile);
par1NBTTagCompound.setByte("inTile", (byte) inTile);
par1NBTTagCompound.setByte("inData", (byte) inData);
par1NBTTagCompound.setByte("inGround", (byte) (inGround ? 1 : 0));
}
/**
@ -355,11 +351,10 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
if (par1)
{
dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1)));
}
else
dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 | 1)));
} else
{
dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2)));
dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 & -2)));
}
}
@ -383,8 +378,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
this.groundImpact(mop.sideHit);
worldObj.createExplosion(shootingEntity, posX, posY, posZ, 2, false);
@ -397,8 +391,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
doDamage(this.damage + d6(), mop);
worldObj.createExplosion(shootingEntity, posX, posY, posZ, 2, false);

View file

@ -1,20 +1,13 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityMeteor extends EnergyBlastProjectile
{
public class EntityMeteor extends EnergyBlastProjectile {
private int meteorID;
public EntityMeteor(World par1World)
@ -46,8 +39,7 @@ public class EntityMeteor extends EnergyBlastProjectile
if (mop.typeOfHit == EnumMovingObjectType.ENTITY && mop.entityHit != null)
{
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
MeteorRegistry.createMeteorImpact(worldObj, mop.blockX, mop.blockY, mop.blockZ, this.meteorID);
}
@ -62,10 +54,9 @@ public class EntityMeteor extends EnergyBlastProjectile
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
MeteorRegistry.createMeteorImpact(worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, meteorID);
MeteorRegistry.createMeteorImpact(worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID);
}
this.setDead();

View file

@ -2,17 +2,13 @@ package WayofTime.alchemicalWizardry.common.entity.projectile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class ExplosionProjectile extends EnergyBlastProjectile
{
public class ExplosionProjectile extends EnergyBlastProjectile {
protected boolean causesEnvDamage;
public ExplosionProjectile(World par1World)
@ -53,10 +49,9 @@ public class ExplosionProjectile extends EnergyBlastProjectile
return;
}
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(2), causesEnvDamage);
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (2), causesEnvDamage);
//this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
// for(int i=-1;i<=1;i++)
// {
@ -71,7 +66,7 @@ public class ExplosionProjectile extends EnergyBlastProjectile
// }
// }
// }
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(2), causesEnvDamage);
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (2), causesEnvDamage);
}
this.setDead();
@ -84,8 +79,7 @@ public class ExplosionProjectile extends EnergyBlastProjectile
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -93,11 +87,10 @@ public class ExplosionProjectile extends EnergyBlastProjectile
//((EntityLivingBase)mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60,2));
//((EntityLivingBase)mop).setFire(50);
//((EntityLivingBase)mop).setRevengeTarget(shootingEntity);
if (((EntityLivingBase)mop).isImmuneToFire())
if (((EntityLivingBase) mop).isImmuneToFire())
{
doDamage((int)(projectileDamage), mop);
}
else
doDamage((int) (projectileDamage), mop);
} else
{
doDamage(projectileDamage, mop);
}
@ -106,7 +99,7 @@ public class ExplosionProjectile extends EnergyBlastProjectile
//worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(0.1), true);
}
if (worldObj.isAirBlock((int)this.posX, (int)this.posY, (int)this.posZ))
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
//worldObj.setBlock((int)this.posX, (int)this.posY, (int)this.posZ,Block.fire.blockID);
}

View file

@ -3,17 +3,13 @@ package WayofTime.alchemicalWizardry.common.entity.projectile;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class FireProjectile extends EnergyBlastProjectile
{
public class FireProjectile extends EnergyBlastProjectile {
public FireProjectile(World par1World)
{
super(par1World);
@ -36,7 +32,7 @@ public class FireProjectile extends EnergyBlastProjectile
public FireProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
@ -56,8 +52,7 @@ public class FireProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
for (int i = -1; i <= 1; i++)
{
@ -65,9 +60,9 @@ public class FireProjectile extends EnergyBlastProjectile
{
for (int k = -1; k <= 1; k++)
{
if (worldObj.isAirBlock((int)this.posX + i, (int)this.posY + j, (int)this.posZ + k))
if (worldObj.isAirBlock((int) this.posX + i, (int) this.posY + j, (int) this.posZ + k))
{
worldObj.setBlock((int)this.posX + i, (int)this.posY + j, (int)this.posZ + k, Block.fire.blockID);
worldObj.setBlock((int) this.posX + i, (int) this.posY + j, (int) this.posZ + k, Block.fire.blockID);
}
}
}
@ -86,33 +81,31 @@ public class FireProjectile extends EnergyBlastProjectile
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
{
//((EntityLivingBase)mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60,2));
((EntityLivingBase)mop).setFire(50);
((EntityLivingBase)mop).setRevengeTarget(shootingEntity);
((EntityLivingBase) mop).setFire(50);
((EntityLivingBase) mop).setRevengeTarget(shootingEntity);
if (((EntityLivingBase)mop).isPotionActive(Potion.fireResistance) || ((EntityLivingBase)mop).isImmuneToFire())
if (((EntityLivingBase) mop).isPotionActive(Potion.fireResistance) || ((EntityLivingBase) mop).isImmuneToFire())
{
((EntityLivingBase)mop).attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
}
else
((EntityLivingBase) mop).attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
} else
{
doDamage(projectileDamage, mop);
((EntityLivingBase)mop).hurtResistantTime = 0;
((EntityLivingBase) mop).hurtResistantTime = 0;
}
}
//worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(0.1), true);
}
if (worldObj.isAirBlock((int)this.posX, (int)this.posY, (int)this.posZ))
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
worldObj.setBlock((int)this.posX, (int)this.posY, (int)this.posZ, Block.fire.blockID);
worldObj.setBlock((int) this.posX, (int) this.posY, (int) this.posZ, Block.fire.blockID);
}
spawnHitParticles("magicCrit", 8);

View file

@ -4,14 +4,12 @@ import WayofTime.alchemicalWizardry.common.PacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class HolyProjectile extends EnergyBlastProjectile
{
public class HolyProjectile extends EnergyBlastProjectile {
public HolyProjectile(World par1World)
{
super(par1World);
@ -34,7 +32,7 @@ public class HolyProjectile extends EnergyBlastProjectile
public HolyProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
@ -54,8 +52,7 @@ public class HolyProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
// for(int i=-1;i<=1;i++)
// {
@ -82,8 +79,7 @@ public class HolyProjectile extends EnergyBlastProjectile
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -91,11 +87,10 @@ public class HolyProjectile extends EnergyBlastProjectile
//((EntityLivingBase)mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60,2));
//((EntityLivingBase)mop).setFire(50);
//((EntityLivingBase)mop).setRevengeTarget(shootingEntity);
if (((EntityLivingBase)mop).isEntityUndead())
if (((EntityLivingBase) mop).isEntityUndead())
{
doDamage((int)(projectileDamage * 2), mop);
}
else
doDamage((int) (projectileDamage * 2), mop);
} else
{
doDamage(projectileDamage, mop);
}
@ -104,7 +99,7 @@ public class HolyProjectile extends EnergyBlastProjectile
//worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(0.1), true);
}
if (worldObj.isAirBlock((int)this.posX, (int)this.posY, (int)this.posZ))
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
//worldObj.setBlock((int)this.posX, (int)this.posY, (int)this.posZ,Block.fire.blockID);
}

View file

@ -3,10 +3,8 @@ package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
@ -14,8 +12,7 @@ import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class IceProjectile extends EnergyBlastProjectile
{
public class IceProjectile extends EnergyBlastProjectile {
public IceProjectile(World par1World)
{
super(par1World);
@ -35,6 +32,7 @@ public class IceProjectile extends EnergyBlastProjectile
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
public IceProjectile(World worldObj, EntityIceDemon entityIceDemon, EntityLivingBase par1EntityLivingBase, float f, float g, int i, int j)
{
super(worldObj, entityIceDemon, par1EntityLivingBase, f, g, i, j);
@ -57,8 +55,7 @@ public class IceProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
// for(int i=-1;i<=1;i++)
// {
@ -86,8 +83,7 @@ public class IceProjectile extends EnergyBlastProjectile
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -95,12 +91,11 @@ public class IceProjectile extends EnergyBlastProjectile
//((EntityLivingBase)mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60,2));
//((EntityLivingBase)mop).setFire(50);
//((EntityLivingBase)mop).setRevengeTarget(shootingEntity);
if (((EntityLivingBase)mop).isImmuneToFire())
if (((EntityLivingBase) mop).isImmuneToFire())
{
doDamage((int)(projectileDamage * 2), mop);
doDamage((int) (projectileDamage * 2), mop);
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2));
}
else
} else
{
doDamage(projectileDamage, mop);
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1));
@ -110,7 +105,7 @@ public class IceProjectile extends EnergyBlastProjectile
//worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(0.1), true);
}
if (worldObj.isAirBlock((int)this.posX, (int)this.posY, (int)this.posZ))
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
//worldObj.setBlock((int)this.posX, (int)this.posY, (int)this.posZ,Block.fire.blockID);
}

View file

@ -1,20 +1,17 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.PacketDispatcher;
public class LightningBoltProjectile extends EnergyBlastProjectile
{
public class LightningBoltProjectile extends EnergyBlastProjectile {
private boolean causeLightning;
public LightningBoltProjectile(World par1World)
@ -56,8 +53,7 @@ public class LightningBoltProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
if (causeLightning)
{
@ -75,8 +71,7 @@ public class LightningBoltProjectile extends EnergyBlastProjectile
{
//shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -93,9 +88,8 @@ public class LightningBoltProjectile extends EnergyBlastProjectile
// }
if (causeLightning)
{
this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, ((EntityLivingBase)mop).posX, ((EntityLivingBase)mop).posY, ((EntityLivingBase)mop).posZ));
}
else
this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, ((EntityLivingBase) mop).posX, ((EntityLivingBase) mop).posY, ((EntityLivingBase) mop).posZ));
} else
{
doDamage(projectileDamage, mop);
}

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -11,10 +11,8 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.PacketDispatcher;
public class MudProjectile extends EnergyBlastProjectile
{
public class MudProjectile extends EnergyBlastProjectile {
private boolean doesBlindness; //True for when it applies blindness, false for slowness
public MudProjectile(World par1World)
@ -41,7 +39,7 @@ public class MudProjectile extends EnergyBlastProjectile
public MudProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir, boolean flag)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
doesBlindness = flag;
}
@ -62,8 +60,7 @@ public class MudProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
}
@ -77,8 +74,7 @@ public class MudProjectile extends EnergyBlastProjectile
{
//shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -95,11 +91,10 @@ public class MudProjectile extends EnergyBlastProjectile
// }
if (doesBlindness)
{
((EntityLivingBase)mop).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 0));
}
else
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 0));
} else
{
((EntityLivingBase)mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2));
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2));
}
doDamage(projectileDamage, mop);

View file

@ -2,24 +2,19 @@ package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
public class TeleportProjectile extends EnergyBlastProjectile
{
public class TeleportProjectile extends EnergyBlastProjectile {
private boolean isEntityTeleport; //True if the entity firing teleports on hit
public TeleportProjectile(World par1World)
@ -73,14 +68,13 @@ public class TeleportProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
if (isEntityTeleport)
{
if (shootingEntity != null && shootingEntity instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)shootingEntity;
EntityPlayerMP entityplayermp = (EntityPlayerMP) shootingEntity;
if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == this.worldObj)
{
@ -90,7 +84,7 @@ public class TeleportProjectile extends EnergyBlastProjectile
{
if (shootingEntity.isRiding())
{
shootingEntity.mountEntity((Entity)null);
shootingEntity.mountEntity((Entity) null);
}
shootingEntity.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
@ -112,8 +106,7 @@ public class TeleportProjectile extends EnergyBlastProjectile
{
//shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -132,7 +125,7 @@ public class TeleportProjectile extends EnergyBlastProjectile
{
if (shootingEntity != null && shootingEntity instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)shootingEntity;
EntityPlayerMP entityplayermp = (EntityPlayerMP) shootingEntity;
if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == this.worldObj)
{
@ -142,7 +135,7 @@ public class TeleportProjectile extends EnergyBlastProjectile
{
if (shootingEntity.isRiding())
{
shootingEntity.mountEntity((Entity)null);
shootingEntity.mountEntity((Entity) null);
}
shootingEntity.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
@ -151,8 +144,7 @@ public class TeleportProjectile extends EnergyBlastProjectile
}
}
}
}
else
} else
{
// int x = (int)this.posX + mop.worldObj.rand.nextInt(100) - mop.worldObj.rand.nextInt(100);
// int y = (int)this.posY + mop.worldObj.rand.nextInt(10) - mop.worldObj.rand.nextInt(10);
@ -175,7 +167,7 @@ public class TeleportProjectile extends EnergyBlastProjectile
// i++;
// }
// }
SpellTeleport.teleportRandomly((EntityLivingBase)mop, 64);
SpellTeleport.teleportRandomly((EntityLivingBase) mop, 64);
}
//doDamage(projectileDamage, mop);

View file

@ -2,19 +2,16 @@ package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.PacketDispatcher;
public class WaterProjectile extends EnergyBlastProjectile
{
public class WaterProjectile extends EnergyBlastProjectile {
public WaterProjectile(World par1World)
{
super(par1World);
@ -52,8 +49,7 @@ public class WaterProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
}
@ -67,8 +63,7 @@ public class WaterProjectile extends EnergyBlastProjectile
{
//shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -83,15 +78,14 @@ public class WaterProjectile extends EnergyBlastProjectile
// {
// doDamage(projectileDamage, mop);
// }
if (((EntityLivingBase)mop).isImmuneToFire())
if (((EntityLivingBase) mop).isImmuneToFire())
{
doDamage(projectileDamage * 2, mop);
((EntityLivingBase)mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 1));
}
else
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 1));
} else
{
doDamage(projectileDamage, mop);
((EntityLivingBase)mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 0));
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 0));
}
//((EntityLivingBase)mop).setVelocity(this.motionX*2, ((EntityLivingBase)mop).motionY+1.5, this.motionZ*2);

View file

@ -1,17 +1,15 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.PacketDispatcher;
public class WindGustProjectile extends EnergyBlastProjectile
{
public class WindGustProjectile extends EnergyBlastProjectile {
public WindGustProjectile(World par1World)
{
super(par1World);
@ -49,8 +47,7 @@ public class WindGustProjectile extends EnergyBlastProjectile
}
this.onImpact(mop.entityHit);
}
else if (mop.typeOfHit == EnumMovingObjectType.TILE)
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
// for(int i=-1;i<=1;i++)
// {
@ -77,8 +74,7 @@ public class WindGustProjectile extends EnergyBlastProjectile
{
//shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
this.setDead();
}
else
} else
{
//doDamage(8 + d6(), mop);
if (mop instanceof EntityLivingBase)
@ -93,9 +89,9 @@ public class WindGustProjectile extends EnergyBlastProjectile
// {
// doDamage(projectileDamage, mop);
// }
((EntityLivingBase)mop).motionX = this.motionX * 2;
((EntityLivingBase)mop).motionY = 1.5;
((EntityLivingBase)mop).motionZ = this.motionZ * 2;
((EntityLivingBase) mop).motionX = this.motionX * 2;
((EntityLivingBase) mop).motionY = 1.5;
((EntityLivingBase) mop).motionZ = this.motionZ * 2;
//((EntityLivingBase)mop).setVelocity(this.motionX*2, ((EntityLivingBase)mop).motionY+1.5, this.motionZ*2);
}