@Override public void execute(GameRules gameRules) { GameState gameState = gameRules.getGameState(); GameEntity card = gameState.getEntity(cardEntityId); logger.info("Discarding " + card); gameRules.discardCard(card, x, y); }
public static void main(String[] args) { do { Deck deck = new Deck(); deck.shuffleDeck(1000); System.out.println("!----------Start of Hand----------!"); System.out.println(); System.out.println("Dealer"); Dealer d = new Dealer(deck.getDeck()); System.out.println(d.showCard()); System.out.println(); System.out.println("Player"); Player p = new Player(deck.getDeck()); System.out.println(p.toString()); System.out.println(); askAction(p, deck); if (!p.isBust()) { d.useDealerAI(deck); } GameRules.checkRules(d, p); System.out.println(); System.out.println("END OF HAND"); } while (askToReplay()); }
public WorldInfo(NBTTagCompound par1NBTTagCompound) { terrainType = WorldType.DEFAULT; generatorOptions = ""; theGameRules = new GameRules(); randomSeed = par1NBTTagCompound.getLong("RandomSeed"); if (par1NBTTagCompound.hasKey("generatorName")) { String s = par1NBTTagCompound.getString("generatorName"); terrainType = WorldType.parseWorldType(s); if (terrainType == null) { terrainType = WorldType.DEFAULT; } else if (terrainType.isVersioned()) { int i = 0; if (par1NBTTagCompound.hasKey("generatorVersion")) { i = par1NBTTagCompound.getInteger("generatorVersion"); } terrainType = terrainType.getWorldTypeForGeneratorVersion(i); } if (par1NBTTagCompound.hasKey("generatorOptions")) { generatorOptions = par1NBTTagCompound.getString("generatorOptions"); } } theGameType = EnumGameType.getByID(par1NBTTagCompound.getInteger("GameType")); if (par1NBTTagCompound.hasKey("MapFeatures")) { mapFeaturesEnabled = par1NBTTagCompound.getBoolean("MapFeatures"); } else { if (useNBXlite) { mapFeaturesEnabled = ODNBXlite.Generator == ODNBXlite.GEN_NEWBIOMES; } else { mapFeaturesEnabled = false; } } spawnX = par1NBTTagCompound.getInteger("SpawnX"); spawnY = par1NBTTagCompound.getInteger("SpawnY"); spawnZ = par1NBTTagCompound.getInteger("SpawnZ"); totalTime = par1NBTTagCompound.getLong("Time"); if (par1NBTTagCompound.hasKey("DayTime")) { worldTime = par1NBTTagCompound.getLong("DayTime"); } else { worldTime = totalTime; } lastTimePlayed = par1NBTTagCompound.getLong("LastPlayed"); sizeOnDisk = par1NBTTagCompound.getLong("SizeOnDisk"); levelName = par1NBTTagCompound.getString("LevelName"); saveVersion = par1NBTTagCompound.getInteger("version"); rainTime = par1NBTTagCompound.getInteger("rainTime"); raining = par1NBTTagCompound.getBoolean("raining"); thunderTime = par1NBTTagCompound.getInteger("thunderTime"); thundering = par1NBTTagCompound.getBoolean("thundering"); hardcore = par1NBTTagCompound.getBoolean("hardcore"); if (par1NBTTagCompound.hasKey("initialized")) { initialized = par1NBTTagCompound.getBoolean("initialized"); } else { initialized = true; } if (par1NBTTagCompound.hasKey("allowCommands")) { allowCommands = par1NBTTagCompound.getBoolean("allowCommands"); } else { allowCommands = theGameType == EnumGameType.CREATIVE; } if (useNBXlite) { nbxlite = par1NBTTagCompound.hasKey("NBXlite"); if (nbxlite) { NBTTagCompound nbxliteTag = par1NBTTagCompound.getCompoundTag("NBXlite"); mapGen = ODNBXlite.getGen(nbxliteTag.getString("Generator"), 0); mapGenExtra = ODNBXlite.getGen(nbxliteTag.getString("Generator"), 1); snowCovered = ODNBXlite.getGen(nbxliteTag.getString("Generator"), 2) > 0; flags = nbxliteTag.getString("Flags"); if (nbxliteTag.getInteger("Version") < 3) { if (nbxliteTag.getString("Generator").endsWith("/jungle")) { flags += (flags.length() <= 0) ? "jungle" : ";jungle"; } if (nbxliteTag.getBoolean("NewOres")) { flags += (flags.length() <= 0) ? "newores" : ";newores"; } } if (nbxliteTag.getInteger("Version") < 4) { if (mapGen == ODNBXlite.GEN_NEWBIOMES || mapGen == ODNBXlite.GEN_OLDBIOMES && (mapGenExtra == ODNBXlite.FEATURES_BETA15 || mapGenExtra == ODNBXlite.FEATURES_BETA173)) { flags += (flags.length() <= 0) ? "weather" : ";weather"; } } if (nbxliteTag.getInteger("Version") < 5) { structures = ODNBXlite.getDefaultStructures(mapFeaturesEnabled, mapGen, mapGenExtra); } else { structures = new boolean[ODNBXlite.STRUCTURES.length]; NBTTagCompound structuresTag = nbxliteTag.getCompoundTag("Structures"); for (int i = 0; i < structures.length; i++) { structures[i] = structuresTag.getBoolean(ODNBXlite.STRUCTURES[i]); } } NBTTagCompound themeTag = nbxliteTag.getCompoundTag("Theme"); if (mapGen == ODNBXlite.GEN_BIOMELESS) { mapTheme = themeTag.getInteger("Generation"); if (nbxliteTag.getInteger("Version") < 2) { if (mapTheme == 2) { mapTheme = 3; } else if (mapTheme == 3) { mapTheme = 2; } } } else { mapTheme = ODNBXlite.THEME_NORMAL; } cloudheight = themeTag.getFloat("CloudHeight"); skybrightness = themeTag.getInteger("SkyBrightness"); skycolor = themeTag.getInteger("SkyColor"); fogcolor = themeTag.getInteger("FogColor"); cloudcolor = themeTag.getInteger("CloudColor"); if (mapGen == ODNBXlite.GEN_BIOMELESS) { if (mapGenExtra == ODNBXlite.FEATURES_INDEV || mapGenExtra == ODNBXlite.FEATURES_CLASSIC) { NBTTagCompound finiteTag = nbxliteTag.getCompoundTag("Indev"); indevX = finiteTag.getInteger("X"); indevY = finiteTag.getInteger("Y"); indevZ = finiteTag.getInteger("Z"); surrgroundtype = finiteTag.getInteger("SurroundingGroundType"); surrwatertype = finiteTag.getInteger("SurroundingWaterType"); surrgroundheight = finiteTag.getInteger("SurroundingGroundHeight"); surrwaterheight = finiteTag.getInteger("SurroundingWaterHeight"); mapType = finiteTag.getInteger("Type"); } } } if (par1NBTTagCompound.hasKey("snowCovered")) { snowCovered = par1NBTTagCompound.getBoolean("snowCovered"); ODNBXlite.SnowCovered = snowCovered; } if (par1NBTTagCompound.hasKey("SnowCovered")) { snowCovered = par1NBTTagCompound.getBoolean("SnowCovered"); ODNBXlite.SnowCovered = snowCovered; } } if (par1NBTTagCompound.hasKey("Player")) { playerTag = par1NBTTagCompound.getCompoundTag("Player"); dimension = playerTag.getInteger("Dimension"); } if (par1NBTTagCompound.hasKey("GameRules")) { theGameRules.readGameRulesFromNBT(par1NBTTagCompound.getCompoundTag("GameRules")); } }
private void updateTagCompound( NBTTagCompound par1NBTTagCompound, NBTTagCompound par2NBTTagCompound) { par1NBTTagCompound.setLong("RandomSeed", randomSeed); par1NBTTagCompound.setString("generatorName", terrainType.getWorldTypeName()); par1NBTTagCompound.setInteger("generatorVersion", terrainType.getGeneratorVersion()); par1NBTTagCompound.setString("generatorOptions", generatorOptions); par1NBTTagCompound.setInteger("GameType", theGameType.getID()); par1NBTTagCompound.setBoolean("MapFeatures", mapFeaturesEnabled); par1NBTTagCompound.setInteger("SpawnX", spawnX); par1NBTTagCompound.setInteger("SpawnY", spawnY); par1NBTTagCompound.setInteger("SpawnZ", spawnZ); par1NBTTagCompound.setLong("Time", totalTime); par1NBTTagCompound.setLong("DayTime", worldTime); par1NBTTagCompound.setLong("SizeOnDisk", sizeOnDisk); par1NBTTagCompound.setLong("LastPlayed", MinecraftServer.func_130071_aq()); par1NBTTagCompound.setString("LevelName", levelName); par1NBTTagCompound.setInteger("version", saveVersion); par1NBTTagCompound.setInteger("rainTime", rainTime); par1NBTTagCompound.setBoolean("raining", raining); par1NBTTagCompound.setInteger("thunderTime", thunderTime); par1NBTTagCompound.setBoolean("thundering", thundering); par1NBTTagCompound.setBoolean("hardcore", hardcore); par1NBTTagCompound.setBoolean("allowCommands", allowCommands); par1NBTTagCompound.setBoolean("initialized", initialized); par1NBTTagCompound.setCompoundTag("GameRules", theGameRules.writeGameRulesToNBT()); if (nbxlite && useNBXlite) { NBTTagCompound nbxliteTag = new NBTTagCompound(); nbxliteTag.setInteger("Version", NBXLITE_INFO_VERSION); nbxliteTag.setString("Generator", ODNBXlite.getGenName(mapGen, mapGenExtra, snowCovered)); nbxliteTag.setString("Flags", flags); NBTTagCompound structuresTag = new NBTTagCompound(); for (int i = 0; i < structures.length; i++) { structuresTag.setBoolean(ODNBXlite.STRUCTURES[i], structures[i]); } nbxliteTag.setCompoundTag("Structures", structuresTag); NBTTagCompound themeTag = new NBTTagCompound(); themeTag.setInteger("Generation", mapTheme); themeTag.setFloat("CloudHeight", cloudheight); themeTag.setInteger("SkyColor", skycolor); themeTag.setInteger("FogColor", fogcolor); themeTag.setInteger("CloudColor", cloudcolor); themeTag.setInteger("SkyBrightness", skybrightness); nbxliteTag.setCompoundTag("Theme", themeTag); if (mapGen == ODNBXlite.GEN_BIOMELESS && (mapGenExtra == ODNBXlite.FEATURES_INDEV || mapGenExtra == ODNBXlite.FEATURES_CLASSIC)) { NBTTagCompound finiteTag = new NBTTagCompound(); finiteTag.setInteger("X", indevX); finiteTag.setInteger("Y", indevY); finiteTag.setInteger("Z", indevZ); finiteTag.setInteger("Type", mapType); finiteTag.setInteger("SurroundingGroundType", ODNBXlite.SurrGroundType); finiteTag.setInteger("SurroundingWaterType", ODNBXlite.SurrWaterType); finiteTag.setInteger("SurroundingGroundHeight", ODNBXlite.SurrGroundHeight); finiteTag.setInteger("SurroundingWaterHeight", ODNBXlite.SurrWaterHeight); nbxliteTag.setCompoundTag("Indev", finiteTag); } par1NBTTagCompound.setCompoundTag("NBXlite", nbxliteTag); } if (par2NBTTagCompound != null) { par1NBTTagCompound.setCompoundTag("Player", par2NBTTagCompound); } }