Advertisement
Corosus

Untitled

Dec 27th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. package ZombieAwareness;
  2.  
  3. import net.minecraft.entity.Entity;
  4. import net.minecraft.nbt.NBTTagCompound;
  5. import net.minecraft.world.World;
  6.  
  7. public class EntityScent extends Entity {
  8.  
  9. public int type = 0;
  10. public boolean isUsed = false;
  11. public int strength;
  12. public int age;
  13.  
  14.  
  15. public EntityScent(World var1) {
  16. super(var1);
  17. this.isImmuneToFire = true;
  18. this.setSize(1.1F, 1.1F);
  19. this.strength = 100;
  20. this.age = 0;
  21. if (!var1.isRemote) {
  22. ZAUtil.traceCount++;
  23. }
  24. //System.out.println("new trace: " + ZAUtil.traceCount);
  25. }
  26.  
  27. @Override
  28. public void setDead() {
  29. super.setDead();
  30. ZAUtil.traceCount--;
  31. }
  32.  
  33. protected boolean canTriggerWalking() {
  34. return false;
  35. }
  36.  
  37. public boolean isInRangeToRenderDist(double var1) {
  38. return true;
  39. }
  40.  
  41. public void entityInit() {}
  42.  
  43. public float getRange() {
  44. //return (float)this.strength / 100.0F * mod_ZombieAwareness.maxPFRange;
  45. //return (float)this.strength / 100.0F * (float)mod_PathingActivated.MaxPFRange.get().intValue();
  46.  
  47. if (this.type == 2) {
  48. return (float)this.strength / 100.0F * 128;
  49. } else if (this.type == 1) {
  50. return (float)this.strength / 100.0F * (float)ZombieAwareness.maxPFRange / 2.0F;
  51. } else {
  52. return (float)this.strength / 100.0F * (float)ZombieAwareness.maxPFRange;
  53. }
  54.  
  55. }
  56.  
  57. public void setStrength(int var1) {
  58. this.age = (100 - var1) * 10;
  59. /*if (age < 0) {
  60. age = 0;
  61. }*/
  62. this.strength = 100 - this.age / 10;
  63. //System.out.println("age: " + age);
  64. }
  65.  
  66. @Override
  67. public void onUpdate() {
  68. if (worldObj.isRemote) return;
  69. ++this.age;
  70. this.strength = 100 - this.age / 10;
  71. //this.setDead();
  72. System.out.println(this.getRange());
  73. if(this.strength <= 0) {
  74. this.setDead();
  75. }
  76. }
  77.  
  78. @Override
  79. public void writeEntityToNBT(NBTTagCompound var1) {
  80. var1.setShort("age", (short)age);
  81. var1.setShort("type", (short)type);
  82. }
  83.  
  84. @Override
  85. public void readEntityFromNBT(NBTTagCompound var1) {
  86. age = var1.getShort("age");
  87. type = var1.getShort("type");
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement