コード例 #1
0
 public EntityPlayerMP(
     MinecraftServer minecraftserver,
     World world,
     String s,
     ItemInWorldManager iteminworldmanager) {
   super(world);
   loadedChunks = new LinkedList();
   listeningChunks = new HashSet();
   lastHealth = 0xfa0a1f01;
   field_35221_cc = 0xfa0a1f01;
   field_35222_cd = true;
   field_35220_ce = 0xfa0a1f01;
   ticksOfInvuln = 60;
   currentWindowId = 0;
   field_41032_j = false;
   iteminworldmanager.thisPlayer = this;
   itemInWorldManager = iteminworldmanager;
   ChunkCoordinates chunkcoordinates = world.getSpawnPoint();
   int i = chunkcoordinates.posX;
   int j = chunkcoordinates.posZ;
   int k = chunkcoordinates.posY;
   if (!world.worldProvider.hasNoSky) {
     i += rand.nextInt(20) - 10;
     k = world.findTopSolidBlock(i, j);
     j += rand.nextInt(20) - 10;
   }
   setLocationAndAngles((double) i + 0.5D, k, (double) j + 0.5D, 0.0F, 0.0F);
   mcServer = minecraftserver;
   stepHeight = 0.0F;
   username = s;
   yOffset = 0.0F;
 }
コード例 #2
0
ファイル: EntityPlayerMP.java プロジェクト: RegexHF/SteamMod
  public EntityPlayerMP(
      MinecraftServer par1MinecraftServer,
      World par2World,
      String par3Str,
      ItemInWorldManager par4ItemInWorldManager) {
    super(par2World, par3Str);
    par4ItemInWorldManager.thisPlayerMP = this;
    this.theItemInWorldManager = par4ItemInWorldManager;
    this.renderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance();
    ChunkCoordinates var5 = par2World.getSpawnPoint();
    int var6 = var5.posX;
    int var7 = var5.posZ;
    int var8 = var5.posY;

    if (!par2World.provider.hasNoSky
        && par2World.getWorldInfo().getGameType() != EnumGameType.ADVENTURE) {
      int var9 = Math.max(5, par1MinecraftServer.getSpawnProtectionSize() - 6);
      var6 += this.rand.nextInt(var9 * 2) - var9;
      var7 += this.rand.nextInt(var9 * 2) - var9;
      var8 = par2World.getTopSolidOrLiquidBlock(var6, var7);
    }

    this.mcServer = par1MinecraftServer;
    this.stepHeight = 0.0F;
    this.yOffset = 0.0F;
    this.setLocationAndAngles(
        (double) var6 + 0.5D, (double) var8, (double) var7 + 0.5D, 0.0F, 0.0F);

    while (!par2World.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) {
      this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
    }
  }
コード例 #3
0
 public void onUpdate() {
   itemInWorldManager.updateBlockRemoving();
   ticksOfInvuln--;
   currentCraftingInventory.updateCraftingResults();
   for (int i = 0; i < 5; i++) {
     ItemStack itemstack = getEquipmentInSlot(i);
     if (itemstack != playerInventory[i]) {
       mcServer
           .getEntityTracker(dimension)
           .sendPacketToTrackedPlayers(this, new Packet5PlayerInventory(entityId, i, itemstack));
       playerInventory[i] = itemstack;
     }
   }
 }
コード例 #4
0
 public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
   super.writeEntityToNBT(nbttagcompound);
   nbttagcompound.setInteger("playerGameType", itemInWorldManager.getGameType());
 }
コード例 #5
0
 public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   if (nbttagcompound.hasKey("playerGameType")) {
     itemInWorldManager.toggleGameType(nbttagcompound.getInteger("playerGameType"));
   }
 }