当前位置: 首页>>代码示例>>Java>>正文


Java Packet15Place类代码示例

本文整理汇总了Java中net.minecraft.network.packet.Packet15Place的典型用法代码示例。如果您正苦于以下问题:Java Packet15Place类的具体用法?Java Packet15Place怎么用?Java Packet15Place使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Packet15Place类属于net.minecraft.network.packet包,在下文中一共展示了Packet15Place类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: func_78769_a

import net.minecraft.network.packet.Packet15Place; //导入依赖的package包/类
public boolean func_78769_a(EntityPlayer p_78769_1_, World p_78769_2_, ItemStack p_78769_3_) {
   this.func_78750_j();
   this.field_78774_b.func_72552_c(new Packet15Place(-1, -1, -1, 255, p_78769_1_.field_71071_by.func_70448_g(), 0.0F, 0.0F, 0.0F));
   int var4 = p_78769_3_.field_77994_a;
   ItemStack var5 = p_78769_3_.func_77957_a(p_78769_2_, p_78769_1_);
   if(var5 == p_78769_3_ && (var5 == null || var5.field_77994_a == var4)) {
      return false;
   } else {
      p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = var5;
      if(var5.field_77994_a == 0) {
         p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = null;
      }

      return true;
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:17,代码来源:PlayerControllerMP.java

示例2: sendUseItem

import net.minecraft.network.packet.Packet15Place; //导入依赖的package包/类
/**
 * Notifies the server of things like consuming food, etc...
 */
public boolean sendUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack)
{
    this.syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new Packet15Place(-1, -1, -1, 255, par1EntityPlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F));
    int i = par3ItemStack.stackSize;
    ItemStack itemstack1 = par3ItemStack.useItemRightClick(par2World, par1EntityPlayer);

    if (itemstack1 == par3ItemStack && (itemstack1 == null || itemstack1.stackSize == i))
    {
        return false;
    }
    else
    {
        par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = itemstack1;

        if (itemstack1.stackSize <= 0)
        {
            par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null;
            MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(par1EntityPlayer, itemstack1));
        }

        return true;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:28,代码来源:PlayerControllerMP.java

示例3: func_78760_a

import net.minecraft.network.packet.Packet15Place; //导入依赖的package包/类
public boolean func_78760_a(EntityPlayer p_78760_1_, World p_78760_2_, ItemStack p_78760_3_, int p_78760_4_, int p_78760_5_, int p_78760_6_, int p_78760_7_, Vec3 p_78760_8_) {
   this.func_78750_j();
   float var9 = (float)p_78760_8_.field_72450_a - (float)p_78760_4_;
   float var10 = (float)p_78760_8_.field_72448_b - (float)p_78760_5_;
   float var11 = (float)p_78760_8_.field_72449_c - (float)p_78760_6_;
   boolean var12 = false;
   int var13;
   if(!p_78760_1_.func_70093_af() || p_78760_1_.func_70694_bm() == null) {
      var13 = p_78760_2_.func_72798_a(p_78760_4_, p_78760_5_, p_78760_6_);
      if(var13 > 0 && Block.field_71973_m[var13].func_71903_a(p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_1_, p_78760_7_, var9, var10, var11)) {
         var12 = true;
      }
   }

   if(!var12 && p_78760_3_ != null && p_78760_3_.func_77973_b() instanceof ItemBlock) {
      ItemBlock var16 = (ItemBlock)p_78760_3_.func_77973_b();
      if(!var16.func_77884_a(p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, p_78760_1_, p_78760_3_)) {
         return false;
      }
   }

   this.field_78774_b.func_72552_c(new Packet15Place(p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, p_78760_1_.field_71071_by.func_70448_g(), var9, var10, var11));
   if(var12) {
      return true;
   } else if(p_78760_3_ == null) {
      return false;
   } else if(this.field_78779_k.func_77145_d()) {
      var13 = p_78760_3_.func_77960_j();
      int var14 = p_78760_3_.field_77994_a;
      boolean var15 = p_78760_3_.func_77943_a(p_78760_1_, p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, var9, var10, var11);
      p_78760_3_.func_77964_b(var13);
      p_78760_3_.field_77994_a = var14;
      return var15;
   } else {
      return p_78760_3_.func_77943_a(p_78760_1_, p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, var9, var10, var11);
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:38,代码来源:PlayerControllerMP.java

示例4: place

import net.minecraft.network.packet.Packet15Place; //导入依赖的package包/类
public static boolean place(EntityPlayer player, World world) {
    MovingObjectPosition hit = RayTracer.reTrace(world, player);
    if (hit == null)
        return false;

    BlockCoord pos = new BlockCoord(hit.blockX, hit.blockY, hit.blockZ).offset(hit.sideHit);
    ItemStack held = player.getHeldItem();
    McBlockPart part = null;
    if (held == null)
        return false;

    if (held.func_150998_b() == Chisel.blockCarpetFloor.blockID)
        part = MultiPartCarpetTest.placement(world, pos, hit.sideHit, held.getItemDamage());

    if (part == null)
        return false;

    if (world.isRemote && !player.isSneaking())//attempt to use block activated like normal and tell the server the right stuff
    {
        Vector3 f = new Vector3(hit.hitVec).add(-hit.blockX, -hit.blockY, -hit.blockZ);
        Block block = world.getBlock(hit.blockX, hit.blockY, hit.blockZ);
        if (block != null && !ignoreActivate(block) && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float) f.x, (float) f.y, (float) f.z)) {
            player.swingItem();
            PacketCustom.sendToServer(new Packet15Place(
                    hit.blockX, hit.blockY, hit.blockZ, hit.sideHit,
                    player.inventory.getCurrentItem(),
                    (float) f.x, (float) f.y, (float) f.z));
            return false;
        }
    }

    TileMultipart tile = TileMultipart.getOrConvertTile(world, pos);
    if (tile == null || !tile.canAddPart(part))
        return false;

    if (!world.isRemote) {
        TileMultipart.addPart(world, pos, part);
        world.playSoundEffect(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5,
                part.getBlock().stepSound.getBreakSound(),
                (part.getBlock().stepSound.getVolume() + 1.0F) / 2.0F,
                part.getBlock().stepSound.getPitch() * 0.8F);
        if (!player.capabilities.isCreativeMode) {
            held.stackSize--;
            if (held.stackSize == 0) {
                player.inventory.mainInventory[player.inventory.currentItem] = null;
                MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, held));
            }
        }
    } else {
        player.swingItem();
        TinyChiselPacketHandler.signalServer();
    }
    return true;
}
 
开发者ID:delta534,项目名称:Chisel,代码行数:55,代码来源:ChiselEventHandler.java

示例5: func_72472_a

import net.minecraft.network.packet.Packet15Place; //导入依赖的package包/类
public void func_72472_a(Packet15Place p_72472_1_) {
   this.func_72509_a(p_72472_1_);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:4,代码来源:NetHandler.java

示例6: func_72472_a

import net.minecraft.network.packet.Packet15Place; //导入依赖的package包/类
public void func_72472_a(Packet15Place p_72472_1_) {
   WorldServer var2 = this.field_72573_d.func_71218_a(this.field_72574_e.field_71093_bK);
   ItemStack var3 = this.field_72574_e.field_71071_by.func_70448_g();
   boolean var4 = false;
   int var5 = p_72472_1_.func_73403_d();
   int var6 = p_72472_1_.func_73402_f();
   int var7 = p_72472_1_.func_73407_g();
   int var8 = p_72472_1_.func_73401_h();
   this.field_72574_e.func_143004_u();
   if(p_72472_1_.func_73401_h() == 255) {
      if(var3 == null) {
         return;
      }

      this.field_72574_e.field_71134_c.func_73085_a(this.field_72574_e, var2, var3);
   } else if(p_72472_1_.func_73402_f() >= this.field_72573_d.func_71207_Z() - 1 && (p_72472_1_.func_73401_h() == 1 || p_72472_1_.func_73402_f() >= this.field_72573_d.func_71207_Z())) {
      this.field_72574_e.field_71135_a.func_72567_b(new Packet3Chat(ChatMessageComponent.func_111082_b("build.tooHigh", new Object[]{Integer.valueOf(this.field_72573_d.func_71207_Z())}).func_111059_a(EnumChatFormatting.RED)));
      var4 = true;
   } else {
      if(this.field_72587_r && this.field_72574_e.func_70092_e((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < 64.0D && !this.field_72573_d.func_96290_a(var2, var5, var6, var7, this.field_72574_e)) {
         this.field_72574_e.field_71134_c.func_73078_a(this.field_72574_e, var2, var3, var5, var6, var7, var8, p_72472_1_.func_73406_j(), p_72472_1_.func_73404_l(), p_72472_1_.func_73408_m());
      }

      var4 = true;
   }

   if(var4) {
      this.field_72574_e.field_71135_a.func_72567_b(new Packet53BlockChange(var5, var6, var7, var2));
      if(var8 == 0) {
         --var6;
      }

      if(var8 == 1) {
         ++var6;
      }

      if(var8 == 2) {
         --var7;
      }

      if(var8 == 3) {
         ++var7;
      }

      if(var8 == 4) {
         --var5;
      }

      if(var8 == 5) {
         ++var5;
      }

      this.field_72574_e.field_71135_a.func_72567_b(new Packet53BlockChange(var5, var6, var7, var2));
   }

   var3 = this.field_72574_e.field_71071_by.func_70448_g();
   if(var3 != null && var3.field_77994_a == 0) {
      this.field_72574_e.field_71071_by.field_70462_a[this.field_72574_e.field_71071_by.field_70461_c] = null;
      var3 = null;
   }

   if(var3 == null || var3.func_77988_m() == 0) {
      this.field_72574_e.field_71137_h = true;
      this.field_72574_e.field_71071_by.field_70462_a[this.field_72574_e.field_71071_by.field_70461_c] = ItemStack.func_77944_b(this.field_72574_e.field_71071_by.field_70462_a[this.field_72574_e.field_71071_by.field_70461_c]);
      Slot var9 = this.field_72574_e.field_71070_bA.func_75147_a(this.field_72574_e.field_71071_by, this.field_72574_e.field_71071_by.field_70461_c);
      this.field_72574_e.field_71070_bA.func_75142_b();
      this.field_72574_e.field_71137_h = false;
      if(!ItemStack.func_77989_b(this.field_72574_e.field_71071_by.func_70448_g(), p_72472_1_.func_73405_i())) {
         this.func_72567_b(new Packet103SetSlot(this.field_72574_e.field_71070_bA.field_75152_c, var9.field_75222_d, this.field_72574_e.field_71071_by.func_70448_g()));
      }
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:74,代码来源:NetServerHandler.java

示例7: onPlayerRightClick

import net.minecraft.network.packet.Packet15Place; //导入依赖的package包/类
/**
 * Handles a players right click. Args: player, world, x, y, z, side, hitVec
 */
public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, Vec3 par8Vec3)
{
    this.syncCurrentPlayItem();
    float f = (float)par8Vec3.xCoord - (float)par4;
    float f1 = (float)par8Vec3.yCoord - (float)par5;
    float f2 = (float)par8Vec3.zCoord - (float)par6;
    boolean flag = false;
    int i1;
    if (par3ItemStack != null &&
        par3ItemStack.getItem() != null &&
        par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2))
    {
            return true;
    }

    if (!par1EntityPlayer.isSneaking() || (par1EntityPlayer.getHeldItem() == null || par1EntityPlayer.getHeldItem().getItem().shouldPassSneakingClickToBlock(par2World, par4, par5, par6)))
    {
        i1 = par2World.getBlockId(par4, par5, par6);

        if (i1 > 0 && Block.blocksList[i1].onBlockActivated(par2World, par4, par5, par6, par1EntityPlayer, par7, f, f1, f2))
        {
            flag = true;
        }
    }

    if (!flag && par3ItemStack != null && par3ItemStack.getItem() instanceof ItemBlock)
    {
        ItemBlock itemblock = (ItemBlock)par3ItemStack.getItem();

        if (!itemblock.canPlaceItemBlockOnSide(par2World, par4, par5, par6, par7, par1EntityPlayer, par3ItemStack))
        {
            return false;
        }
    }

    this.netClientHandler.addToSendQueue(new Packet15Place(par4, par5, par6, par7, par1EntityPlayer.inventory.getCurrentItem(), f, f1, f2));

    if (flag)
    {
        return true;
    }
    else if (par3ItemStack == null)
    {
        return false;
    }
    else if (this.currentGameType.isCreative())
    {
        i1 = par3ItemStack.getItemDamage();
        int j1 = par3ItemStack.stackSize;
        boolean flag1 = par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2);
        par3ItemStack.setItemDamage(i1);
        par3ItemStack.stackSize = j1;
        return flag1;
    }
    else
    {
        if (!par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2))
        {
            return false;
        }
        if (par3ItemStack.stackSize <= 0)
        {
            MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(par1EntityPlayer, par3ItemStack));
        }
        return true;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:71,代码来源:PlayerControllerMP.java


注:本文中的net.minecraft.network.packet.Packet15Place类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。