protected void actionPerformed(GuiButton p_146284_1_) {
    if (p_146284_1_.id == 102) {
      this.mc.displayGuiScreen(this.field_146598_a);
    } else if (p_146284_1_.id == 104) {
      if (this.field_146599_h.equals("survival")) {
        this.field_146599_h = "creative";
      } else if (this.field_146599_h.equals("creative")) {
        this.field_146599_h = "adventure";
      } else {
        this.field_146599_h = "survival";
      }

      this.func_146595_g();
    } else if (p_146284_1_.id == 103) {
      this.field_146600_i = !this.field_146600_i;
      this.func_146595_g();
    } else if (p_146284_1_.id == 101) {
      this.mc.displayGuiScreen((GuiScreen) null);
      String s =
          this.mc
              .getIntegratedServer()
              .shareToLAN(
                  WorldSettings.GameType.getByName(this.field_146599_h), this.field_146600_i);
      Object object;

      if (s != null) {
        object = new ChatComponentTranslation("commands.publish.started", new Object[] {s});
      } else {
        object = new ChatComponentText("commands.publish.failed");
      }

      this.mc.ingameGUI.getChatGUI().printChatMessage((IChatComponent) object);
    }
  }
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound tagCompund) {
    super.readEntityFromNBT(tagCompund);

    if (tagCompund.hasKey("playerGameType", 99)) {
      if (MinecraftServer.getServer().getForceGamemode()) {
        this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType());
      } else {
        this.theItemInWorldManager.setGameType(
            WorldSettings.GameType.getByID(tagCompund.getInteger("playerGameType")));
      }
    }
  }
Example #3
0
  /** Reads the raw packet data from the data stream. */
  public void readPacketData(PacketBuffer p_148837_1_) throws IOException {
    this.field_149206_a = p_148837_1_.readInt();
    short var2 = p_148837_1_.readUnsignedByte();
    this.field_149204_b = (var2 & 8) == 8;
    int var3 = var2 & -9;
    this.field_149205_c = WorldSettings.GameType.getByID(var3);
    this.field_149202_d = p_148837_1_.readByte();
    this.field_149203_e = EnumDifficulty.getDifficultyEnum(p_148837_1_.readUnsignedByte());
    this.field_149200_f = p_148837_1_.readUnsignedByte();
    this.field_149201_g = WorldType.parseWorldType(p_148837_1_.readStringFromBuffer(16));

    if (this.field_149201_g == null) {
      this.field_149201_g = WorldType.DEFAULT;
    }
  }
Example #4
0
 public static WorldSettings.GameType func_77161_a(int p_77161_0_) {
   return WorldSettings.GameType.func_77146_a(p_77161_0_);
 }
 /** Sets the player's game mode and sends it to them. */
 public void setGameType(WorldSettings.GameType gameType) {
   this.theItemInWorldManager.setGameType(gameType);
   this.playerNetServerHandler.sendPacket(
       new S2BPacketChangeGameState(3, (float) gameType.getID()));
 }