コード例 #1
0
ファイル: BaseMod.java プロジェクト: nevercast/SGCraft
 public void openGui(EntityPlayer player, int id, World world, int x, int y, int z) {
   if (debugGui)
     System.out.printf(
         "BaseMod.openGui: for %s with id %s in %s at (%s, %s, %s)\n",
         /*base*/ this, id, world, x, y, z);
   player.openGui(/*base*/ this, id, world, x, y, z);
 }
コード例 #2
0
 public void setItemInUse(ItemStack itemstack, int i) {
   super.setItemInUse(itemstack, i);
   if (itemstack != null
       && itemstack.getItem() != null
       && itemstack.getItem().getAction(itemstack) == EnumAction.eat) {
     EntityTracker entitytracker = mcServer.getEntityTracker(dimension);
     entitytracker.sendPacketToTrackedPlayersAndTrackedEntity(
         this, new Packet18Animation(this, 5));
   }
 }
コード例 #3
0
 public void wakeUpPlayer(boolean flag, boolean flag1, boolean flag2) {
   if (isPlayerSleeping()) {
     EntityTracker entitytracker = mcServer.getEntityTracker(dimension);
     entitytracker.sendPacketToTrackedPlayersAndTrackedEntity(
         this, new Packet18Animation(this, 3));
   }
   super.wakeUpPlayer(flag, flag1, flag2);
   if (playerNetServerHandler != null) {
     playerNetServerHandler.teleportTo(posX, posY, posZ, rotationYaw, rotationPitch);
   }
 }
コード例 #4
0
 public void onItemPickup(Entity entity, int i) {
   if (!entity.isDead) {
     EntityTracker entitytracker = mcServer.getEntityTracker(dimension);
     if (entity instanceof EntityItem) {
       entitytracker.sendPacketToTrackedPlayers(
           entity, new Packet22Collect(entity.entityId, entityId));
     }
     if (entity instanceof EntityArrow) {
       entitytracker.sendPacketToTrackedPlayers(
           entity, new Packet22Collect(entity.entityId, entityId));
     }
     if (entity instanceof EntityXPOrb) {
       entitytracker.sendPacketToTrackedPlayers(
           entity, new Packet22Collect(entity.entityId, entityId));
     }
   }
   super.onItemPickup(entity, i);
   currentCraftingInventory.updateCraftingResults();
 }
コード例 #5
0
 public void setWorld(World world) {
   super.setWorld(world);
 }
コード例 #6
0
 public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
   super.writeEntityToNBT(nbttagcompound);
   nbttagcompound.setInteger("playerGameType", itemInWorldManager.getGameType());
 }
コード例 #7
0
 public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   if (nbttagcompound.hasKey("playerGameType")) {
     itemInWorldManager.toggleGameType(nbttagcompound.getInteger("playerGameType"));
   }
 }
コード例 #8
0
 protected void onFinishedPotionEffect(PotionEffect potioneffect) {
   super.onFinishedPotionEffect(potioneffect);
   playerNetServerHandler.sendPacket(new Packet42RemoveEntityEffect(entityId, potioneffect));
 }
コード例 #9
0
 protected void onChangedPotionEffect(PotionEffect potioneffect) {
   super.onChangedPotionEffect(potioneffect);
   playerNetServerHandler.sendPacket(new Packet41EntityEffect(entityId, potioneffect));
 }
コード例 #10
0
ファイル: VAnvil.java プロジェクト: vanZeben/VirtualPack
 public void updatePlayerInventory()
 {
     _player.updateInventory(_player.activeContainer);
 }
コード例 #11
0
 public void handleFalling(double d, boolean flag) {
   super.updateFallState(d, flag);
 }
コード例 #12
0
 public void mountEntity(Entity entity) {
   super.mountEntity(entity);
   playerNetServerHandler.sendPacket(new Packet39AttachEntity(this, ridingEntity));
   playerNetServerHandler.teleportTo(posX, posY, posZ, rotationYaw, rotationPitch);
 }
コード例 #13
0
  public void onUpdateEntity(boolean flag) {
    super.onUpdate();
    for (int i = 0; i < inventory.getSizeInventory(); i++) {
      ItemStack itemstack = inventory.getStackInSlot(i);
      if (itemstack == null
          || !Item.itemsList[itemstack.itemID].func_28019_b()
          || playerNetServerHandler.getNumChunkDataPackets() > 2) {
        continue;
      }
      Packet packet =
          ((ItemMapBase) Item.itemsList[itemstack.itemID])
              .getUpdatePacket(itemstack, worldObj, this);
      if (packet != null) {
        playerNetServerHandler.sendPacket(packet);
      }
    }

    if (flag && !loadedChunks.isEmpty()) {
      ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) loadedChunks.get(0);
      if (chunkcoordintpair != null) {
        boolean flag1 = false;
        if (playerNetServerHandler.getNumChunkDataPackets() < 4) {
          flag1 = true;
        }
        if (flag1) {
          WorldServer worldserver = mcServer.getWorldManager(dimension);
          loadedChunks.remove(chunkcoordintpair);
          playerNetServerHandler.sendPacket(
              new Packet51MapChunk(
                  chunkcoordintpair.chunkXPos * 16,
                  0,
                  chunkcoordintpair.chunkZPos * 16,
                  16,
                  worldserver.worldYMax,
                  16,
                  worldserver));
          List list =
              worldserver.getTileEntityList(
                  chunkcoordintpair.chunkXPos * 16,
                  0,
                  chunkcoordintpair.chunkZPos * 16,
                  chunkcoordintpair.chunkXPos * 16 + 16,
                  worldserver.worldYMax,
                  chunkcoordintpair.chunkZPos * 16 + 16);
          for (int j = 0; j < list.size(); j++) {
            getTileEntityInfo((TileEntity) list.get(j));
          }
        }
      }
    }
    if (inPortal) {
      if (mcServer.propertyManagerObj.getBooleanProperty("allow-nether", true)) {
        if (currentCraftingInventory != personalCraftingInventory) {
          usePersonalCraftingInventory();
        }
        if (ridingEntity != null) {
          mountEntity(ridingEntity);
        } else {
          timeInPortal += 0.0125F;
          if (timeInPortal >= 1.0F) {
            timeInPortal = 1.0F;
            timeUntilPortal = 10;
            byte byte0 = 0;
            if (dimension == -1) {
              byte0 = 0;
            } else {
              byte0 = -1;
            }
            mcServer.configManager.sendPlayerToOtherDimension(this, byte0);
            field_35220_ce = -1;
            lastHealth = -1;
            field_35221_cc = -1;
            triggerAchievement(AchievementList.portal);
          }
        }
        inPortal = false;
      }
    } else {
      if (timeInPortal > 0.0F) {
        timeInPortal -= 0.05F;
      }
      if (timeInPortal < 0.0F) {
        timeInPortal = 0.0F;
      }
    }
    if (timeUntilPortal > 0) {
      timeUntilPortal--;
    }
    if (getEntityHealth() != lastHealth
        || field_35221_cc != foodStats.getFoodLevel()
        || (foodStats.getSaturationLevel() == 0.0F) != field_35222_cd) {
      playerNetServerHandler.sendPacket(
          new Packet8UpdateHealth(
              getEntityHealth(), foodStats.getFoodLevel(), foodStats.getSaturationLevel()));
      lastHealth = getEntityHealth();
      field_35221_cc = foodStats.getFoodLevel();
      field_35222_cd = foodStats.getSaturationLevel() == 0.0F;
    }
    if (experienceTotal != field_35220_ce) {
      field_35220_ce = experienceTotal;
      playerNetServerHandler.sendPacket(
          new Packet43Experience(experience, experienceTotal, experienceLevel));
    }
  }
コード例 #14
0
 public void heal(int i) {
   super.heal(i);
 }
コード例 #15
0
 public EntityPlayerMP func_72368_a(
     EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_) {
   p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_);
   p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_);
   p_72368_1_.func_71121_q().func_73040_p().func_72695_c(p_72368_1_);
   field_72404_b.remove(p_72368_1_);
   field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_);
   ChunkCoordinates chunkcoordinates = p_72368_1_.func_70997_bJ();
   p_72368_1_.field_71093_bK = p_72368_2_;
   Object obj;
   if (field_72400_f.func_71242_L()) {
     obj = new DemoWorldManager(field_72400_f.func_71218_a(p_72368_1_.field_71093_bK));
   } else {
     obj = new ItemInWorldManager(field_72400_f.func_71218_a(p_72368_1_.field_71093_bK));
   }
   EntityPlayerMP entityplayermp =
       new EntityPlayerMP(
           field_72400_f,
           field_72400_f.func_71218_a(p_72368_1_.field_71093_bK),
           p_72368_1_.field_71092_bJ,
           ((ItemInWorldManager) (obj)));
   entityplayermp.func_71049_a(p_72368_1_, p_72368_3_);
   entityplayermp.field_70157_k = p_72368_1_.field_70157_k;
   entityplayermp.field_71135_a = p_72368_1_.field_71135_a;
   WorldServer worldserver = field_72400_f.func_71218_a(p_72368_1_.field_71093_bK);
   func_72381_a(entityplayermp, p_72368_1_, worldserver);
   if (chunkcoordinates != null) {
     ChunkCoordinates chunkcoordinates1 =
         EntityPlayer.func_71056_a(
             field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), chunkcoordinates);
     if (chunkcoordinates1 != null) {
       entityplayermp.func_70012_b(
           (float) chunkcoordinates1.field_71574_a + 0.5F,
           (float) chunkcoordinates1.field_71572_b + 0.1F,
           (float) chunkcoordinates1.field_71573_c + 0.5F,
           0.0F,
           0.0F);
       entityplayermp.func_71063_a(chunkcoordinates);
     } else {
       entityplayermp.field_71135_a.func_72567_b(new Packet70GameEvent(0, 0));
     }
   }
   worldserver.field_73059_b.func_73158_c(
       (int) entityplayermp.field_70165_t >> 4, (int) entityplayermp.field_70161_v >> 4);
   for (;
       !worldserver.func_72945_a(entityplayermp, entityplayermp.field_70121_D).isEmpty();
       entityplayermp.func_70107_b(
           entityplayermp.field_70165_t,
           entityplayermp.field_70163_u + 1.0D,
           entityplayermp.field_70161_v)) {}
   entityplayermp.field_71135_a.func_72567_b(
       new Packet9Respawn(
           entityplayermp.field_71093_bK,
           (byte) entityplayermp.field_70170_p.field_73013_u,
           entityplayermp.field_70170_p.func_72912_H().func_76067_t(),
           entityplayermp.field_70170_p.func_72800_K(),
           entityplayermp.field_71134_c.func_73081_b()));
   ChunkCoordinates chunkcoordinates2 = worldserver.func_72861_E();
   entityplayermp.field_71135_a.func_72569_a(
       entityplayermp.field_70165_t,
       entityplayermp.field_70163_u,
       entityplayermp.field_70161_v,
       entityplayermp.field_70177_z,
       entityplayermp.field_70125_A);
   entityplayermp.field_71135_a.func_72567_b(
       new Packet6SpawnPosition(
           chunkcoordinates2.field_71574_a,
           chunkcoordinates2.field_71572_b,
           chunkcoordinates2.field_71573_c));
   func_72354_b(entityplayermp, worldserver);
   worldserver.func_73040_p().func_72683_a(entityplayermp);
   worldserver.func_72838_d(entityplayermp);
   field_72404_b.add(entityplayermp);
   entityplayermp.func_71116_b();
   return entityplayermp;
 }
コード例 #16
0
 public void removeExperience(int i) {
   super.removeExperience(i);
   field_35220_ce = -1;
 }
コード例 #17
0
 public boolean func_71903_a(
     World p_71903_1_,
     int p_71903_2_,
     int p_71903_3_,
     int p_71903_4_,
     EntityPlayer p_71903_5_,
     int p_71903_6_,
     float p_71903_7_,
     float p_71903_8_,
     float p_71903_9_) {
   Object obj = (TileEntityChest) p_71903_1_.func_72796_p(p_71903_2_, p_71903_3_, p_71903_4_);
   if (obj == null) {
     return true;
   }
   if (p_71903_1_.func_72809_s(p_71903_2_, p_71903_3_ + 1, p_71903_4_)) {
     return true;
   }
   if (func_72292_n(p_71903_1_, p_71903_2_, p_71903_3_, p_71903_4_)) {
     return true;
   }
   if (p_71903_1_.func_72798_a(p_71903_2_ - 1, p_71903_3_, p_71903_4_) == field_71990_ca
       && (p_71903_1_.func_72809_s(p_71903_2_ - 1, p_71903_3_ + 1, p_71903_4_)
           || func_72292_n(p_71903_1_, p_71903_2_ - 1, p_71903_3_, p_71903_4_))) {
     return true;
   }
   if (p_71903_1_.func_72798_a(p_71903_2_ + 1, p_71903_3_, p_71903_4_) == field_71990_ca
       && (p_71903_1_.func_72809_s(p_71903_2_ + 1, p_71903_3_ + 1, p_71903_4_)
           || func_72292_n(p_71903_1_, p_71903_2_ + 1, p_71903_3_, p_71903_4_))) {
     return true;
   }
   if (p_71903_1_.func_72798_a(p_71903_2_, p_71903_3_, p_71903_4_ - 1) == field_71990_ca
       && (p_71903_1_.func_72809_s(p_71903_2_, p_71903_3_ + 1, p_71903_4_ - 1)
           || func_72292_n(p_71903_1_, p_71903_2_, p_71903_3_, p_71903_4_ - 1))) {
     return true;
   }
   if (p_71903_1_.func_72798_a(p_71903_2_, p_71903_3_, p_71903_4_ + 1) == field_71990_ca
       && (p_71903_1_.func_72809_s(p_71903_2_, p_71903_3_ + 1, p_71903_4_ + 1)
           || func_72292_n(p_71903_1_, p_71903_2_, p_71903_3_, p_71903_4_ + 1))) {
     return true;
   }
   if (p_71903_1_.func_72798_a(p_71903_2_ - 1, p_71903_3_, p_71903_4_) == field_71990_ca) {
     obj =
         new InventoryLargeChest(
             "container.chestDouble",
             (TileEntityChest) p_71903_1_.func_72796_p(p_71903_2_ - 1, p_71903_3_, p_71903_4_),
             ((IInventory) (obj)));
   }
   if (p_71903_1_.func_72798_a(p_71903_2_ + 1, p_71903_3_, p_71903_4_) == field_71990_ca) {
     obj =
         new InventoryLargeChest(
             "container.chestDouble",
             ((IInventory) (obj)),
             (TileEntityChest) p_71903_1_.func_72796_p(p_71903_2_ + 1, p_71903_3_, p_71903_4_));
   }
   if (p_71903_1_.func_72798_a(p_71903_2_, p_71903_3_, p_71903_4_ - 1) == field_71990_ca) {
     obj =
         new InventoryLargeChest(
             "container.chestDouble",
             (TileEntityChest) p_71903_1_.func_72796_p(p_71903_2_, p_71903_3_, p_71903_4_ - 1),
             ((IInventory) (obj)));
   }
   if (p_71903_1_.func_72798_a(p_71903_2_, p_71903_3_, p_71903_4_ + 1) == field_71990_ca) {
     obj =
         new InventoryLargeChest(
             "container.chestDouble",
             ((IInventory) (obj)),
             (TileEntityChest) p_71903_1_.func_72796_p(p_71903_2_, p_71903_3_, p_71903_4_ + 1));
   }
   if (p_71903_1_.field_72995_K) {
     return true;
   } else {
     p_71903_5_.func_71007_a(((IInventory) (obj)));
     return true;
   }
 }
コード例 #18
0
 protected void func_35199_C() {
   playerNetServerHandler.sendPacket(new Packet38EntityStatus(entityId, (byte) 9));
   super.func_35199_C();
 }