Java 类net.minecraft.network.packet.Packet39AttachEntity 实例源码

项目:RuneCraftery    文件:EntityLiving.java   
/**
 * Removes the leash from this entity. Second parameter tells whether to send a packet to surrounding players.
 */
public void clearLeashed(boolean par1, boolean par2)
{
    if (this.isLeashed)
    {
        this.isLeashed = false;
        this.leashedToEntity = null;

        if (!this.worldObj.isRemote && par2)
        {
            this.dropItem(Item.leash.itemID, 1);
        }

        if (!this.worldObj.isRemote && par1 && this.worldObj instanceof WorldServer)
        {
            ((WorldServer)this.worldObj).getEntityTracker().sendPacketToAllPlayersTrackingEntity(this, new Packet39AttachEntity(1, this, (Entity)null));
        }
    }
}
项目:BetterNutritionMod    文件:EntityLiving.java   
/**
 * Removes the leash from this entity. Second parameter tells whether to send a packet to surrounding players.
 */
public void clearLeashed(boolean par1, boolean par2)
{
    if (this.isLeashed)
    {
        this.isLeashed = false;
        this.leashedToEntity = null;

        if (!this.worldObj.isRemote && par2)
        {
            this.dropItem(Item.leash.itemID, 1);
        }

        if (!this.worldObj.isRemote && par1 && this.worldObj instanceof WorldServer)
        {
            ((WorldServer)this.worldObj).getEntityTracker().sendPacketToAllPlayersTrackingEntity(this, new Packet39AttachEntity(1, this, (Entity)null));
        }
    }
}
项目:RuneCraftery    文件:EntityLiving.java   
public void func_110160_i(boolean p_110160_1_, boolean p_110160_2_) {
   if(this.field_110169_bv) {
      this.field_110169_bv = false;
      this.field_110168_bw = null;
      if(!this.field_70170_p.field_72995_K && p_110160_2_) {
         this.func_70025_b(Item.field_111214_ch.field_77779_bT, 1);
      }

      if(!this.field_70170_p.field_72995_K && p_110160_1_ && this.field_70170_p instanceof WorldServer) {
         ((WorldServer)this.field_70170_p).func_73039_n().func_72784_a(this, new Packet39AttachEntity(1, this, (Entity)null));
      }
   }

}
项目:RuneCraftery    文件:EntityLiving.java   
public void func_110162_b(Entity p_110162_1_, boolean p_110162_2_) {
   this.field_110169_bv = true;
   this.field_110168_bw = p_110162_1_;
   if(!this.field_70170_p.field_72995_K && p_110162_2_ && this.field_70170_p instanceof WorldServer) {
      ((WorldServer)this.field_70170_p).func_73039_n().func_72784_a(this, new Packet39AttachEntity(1, this, this.field_110168_bw));
   }

}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72484_a(Packet39AttachEntity p_72484_1_) {
   Object var2 = this.func_72545_a(p_72484_1_.field_111006_b);
   Entity var3 = this.func_72545_a(p_72484_1_.field_73296_b);
   if(p_72484_1_.field_111007_a == 0) {
      boolean var4 = false;
      if(p_72484_1_.field_111006_b == this.field_72563_h.field_71439_g.field_70157_k) {
         var2 = this.field_72563_h.field_71439_g;
         if(var3 instanceof EntityBoat) {
            ((EntityBoat)var3).func_70270_d(false);
         }

         var4 = ((Entity)var2).field_70154_o == null && var3 != null;
      } else if(var3 instanceof EntityBoat) {
         ((EntityBoat)var3).func_70270_d(true);
      }

      if(var2 == null) {
         return;
      }

      ((Entity)var2).func_70078_a(var3);
      if(var4) {
         GameSettings var5 = this.field_72563_h.field_71474_y;
         this.field_72563_h.field_71456_v.func_110326_a(I18n.func_135052_a("mount.onboard", new Object[]{GameSettings.func_74298_c(var5.field_74311_E.field_74512_d)}), false);
      }
   } else if(p_72484_1_.field_111007_a == 1 && var2 != null && var2 instanceof EntityLiving) {
      if(var3 != null) {
         ((EntityLiving)var2).func_110162_b(var3, false);
      } else {
         ((EntityLiving)var2).func_110160_i(false, false);
      }
   }

}
项目:RuneCraftery    文件:EntityPlayerMP.java   
/**
 * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat.
 */
public void mountEntity(Entity par1Entity)
{
    super.mountEntity(par1Entity);
    this.playerNetServerHandler.sendPacketToPlayer(new Packet39AttachEntity(0, this, this.ridingEntity));
    this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
}
项目:BetterNutritionMod    文件:EntityPlayerMP.java   
/**
 * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat.
 */
public void mountEntity(Entity par1Entity)
{
    super.mountEntity(par1Entity);
    this.playerNetServerHandler.sendPacketToPlayer(new Packet39AttachEntity(0, this, this.ridingEntity));
    this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
}
项目:forge_world_downloader    文件:WDLNetClientHandler.java   
@Override
public void handleAttachEntity(Packet39AttachEntity par1Packet39AttachEntity)
{
    nch.handleAttachEntity(par1Packet39AttachEntity);       
}
项目:RuneCraftery    文件:EntityTrackerEntry.java   
public void func_73117_b(EntityPlayerMP p_73117_1_) {
   if(p_73117_1_ != this.field_73132_a) {
      double var2 = p_73117_1_.field_70165_t - (double)(this.field_73128_d / 32);
      double var4 = p_73117_1_.field_70161_v - (double)(this.field_73126_f / 32);
      if(var2 >= (double)(-this.field_73130_b) && var2 <= (double)this.field_73130_b && var4 >= (double)(-this.field_73130_b) && var4 <= (double)this.field_73130_b) {
         if(!this.field_73134_o.contains(p_73117_1_) && (this.func_73121_d(p_73117_1_) || this.field_73132_a.field_98038_p)) {
            this.field_73134_o.add(p_73117_1_);
            Packet var6 = this.func_73124_b();
            p_73117_1_.field_71135_a.func_72567_b(var6);
            if(!this.field_73132_a.func_70096_w().func_92085_d()) {
               p_73117_1_.field_71135_a.func_72567_b(new Packet40EntityMetadata(this.field_73132_a.field_70157_k, this.field_73132_a.func_70096_w(), true));
            }

            if(this.field_73132_a instanceof EntityLivingBase) {
               ServersideAttributeMap var7 = (ServersideAttributeMap)((EntityLivingBase)this.field_73132_a).func_110140_aT();
               Collection var8 = var7.func_111160_c();
               if(!var8.isEmpty()) {
                  p_73117_1_.field_71135_a.func_72567_b(new Packet44UpdateAttributes(this.field_73132_a.field_70157_k, var8));
               }
            }

            this.field_73137_j = this.field_73132_a.field_70159_w;
            this.field_73138_k = this.field_73132_a.field_70181_x;
            this.field_73135_l = this.field_73132_a.field_70179_y;
            if(this.field_73143_t && !(var6 instanceof Packet24MobSpawn)) {
               p_73117_1_.field_71135_a.func_72567_b(new Packet28EntityVelocity(this.field_73132_a.field_70157_k, this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y));
            }

            if(this.field_73132_a.field_70154_o != null) {
               p_73117_1_.field_71135_a.func_72567_b(new Packet39AttachEntity(0, this.field_73132_a, this.field_73132_a.field_70154_o));
            }

            if(this.field_73132_a instanceof EntityLiving && ((EntityLiving)this.field_73132_a).func_110166_bE() != null) {
               p_73117_1_.field_71135_a.func_72567_b(new Packet39AttachEntity(1, this.field_73132_a, ((EntityLiving)this.field_73132_a).func_110166_bE()));
            }

            if(this.field_73132_a instanceof EntityLivingBase) {
               for(int var10 = 0; var10 < 5; ++var10) {
                  ItemStack var13 = ((EntityLivingBase)this.field_73132_a).func_71124_b(var10);
                  if(var13 != null) {
                     p_73117_1_.field_71135_a.func_72567_b(new Packet5PlayerInventory(this.field_73132_a.field_70157_k, var10, var13));
                  }
               }
            }

            if(this.field_73132_a instanceof EntityPlayer) {
               EntityPlayer var11 = (EntityPlayer)this.field_73132_a;
               if(var11.func_70608_bn()) {
                  p_73117_1_.field_71135_a.func_72567_b(new Packet17Sleep(this.field_73132_a, 0, MathHelper.func_76128_c(this.field_73132_a.field_70165_t), MathHelper.func_76128_c(this.field_73132_a.field_70163_u), MathHelper.func_76128_c(this.field_73132_a.field_70161_v)));
               }
            }

            if(this.field_73132_a instanceof EntityLivingBase) {
               EntityLivingBase var14 = (EntityLivingBase)this.field_73132_a;
               Iterator var12 = var14.func_70651_bq().iterator();

               while(var12.hasNext()) {
                  PotionEffect var9 = (PotionEffect)var12.next();
                  p_73117_1_.field_71135_a.func_72567_b(new Packet41EntityEffect(this.field_73132_a.field_70157_k, var9));
               }
            }
         }
      } else if(this.field_73134_o.contains(p_73117_1_)) {
         this.field_73134_o.remove(p_73117_1_);
         p_73117_1_.field_71130_g.add(Integer.valueOf(this.field_73132_a.field_70157_k));
      }

   }
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
public void func_70078_a(Entity p_70078_1_) {
   super.func_70078_a(p_70078_1_);
   this.field_71135_a.func_72567_b(new Packet39AttachEntity(0, this, this.field_70154_o));
   this.field_71135_a.func_72569_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A);
}
项目:RuneCraftery    文件:NetHandler.java   
public void func_72484_a(Packet39AttachEntity p_72484_1_) {
   this.func_72509_a(p_72484_1_);
}
项目:RuneCraftery    文件:NetClientHandler.java   
/**
 * Packet handler
 */
public void handleAttachEntity(Packet39AttachEntity par1Packet39AttachEntity)
{
    Object object = this.getEntityByID(par1Packet39AttachEntity.ridingEntityId);
    Entity entity = this.getEntityByID(par1Packet39AttachEntity.vehicleEntityId);

    if (par1Packet39AttachEntity.attachState == 0)
    {
        boolean flag = false;

        if (par1Packet39AttachEntity.ridingEntityId == this.mc.thePlayer.entityId)
        {
            object = this.mc.thePlayer;

            if (entity instanceof EntityBoat)
            {
                ((EntityBoat)entity).func_70270_d(false);
            }

            flag = ((Entity)object).ridingEntity == null && entity != null;
        }
        else if (entity instanceof EntityBoat)
        {
            ((EntityBoat)entity).func_70270_d(true);
        }

        if (object == null)
        {
            return;
        }

        ((Entity)object).mountEntity(entity);

        if (flag)
        {
            GameSettings gamesettings = this.mc.gameSettings;
            this.mc.ingameGUI.func_110326_a(I18n.getStringParams("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindSneak.keyCode)}), false);
        }
    }
    else if (par1Packet39AttachEntity.attachState == 1 && object != null && object instanceof EntityLiving)
    {
        if (entity != null)
        {
            ((EntityLiving)object).setLeashedToEntity(entity, false);
        }
        else
        {
            ((EntityLiving)object).clearLeashed(false, false);
        }
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
/**
 * Packet handler
 */
public void handleAttachEntity(Packet39AttachEntity par1Packet39AttachEntity)
{
    Object object = this.getEntityByID(par1Packet39AttachEntity.ridingEntityId);
    Entity entity = this.getEntityByID(par1Packet39AttachEntity.vehicleEntityId);

    if (par1Packet39AttachEntity.attachState == 0)
    {
        boolean flag = false;

        if (par1Packet39AttachEntity.ridingEntityId == this.mc.thePlayer.entityId)
        {
            object = this.mc.thePlayer;

            if (entity instanceof EntityBoat)
            {
                ((EntityBoat)entity).func_70270_d(false);
            }

            flag = ((Entity)object).ridingEntity == null && entity != null;
        }
        else if (entity instanceof EntityBoat)
        {
            ((EntityBoat)entity).func_70270_d(true);
        }

        if (object == null)
        {
            return;
        }

        ((Entity)object).mountEntity(entity);

        if (flag)
        {
            GameSettings gamesettings = this.mc.gameSettings;
            this.mc.ingameGUI.func_110326_a(I18n.getStringParams("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindSneak.keyCode)}), false);
        }
    }
    else if (par1Packet39AttachEntity.attachState == 1 && object != null && object instanceof EntityLiving)
    {
        if (entity != null)
        {
            ((EntityLiving)object).setLeashedToEntity(entity, false);
        }
        else
        {
            ((EntityLiving)object).clearLeashed(false, false);
        }
    }
}