001 package net.minecraft.world; 002 003 import cpw.mods.fml.relauncher.Side; 004 import cpw.mods.fml.relauncher.SideOnly; 005 import net.minecraft.world.storage.WorldInfo; 006 007 public final class WorldSettings 008 { 009 /** The seed for the map. */ 010 private final long seed; 011 012 /** The EnumGameType. */ 013 private final EnumGameType theGameType; 014 015 /** 016 * Switch for the map features. 'true' for enabled, 'false' for disabled. 017 */ 018 private final boolean mapFeaturesEnabled; 019 020 /** True if hardcore mode is enabled */ 021 private final boolean hardcoreEnabled; 022 private final WorldType terrainType; 023 024 /** True if Commands (cheats) are allowed. */ 025 private boolean commandsAllowed; 026 027 /** True if the Bonus Chest is enabled. */ 028 private boolean bonusChestEnabled; 029 private String field_82751_h; 030 031 public WorldSettings(long par1, EnumGameType par3EnumGameType, boolean par4, boolean par5, WorldType par6WorldType) 032 { 033 this.field_82751_h = ""; 034 this.seed = par1; 035 this.theGameType = par3EnumGameType; 036 this.mapFeaturesEnabled = par4; 037 this.hardcoreEnabled = par5; 038 this.terrainType = par6WorldType; 039 } 040 041 public WorldSettings(WorldInfo par1WorldInfo) 042 { 043 this(par1WorldInfo.getSeed(), par1WorldInfo.getGameType(), par1WorldInfo.isMapFeaturesEnabled(), par1WorldInfo.isHardcoreModeEnabled(), par1WorldInfo.getTerrainType()); 044 } 045 046 /** 047 * Enables the bonus chest. 048 */ 049 public WorldSettings enableBonusChest() 050 { 051 this.bonusChestEnabled = true; 052 return this; 053 } 054 055 public WorldSettings func_82750_a(String par1Str) 056 { 057 this.field_82751_h = par1Str; 058 return this; 059 } 060 061 @SideOnly(Side.CLIENT) 062 063 /** 064 * Enables Commands (cheats). 065 */ 066 public WorldSettings enableCommands() 067 { 068 this.commandsAllowed = true; 069 return this; 070 } 071 072 /** 073 * Returns true if the Bonus Chest is enabled. 074 */ 075 public boolean isBonusChestEnabled() 076 { 077 return this.bonusChestEnabled; 078 } 079 080 /** 081 * Returns the seed for the world. 082 */ 083 public long getSeed() 084 { 085 return this.seed; 086 } 087 088 /** 089 * Gets the game type. 090 */ 091 public EnumGameType getGameType() 092 { 093 return this.theGameType; 094 } 095 096 /** 097 * Returns true if hardcore mode is enabled, otherwise false 098 */ 099 public boolean getHardcoreEnabled() 100 { 101 return this.hardcoreEnabled; 102 } 103 104 /** 105 * Get whether the map features (e.g. strongholds) generation is enabled or disabled. 106 */ 107 public boolean isMapFeaturesEnabled() 108 { 109 return this.mapFeaturesEnabled; 110 } 111 112 public WorldType getTerrainType() 113 { 114 return this.terrainType; 115 } 116 117 /** 118 * Returns true if Commands (cheats) are allowed. 119 */ 120 public boolean areCommandsAllowed() 121 { 122 return this.commandsAllowed; 123 } 124 125 /** 126 * Gets the GameType by ID 127 */ 128 public static EnumGameType getGameTypeById(int par0) 129 { 130 return EnumGameType.getByID(par0); 131 } 132 133 public String func_82749_j() 134 { 135 return this.field_82751_h; 136 } 137 }