示例#1
0
 @Override
 public boolean a(OWorld var1, int var2, int var3, int var4, OEntityPlayer var5) {
   if (var1.F) {
     return true;
   } else {
     var5.b(var2, var3, var4);
     return true;
   }
 }
示例#2
0
 @Override
 public void a(OWorld var1, OEntityPlayer var2, int var3, int var4, int var5, int var6) {
   int var7 = OItem.aC.bP;
   float var8 = 0.7F;
   double var9 = (var1.r.nextFloat() * var8) + (1.0F - var8) * 0.5D;
   double var11 = (var1.r.nextFloat() * var8) + (1.0F - var8) * 0.5D;
   double var13 = (var1.r.nextFloat() * var8) + (1.0F - var8) * 0.5D;
   OEntityItem var15 =
       new OEntityItem(var1, var3 + var9, var4 + var11, var5 + var13, new OItemStack(var7, 1, 0));
   var15.c = 10;
   var1.b(var15);
   var1.e(var3, var4, var5, 0);
   var2.a(OStatList.C[this.bO], 1);
 }
  // Respawn player
  public OEntityPlayerMP a(OEntityPlayerMP var1, int var2, boolean var3, Location spawnLocation) {
    var1.getDimension().getEntityTracker().untrackPlayerSymmetrics(var1.getPlayer());
    var1.getDimension().getEntityTracker().untrackEntity(var1.getCanaryEntity());
    var1.getDimension().getPlayerManager().removePlayer(var1.getPlayer());
    this.b.remove(var1);
    var1.getDimension()
        .removePlayerFromWorld(var1.getPlayer()); // This calls the despawn method in world!

    OChunkCoordinates var4 = var1.ab();
    var1.w = var2; // Set new dimension
    CanaryWorld cworld = (CanaryWorld) var1.getDimension().getWorld();
    CanaryDimension dim = (CanaryDimension) cworld.getDimension(Type.fromId(var2));
    OEntityPlayerMP var5 =
        new OEntityPlayerMP(
            this.c, dim.getHandle(), var1.v, new OItemInWorldManager(dim.getHandle()));
    var5.w = var2;
    if (var3) {
      // copy player
      var5.c((OEntityPlayer) var1);
    }

    var5.bd = var1.bd;
    // Set NetServerHandler
    var5.a = var1.a;
    var5.setServerHandler(var5.a.getCanaryNetServerHandler());
    var5.a.setUser(var5.getPlayer());

    OWorldServer var6 = (OWorldServer) dim.getHandle();
    var5.c.a(var1.c.a());
    var5.c.b(var6.s().getGameMode());
    if (var4 != null) {
      OChunkCoordinates var7 =
          OEntityPlayer.a(((CanaryDimension) var1.getDimension()).getHandle(), var4);
      if (var7 != null) {
        var5.c((var7.a + 0.5F), (var7.b + 0.1F), (var7.c + 0.5F), 0.0F, 0.0F);
        var5.a(var4);
      } else {
        var5.a.b((new OPacket70Bed(0, 0)));
      }
    }

    // CanaryMod set player location and angle if a spawn location is defined
    if (spawnLocation != null) {
      var5.c(
          spawnLocation.getX(),
          spawnLocation.getY(),
          spawnLocation.getZ(),
          spawnLocation.getRotation(),
          spawnLocation.getPitch());
    }

    var6.G.c((int) var5.bm >> 4, (int) var5.bo >> 4);

    while (var6.a(var5, var5.bw).size()
        != 0) { // This is the checks for canSpawnHere  should we do something with this so players
      // don't end up on roofs?
      var5.c(var5.bm, var5.bn + 1.0D, var5.bo);
    }

    // respawn packet
    var5.a.b(
        (new OPacket9Respawn(
            var5.w, (byte) var5.bi.q, var5.bi.s().getWorldType(), var5.bi.y(), var5.c.a())));
    // teleport to spawn location
    var5.a.a(
        var5.bm,
        var5.bn,
        var5.bo,
        var5.bs,
        var5.bt,
        var5.w,
        var5.bi.getCanaryDimension().getName());
    // something
    this.a(var5, var6);
    var5.getDimension().getPlayerManager().addPlayer((Player) var5.getPlayer());
    var5.getDimension()
        .addPlayerToWorld(var5.getPlayer()); // This also calls the spawn method in world!
    this.b.add(var5);
    var5.x();
    var5.E();
    return var5;
  }