예제 #1
0
 @Override
 public void readEntityFromNBT(NBTTagCompound nbt) {
   super.readEntityFromNBT(nbt);
   this.fuseTicks = nbt.getShort("Fuse");
   if (nbt.hasKey("ex")) {
     ex = ExplosiveRegistry.get(nbt.getString("ex"));
     ex_size = Math.max(nbt.getDouble("size"), 1.0);
     if (nbt.hasKey("ex_data")) ex_data = nbt.getCompoundTag("ex_data");
   }
 }
예제 #2
0
 @Override
 public void readSpawnData(ByteBuf buffer) {
   boolean ex_exists = buffer.readBoolean();
   if (ex_exists) {
     ex = ExplosiveRegistry.get(ByteBufUtils.readUTF8String(buffer));
     ex_data = ByteBufUtils.readTag(buffer);
   } else {
     ex = null;
     ex_data = null;
   }
 }
예제 #3
0
 protected void explode() {
   if (!this.worldObj.isRemote) {
     boolean allow_mob_damage =
         this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
     if (ex == null) {
       this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 3, allow_mob_damage);
     } else {
       ExplosiveRegistry.triggerExplosive(
           new Location(this), ex, new TriggerCause.TriggerCauseEntity(this), ex_size, ex_data);
     }
     this.setDead();
   }
 }