Created
July 4, 2014 10:45
-
-
Save WillR27/338ecfe4a6d1e343c40f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.blocklings.entity; | |
import java.util.List; | |
import java.util.Random; | |
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.EntityAIBeg; | |
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.EntityAINearestAttackableTarget; | |
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; | |
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; | |
import net.minecraft.entity.ai.EntityAISwimming; | |
import net.minecraft.entity.ai.EntityAITarget; | |
import net.minecraft.entity.ai.EntityAITargetNonTamed; | |
import net.minecraft.entity.ai.EntityAIWander; | |
import net.minecraft.entity.ai.EntityAIWatchClosest; | |
import net.minecraft.entity.monster.EntityMob; | |
import net.minecraft.entity.passive.EntitySheep; | |
import net.minecraft.entity.passive.EntityTameable; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.init.Blocks; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.nbt.NBTTagCompound; | |
import net.minecraft.pathfinding.PathEntity; | |
import net.minecraft.util.AxisAlignedBB; | |
import net.minecraft.util.ChatComponentText; | |
import net.minecraft.util.DamageSource; | |
import net.minecraft.util.MathHelper; | |
import net.minecraft.world.World; | |
import com.blocklings.main.Blocklings; | |
import com.blocklings.network.CreatePacketServerSide; | |
import cpw.mods.fml.client.FMLClientHandler; | |
public class EntityBlockling extends EntityTameable { | |
public int xp; | |
public int level; | |
public int requiredXP; | |
public double maxHealth; | |
public double attackDamage; | |
public int currentUpgradeTier; | |
public float hitbox; | |
public float attackTimer; | |
public int i; | |
public EntityBlockling(World world) { | |
super(world); | |
this.xp = 0; | |
this.level = 1; | |
this.requiredXP = 250; | |
this.maxHealth = 4.0D; | |
this.attackDamage = 1.0D; | |
this.currentUpgradeTier = 1; | |
this.hitbox = 1.0F; | |
this.i = 0; | |
this.setSize(hitbox, hitbox); | |
this.getNavigator().setAvoidsWater(false); | |
this.getNavigator().setCanSwim(true); | |
this.tasks.addTask(1, new EntityAISwimming(this)); | |
this.tasks.addTask(2, this.aiSit); | |
this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0D, false)); | |
this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 12.0F, 8.0F)); | |
this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); | |
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); | |
this.tasks.addTask(6, new EntityAILookIdle(this)); | |
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); | |
this.targetTasks.addTask(2, new EntityAIOwnerHurtByTarget(this)); | |
this.targetTasks.addTask(3, new EntityAIOwnerHurtTarget(this)); | |
this.setTamed(false); | |
setEntitySize(); | |
} | |
protected void applyEntityAttributes() { | |
this.maxHealth = 4.0D; | |
this.attackDamage = 1.0D; | |
super.applyEntityAttributes(); | |
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxHealth); | |
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); | |
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); | |
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.attackDamage); | |
} | |
public boolean getCanSpawnHere() { | |
int i = MathHelper.floor_double(this.posX); | |
int j = MathHelper.floor_double(this.boundingBox.minY); | |
int k = MathHelper.floor_double(this.posZ); | |
int l = this.worldObj.getFullBlockLightValue(i, j, k); | |
boolean s = this.worldObj.canBlockSeeTheSky(i, j, k); | |
boolean b = this.worldObj.getBlock(i, j - 1, k) == Blocks.grass; | |
List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1, posY + 1, posZ + 1).expand(16D, 512D, 16D)); | |
return list.size() < 5 && l > 8 && b && s; | |
} | |
public boolean interact(EntityPlayer par1EntityPlayer) { | |
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.worldObj.isRemote && par1EntityPlayer.isSneaking() && itemstack == null) { | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("XP: " + this.xp + "/" + this.requiredXP + " | " + "Level: " + this.level)); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Health: " + (int) this.getHealth() + "/" + (int) this.maxHealth + " | " + "Attack Damage: " + (int) this.attackDamage)); | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemWoodenUpgrade && this.currentUpgradeTier == 1 && this.level >= 2 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 2; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Wooden Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemCobblestoneUpgrade && this.currentUpgradeTier == 2 && this.level >= 3 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 3; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Cobblestone Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemStoneUpgrade && this.currentUpgradeTier == 3 && this.level >= 4 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 4; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Stone Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemIronUpgrade && this.currentUpgradeTier == 4 && this.level >= 5 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 5; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Iron Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemLapisLazuliUpgrade && this.currentUpgradeTier == 5 && this.level >= 6 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 6; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Lapis Lazuli Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemGoldUpgrade && this.currentUpgradeTier == 6 && this.level >= 7 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 7; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Gold Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemDiamondUpgrade && this.currentUpgradeTier == 7 && this.level >= 8 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 8; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Diamond Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemEmeraldUpgrade && this.currentUpgradeTier == 8 && this.level >= 9 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 9; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Emerald Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && itemstack != null && itemstack.getItem() == Blocklings.itemObsidianUpgrade && this.currentUpgradeTier == 9 && this.level >= 10 && !this.worldObj.isRemote && par1EntityPlayer.isSneaking()) { | |
this.currentUpgradeTier = 10; | |
setMaxHealth(); | |
setAttackDamage(); | |
this.heal((float) maxHealth - this.getHealth()); | |
if (!par1EntityPlayer.capabilities.isCreativeMode) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Obsidian Upgrade Applied")); | |
} | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (!this.worldObj.isRemote && this.isTamed() && itemstack == null && par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !par1EntityPlayer.isSneaking()) { | |
this.aiSit.setSitting(!this.isSitting()); | |
} | |
if (itemstack != null && (itemstack.getItem() == Item.getItemFromBlock(Blocks.red_flower) || itemstack.getItem() == Item.getItemFromBlock(Blocks.yellow_flower))) { | |
if (!par1EntityPlayer.capabilities.isCreativeMode && !this.isTamed()) { | |
--itemstack.stackSize; | |
} | |
if (itemstack.stackSize <= 0 && !this.isTamed()) { | |
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); | |
} | |
if (!this.worldObj.isRemote && !this.isTamed()) { | |
if (this.rand.nextInt(2) == 0) { | |
this.setTamed(true); | |
this.setPathToEntity((PathEntity) null); | |
this.setAttackTarget((EntityLivingBase) null); | |
this.setOwner(par1EntityPlayer.getCommandSenderName()); | |
this.playTameEffect(true); | |
this.worldObj.setEntityState(this, (byte) 7); | |
} else { | |
this.playTameEffect(false); | |
this.worldObj.setEntityState(this, (byte) 6); | |
} | |
} | |
return true; | |
} | |
return super.interact(par1EntityPlayer); | |
} | |
public void onLivingUpdate() { | |
super.onLivingUpdate(); | |
if (this.attackTimer > 0) { | |
this.attackTimer -= 1; | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
} | |
} | |
if (i < 3) { | |
if (!worldObj.isRemote) { | |
CreatePacketServerSide.sendS2CEntitySync(this); | |
i++; | |
} | |
} | |
} | |
public boolean attackEntityAsMob(Entity par1Entity) { | |
Random random = new Random(); | |
if (this.attackTimer <= 2) { | |
this.attackTimer = 8; | |
} | |
if (this.isTamed()) { | |
addXP((int) this.attackDamage + random.nextInt((int) this.attackDamage + (int) this.attackDamage * 3)); | |
setMaxHealth(); | |
setAttackDamage(); | |
} | |
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()); | |
} | |
public void writeEntityToNBT(NBTTagCompound compound) { | |
super.writeEntityToNBT(compound); | |
compound.setInteger("XP", this.xp); | |
compound.setInteger("Level", this.level); | |
compound.setInteger("Required XP", this.requiredXP); | |
compound.setDouble("Max Health", this.maxHealth); | |
compound.setDouble("Attack Damage", this.attackDamage); | |
compound.setInteger("Current Upgrade Tier", this.currentUpgradeTier); | |
compound.setFloat("Hitbox", this.hitbox); | |
} | |
public void readEntityFromNBT(NBTTagCompound compound) { | |
super.readEntityFromNBT(compound); | |
this.xp = compound.getInteger("XP"); | |
this.level = compound.getInteger("Level"); | |
this.requiredXP = compound.getInteger("Required XP"); | |
this.maxHealth = compound.getInteger("Max Health"); | |
this.attackDamage = compound.getInteger("Attack Damage"); | |
this.currentUpgradeTier = compound.getInteger("Current Upgrade Tier"); | |
this.hitbox = compound.getFloat("Hitbox"); | |
} | |
public void addXP(int addedXP) { | |
this.xp = this.xp + addedXP; | |
onLevelUp(); | |
} | |
public void onLevelUp() { | |
if (this.xp >= this.requiredXP) { | |
this.xp = 0; | |
this.level = level + 1; | |
calculateRequiredXP(); | |
setMaxHealth(); | |
setEntitySize(); | |
this.heal((float) maxHealth - this.getHealth()); | |
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Your Blockling Levelled Up! It is now level " + this.level)); | |
} | |
} | |
public void calculateRequiredXP() { | |
this.requiredXP = this.level * this.level * 10 * 10; | |
} | |
public void setMaxHealth() { | |
if (this.level == 1) { | |
this.maxHealth = 4.0D; | |
} else if (this.level == 2 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 6.0D; | |
} else if (this.level == 3 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 9.0D; | |
} else if (this.level == 4 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 12.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 15.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 19.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 23.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 28.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 33.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 1) { | |
this.maxHealth = 40.0D; | |
} else if (this.level == 2 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 7.0D; | |
} else if (this.level == 3 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 10.0D; | |
} else if (this.level == 4 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 13.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 16.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 20.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 24.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 29.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 34.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 2) { | |
this.maxHealth = 41.0D; | |
} else if (this.level == 3 && this.currentUpgradeTier == 3) { | |
this.maxHealth = 11.0D; | |
} else if (this.level == 4 && this.currentUpgradeTier == 3) { | |
this.maxHealth = 14.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 3) { | |
this.maxHealth = 17.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 3) { | |
this.maxHealth = 21.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 3) { | |
this.maxHealth = 25.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 3) { | |
this.maxHealth = 30.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 3) { | |
this.maxHealth = 35.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 3) { | |
this.maxHealth = 42.0D; | |
} else if (this.level == 4 && this.currentUpgradeTier == 4) { | |
this.maxHealth = 15.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 4) { | |
this.maxHealth = 18.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 4) { | |
this.maxHealth = 22.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 4) { | |
this.maxHealth = 26.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 4) { | |
this.maxHealth = 31.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 4) { | |
this.maxHealth = 36.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 4) { | |
this.maxHealth = 43.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 5) { | |
this.maxHealth = 19.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 5) { | |
this.maxHealth = 23.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 5) { | |
this.maxHealth = 27.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 5) { | |
this.maxHealth = 32.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 5) { | |
this.maxHealth = 37.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 5) { | |
this.maxHealth = 44.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 6) { | |
this.maxHealth = 24.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 6) { | |
this.maxHealth = 28.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 6) { | |
this.maxHealth = 33.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 6) { | |
this.maxHealth = 38.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 6) { | |
this.maxHealth = 45.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 7) { | |
this.maxHealth = 29.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 7) { | |
this.maxHealth = 34.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 7) { | |
this.maxHealth = 39.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 7) { | |
this.maxHealth = 46.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 8) { | |
this.maxHealth = 35.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 8) { | |
this.maxHealth = 40.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 8) { | |
this.maxHealth = 47.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 9) { | |
this.maxHealth = 41.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 9) { | |
this.maxHealth = 48.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 10) { | |
this.maxHealth = 50.0D; | |
} | |
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxHealth); | |
} | |
public void setAttackDamage() { | |
if (this.level == 1) { | |
this.attackDamage = 1.0D; | |
} else if (this.level == 2 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 2.0D; | |
} else if (this.level == 3 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 3.0D; | |
} else if (this.level == 4 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 4.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 5.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 7.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 9.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 11.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 13.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 1) { | |
this.attackDamage = 15.0D; | |
} else if (this.level == 2 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 3.0D; | |
} else if (this.level == 3 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 4.0D; | |
} else if (this.level == 4 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 5.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 6.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 8.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 10.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 12.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 14.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 2) { | |
this.attackDamage = 16.0D; | |
} else if (this.level == 3 && this.currentUpgradeTier == 3) { | |
this.attackDamage = 5.0D; | |
} else if (this.level == 4 && this.currentUpgradeTier == 3) { | |
this.attackDamage = 6.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 3) { | |
this.attackDamage = 7.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 3) { | |
this.attackDamage = 9.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 3) { | |
this.attackDamage = 11.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 3) { | |
this.attackDamage = 13.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 3) { | |
this.attackDamage = 15.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 3) { | |
this.attackDamage = 17.0D; | |
} else if (this.level == 4 && this.currentUpgradeTier == 4) { | |
this.attackDamage = 7.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 4) { | |
this.attackDamage = 8.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 4) { | |
this.attackDamage = 10.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 4) { | |
this.attackDamage = 12.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 4) { | |
this.attackDamage = 14.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 4) { | |
this.attackDamage = 16.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 4) { | |
this.attackDamage = 18.0D; | |
} else if (this.level == 5 && this.currentUpgradeTier == 5) { | |
this.attackDamage = 9.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 5) { | |
this.attackDamage = 11.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 5) { | |
this.attackDamage = 13.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 5) { | |
this.attackDamage = 15.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 5) { | |
this.attackDamage = 17.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 5) { | |
this.attackDamage = 19.0D; | |
} else if (this.level == 6 && this.currentUpgradeTier == 6) { | |
this.attackDamage = 12.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 6) { | |
this.attackDamage = 14.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 6) { | |
this.attackDamage = 16.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 6) { | |
this.attackDamage = 18.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 6) { | |
this.attackDamage = 20.0D; | |
} else if (this.level == 7 && this.currentUpgradeTier == 7) { | |
this.attackDamage = 15.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 7) { | |
this.attackDamage = 17.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 7) { | |
this.attackDamage = 19.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 7) { | |
this.attackDamage = 21.0D; | |
} else if (this.level == 8 && this.currentUpgradeTier == 8) { | |
this.attackDamage = 18.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 8) { | |
this.attackDamage = 20.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 8) { | |
this.attackDamage = 22.0D; | |
} else if (this.level == 9 && this.currentUpgradeTier == 9) { | |
this.attackDamage = 21.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 9) { | |
this.attackDamage = 23.0D; | |
} else if (this.level >= 10 && this.currentUpgradeTier == 10) { | |
this.attackDamage = 25.0D; | |
} | |
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.attackDamage); | |
} | |
public void setEntitySize() { | |
if (level == 1) { | |
this.hitbox = 0.4F; | |
} else if (level == 2) { | |
this.hitbox = 0.55F; | |
} else if (level == 3) { | |
this.hitbox = 0.7F; | |
} else if (level == 4) { | |
this.hitbox = 0.85F; | |
} else if (level == 5) { | |
this.hitbox = 1.0F; | |
} else if (level == 6) { | |
this.hitbox = 1.15F; | |
} else if (level == 7) { | |
this.hitbox = 1.3F; | |
} else if (level == 8) { | |
this.hitbox = 1.45F; | |
} else if (level == 9) { | |
this.hitbox = 1.6F; | |
} else if (level >= 10) { | |
this.hitbox = 1.75F; | |
} | |
this.setSize(this.hitbox, this.hitbox); | |
} | |
public int getLevel() { | |
return this.level; | |
} | |
public int getCurrentUpgradeTier() { | |
return this.currentUpgradeTier; | |
} | |
public float getAttackTimer() { | |
return this.attackTimer; | |
} | |
public void setLevel(int level) { | |
this.level = level; | |
} | |
public void setCurrentUpgradeTier(int currentUpgradeTier) { | |
this.currentUpgradeTier = currentUpgradeTier; | |
} | |
public void setAttackTimer(float attackTimer) { | |
this.attackTimer = attackTimer; | |
} | |
@Override | |
public EntityAgeable createChild(EntityAgeable var1) { | |
return null; | |
} | |
public boolean isAIEnabled() { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment