Advertisement
somarni

Untitled

Aug 2nd, 2014
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. package somarani.soulcraft.mobboss;
  2.  
  3. import org.omg.CORBA.PUBLIC_MEMBER;
  4.  
  5. import cpw.mods.fml.relauncher.Side;
  6. import cpw.mods.fml.relauncher.SideOnly;
  7. import scala.annotation.varargs;
  8. import scala.reflect.internal.Trees.This;
  9. import somarani.soulcraft.common.SoulCraft;
  10. import net.minecraft.client.Minecraft;
  11. import net.minecraft.client.gui.GuiNewChat;
  12. import net.minecraft.enchantment.Enchantment;
  13. import net.minecraft.enchantment.EnchantmentHelper;
  14. import net.minecraft.entity.Entity;
  15. import net.minecraft.entity.EntityLivingBase;
  16. import net.minecraft.entity.IRangedAttackMob;
  17. import net.minecraft.entity.SharedMonsterAttributes;
  18. import net.minecraft.entity.ai.EntityAIArrowAttack;
  19. import net.minecraft.entity.ai.EntityAIAttackOnCollide;
  20. import net.minecraft.entity.ai.EntityAIFleeSun;
  21. import net.minecraft.entity.ai.EntityAIHurtByTarget;
  22. import net.minecraft.entity.ai.EntityAILookIdle;
  23. import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
  24. import net.minecraft.entity.ai.EntityAIRestrictSun;
  25. import net.minecraft.entity.ai.EntityAISwimming;
  26. import net.minecraft.entity.ai.EntityAIWander;
  27. import net.minecraft.entity.ai.EntityAIWatchClosest;
  28. import net.minecraft.entity.boss.BossStatus;
  29. import net.minecraft.entity.boss.IBossDisplayData;
  30. import net.minecraft.entity.effect.EntityLightningBolt;
  31. import net.minecraft.entity.monster.EntityCreeper;
  32. import net.minecraft.entity.monster.EntityMob;
  33. import net.minecraft.entity.monster.EntitySkeleton;
  34. import net.minecraft.entity.monster.EntitySpider;
  35. import net.minecraft.entity.monster.EntityZombie;
  36. import net.minecraft.entity.player.EntityPlayer;
  37. import net.minecraft.entity.projectile.EntityArrow;
  38. import net.minecraft.init.Items;
  39. import net.minecraft.item.Item;
  40. import net.minecraft.item.ItemStack;
  41. import net.minecraft.nbt.NBTBase;
  42. import net.minecraft.nbt.NBTTagCompound;
  43. import net.minecraft.nbt.NBTTagInt;
  44. import net.minecraft.util.ChatComponentText;
  45. import net.minecraft.util.DamageSource;
  46. import net.minecraft.util.MathHelper;
  47. import net.minecraft.world.EnumDifficulty;
  48. import net.minecraft.world.World;
  49. import net.minecraftforge.common.util.Constants.NBT;
  50.  
  51. public class EntitySoulBossMob extends EntityMob implements IRangedAttackMob,
  52. IBossDisplayData {
  53.  
  54. public static int count = 1000;
  55. public static int lightning = 0;
  56.  
  57. public EntitySoulBossMob(World par1World) {
  58. super(par1World);
  59.  
  60. this.stepHeight = 3f;
  61.  
  62. }
  63.  
  64. protected void applyEntityAttributes() {
  65. super.applyEntityAttributes();
  66.  
  67. this.getEntityAttribute(SharedMonsterAttributes.maxHealth)
  68. .setBaseValue(200d);
  69.  
  70. }
  71.  
  72. public void onLivingUpdate() {
  73.  
  74. System.out.println("X: " + this.posX + ",Y:" + this.posY + ",Z:" + this.posZ );
  75.  
  76. BossStatus.setBossStatus(this, true);
  77. EntityPlayer entityplayer = this.worldObj
  78. .getClosestVulnerablePlayerToEntity(this, 16.0D);
  79. if (entityplayer != null) {
  80. int x = (int) entityplayer.posX;
  81. int y = (int) entityplayer.posY;
  82. int z = (int) entityplayer.posZ;
  83.  
  84. EntityCreeper creeper = new EntityCreeper(worldObj);
  85. EntitySkeleton skeleton = new EntitySkeleton(worldObj);
  86. EntitySpider spider = new EntitySpider(worldObj);
  87. EntityZombie zombie = new EntityZombie(worldObj);
  88.  
  89. creeper.setPosition(x + 10, y + 10, z);
  90. skeleton.setPosition(this.posX, this.posY, this.posZ);
  91. spider.setPosition(x + 5, y, z + 5);
  92. zombie.setPosition(this.posX, this.posY, this.posZ);
  93.  
  94. if (count > 169) {
  95. if (!worldObj.isRemote) {
  96.  
  97. worldObj.spawnEntityInWorld(creeper);
  98. worldObj.spawnEntityInWorld(creeper);
  99. worldObj.spawnEntityInWorld(skeleton);
  100. worldObj.spawnEntityInWorld(skeleton);
  101. worldObj.spawnEntityInWorld(skeleton);
  102. worldObj.spawnEntityInWorld(spider);
  103. worldObj.spawnEntityInWorld(zombie);
  104. worldObj.spawnEntityInWorld(zombie);
  105.  
  106. count = 0;
  107. }
  108. }
  109.  
  110. else
  111. count++;
  112. }
  113.  
  114. if (this.getHealth() == 0) {
  115.  
  116. if (!worldObj.isRemote) {
  117. this.worldObj.spawnEntityInWorld(new EntityLightningBolt(
  118. this.worldObj, this.posX, this.posY, this.posZ));
  119. this.worldObj.spawnEntityInWorld(new EntityLightningBolt(
  120. this.worldObj, this.posX, this.posY, this.posZ));
  121. this.worldObj.spawnEntityInWorld(new EntityLightningBolt(
  122. this.worldObj, this.posX, this.posY, this.posZ));
  123. }
  124.  
  125. }
  126.  
  127. if (worldObj.difficultySetting == EnumDifficulty.PEACEFUL) {
  128. this.kill();
  129. }
  130.  
  131. if (lightning >= 150) {
  132. if (entityplayer != null) {
  133. int x = (int) entityplayer.posX;
  134. int y = (int) entityplayer.posY;
  135. int z = (int) entityplayer.posZ;
  136.  
  137. if (!worldObj.isRemote) {
  138. this.worldObj.spawnEntityInWorld(new EntityLightningBolt(
  139. this.worldObj, x + 3, y, z + 2));
  140. lightning = 0;
  141. }
  142. }
  143. }
  144.  
  145. else {
  146. lightning++;
  147. }
  148.  
  149. super.onLivingUpdate();
  150. }
  151.  
  152. public void onDeath(DamageSource par1DamageSource) {
  153.  
  154. World world = worldObj;
  155.  
  156. if (!world.isRemote) {
  157. int j = this.rand.nextInt(2) + 1;
  158.  
  159. this.dropItem(SoulCraft.smallSoulFragment, j);
  160. }
  161.  
  162. super.onDeath(par1DamageSource);
  163.  
  164. }
  165.  
  166. @Override
  167. public void attackEntityWithRangedAttack(EntityLivingBase var1, float var2) {
  168. // TODO Auto-generated method stub
  169.  
  170. }
  171.  
  172. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement