Java TragicMob Example

说明

java tragicmob示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Java

类/类型: TragicMob

示例#1
文件: EntityCryse.java项目: TragicNeko/TragicMC2-1.8

 @Override
 protected void entityInit() {
   super.entityInit();
   this.dataWatcher.addObject(DW_SPIN_TICKS, Integer.valueOf(0));
   this.dataWatcher.addObject(DW_CRYSE_TYPE, (byte) 0);
   this.dataWatcher.addObject(DW_TEXTURE_ID, (byte) 0);
   this.dataWatcher.addObject(DW_ATTACK_TIME, Integer.valueOf(0));
   this.dataWatcher.addObject(DW_FLUTTER_TICKS, Integer.valueOf(0));
 }

示例#2
文件: EntityCryse.java项目: TragicNeko/TragicMC2-1.8

 @Override
 public void writeEntityToNBT(NBTTagCompound tag) {
   super.writeEntityToNBT(tag);
   tag.setByte("texture", this.getTextureID());
   tag.setByte("cryseType", this.getCryseType());
   tag.setInteger("spinTicks", this.getSpinTicks());
   tag.setInteger("attackTime", this.getAttackTime());
   tag.setInteger("flutterTicks", this.getFlutterTicks());
 }

示例#3
文件: EntityCryse.java项目: TragicNeko/TragicMC2-1.8

 @Override
 public void readEntityFromNBT(NBTTagCompound tag) {
   super.readEntityFromNBT(tag);
   if (tag.hasKey("texture")) this.setTextureID(tag.getByte("texture"));
   if (tag.hasKey("cryseType")) this.setCryseType(tag.getByte("cryseType"));
   if (tag.hasKey("spinTicks")) this.setSpinTicks(tag.getInteger("spinTicks"));
   if (tag.hasKey("attackTime")) this.setAttackTime(tag.getInteger("attackTime"));
   if (tag.hasKey("flutterTicks")) this.setFlutterTicks(tag.getInteger("flutterTicks"));
 }

示例#4
文件: EntityCryse.java项目: TragicNeko/TragicMC2-1.8

 @Override
 protected void applyEntityAttributes() {
   super.applyEntityAttributes();
   double[] stats =
       TragicConfig.getMobStat(this.getCryseType() == 0 ? "cryseStats" : "starCryseStats")
           .getStats();
   this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(stats[0]);
   this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(stats[1]);
   this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(stats[2]);
   this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(stats[3]);
   this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(stats[4]);
 }

示例#5
文件: EntityCryse.java项目: TragicNeko/TragicMC2-1.8

  @Override
  public void onLivingUpdate() {
    super.onLivingUpdate();

    if (this.worldObj.isRemote) {

    } else {
      if (this.isSpinning()) this.decrementSpinTicks();
      if (this.getAttackTime() > 0) this.decrementAttackTime();
      if (this.isFluttering()) this.decrementFlutterTicks();

      if (this.ticksExisted % 120 == 0
          && this.getAttackTarget() == null
          && rand.nextBoolean()
          && !this.isSpinning()
          && !this.isFluttering()) {
        if (rand.nextBoolean()) {
          this.setSpinTicks(120);
        } else {
          this.setFlutterTicks(60);
        }
      }
    }
  }

展开阅读全文