public ThemeMuddy() { BlockWeightedRandom floor = new BlockWeightedRandom(); floor.addBlock(new MetaBlock(Blocks.flowing_water), 10); floor.addBlock(new MetaBlock(Blocks.clay), 3); floor.addBlock(new MetaBlock(Blocks.dirt), 1); BlockWeightedRandom walls = new BlockWeightedRandom(); walls.addBlock(new MetaBlock(Blocks.cobblestone), 50); walls.addBlock(new MetaBlock(Blocks.mossy_cobblestone), 30); MetaBlock cracked = new MetaBlock(Blocks.stonebrick); cracked.withProperty(BlockStoneBrick.VARIANT_PROP, BlockStoneBrick.EnumType.CRACKED); walls.addBlock(cracked, 10); walls.addBlock(new MetaBlock(Blocks.dirt), 15); walls.addBlock(new MetaBlock(Blocks.clay), 30); walls.addBlock(new MetaBlock(Blocks.gravel), 15); MetaBlock stair = new MetaBlock(Blocks.stone_stairs); MetaBlock mossy = new MetaBlock(Blocks.stonebrick); mossy.withProperty(BlockStoneBrick.VARIANT_PROP, BlockStoneBrick.EnumType.MOSSY); MetaBlock pillar = mossy; this.primary = new BlockSet(floor, walls, stair, pillar); MetaBlock segmentWall = Log.getLog(Log.DARKOAK); MetaBlock segmentStair = new MetaBlock(Blocks.dark_oak_stairs); this.secondary = new BlockSet(floor, segmentWall, segmentStair, segmentWall); }
public boolean generate( WorldEditor editor, Random inRandom, LevelSettings settings, Cardinal[] entrances, Coord origin) { ITheme theme = settings.getTheme(); this.editor = editor; rand = inRandom; originX = origin.getX(); originY = origin.getY(); originZ = origin.getZ(); MetaBlock air = new MetaBlock(Blocks.air); IBlockFactory wall = theme.getPrimaryWall(); IBlockFactory deco = theme.getSecondaryWall(); MetaBlock rug1 = ColorBlock.get(Blocks.carpet, rand); MetaBlock rug2 = ColorBlock.get(Blocks.carpet, rand); MetaBlock rug3 = ColorBlock.get(Blocks.carpet, rand); // fill air editor.fillRectSolid( inRandom, originX - 5, originY, originZ - 5, originX + 5, originY + 3, originZ + 5, air); // shell editor.fillRectHollow( rand, new Coord(originX - 6, originY - 2, originZ - 6), new Coord(originX + 6, originY + 5, originZ + 6), wall, false, true); // floor editor.fillRectSolid( rand, originX - 5, originY - 1, originZ - 5, originX + 5, originY - 1, originZ + 5, deco, true, true); editor.fillRectSolid( rand, originX - 3, originY, originZ - 3, originX + 3, originY, originZ + 3, rug1, true, true); editor.fillRectSolid( rand, originX - 2, originY, originZ - 2, originX + 2, originY, originZ + 2, rug2, true, true); editor.fillRectSolid( rand, originX - 1, originY, originZ - 1, originX + 1, originY, originZ + 1, rug3, true, true); // WALLS MetaBlock log = Log.getLog(Log.OAK); // vertical beams editor.fillRectSolid( inRandom, originX - 2, originY, originZ - 5, originX - 2, originY + 2, originZ - 5, log, true, true); editor.fillRectSolid( inRandom, originX + 2, originY, originZ - 5, originX + 2, originY + 2, originZ - 5, log, true, true); editor.fillRectSolid( inRandom, originX - 2, originY, originZ + 5, originX - 2, originY + 2, originZ + 5, log, true, true); editor.fillRectSolid( inRandom, originX + 2, originY, originZ + 5, originX + 2, originY + 2, originZ + 5, log, true, true); editor.fillRectSolid( rand, originX - 5, originY, originZ - 2, originX - 5, originY + 2, originZ - 2, log, true, true); editor.fillRectSolid( rand, originX - 5, originY, originZ + 2, originX - 5, originY + 2, originZ + 2, log, true, true); editor.fillRectSolid( rand, originX + 5, originY, originZ - 2, originX + 5, originY + 2, originZ - 2, log, true, true); editor.fillRectSolid( rand, originX + 5, originY, originZ + 2, originX + 5, originY + 2, originZ + 2, log, true, true); editor.fillRectSolid( rand, originX - 5, originY, originZ - 5, originX - 5, originY + 2, originZ - 5, log, true, true); editor.fillRectSolid( rand, originX - 5, originY, originZ + 5, originX - 5, originY + 2, originZ + 5, log, true, true); editor.fillRectSolid( rand, originX + 5, originY, originZ - 5, originX + 5, originY + 2, originZ - 5, log, true, true); editor.fillRectSolid( rand, originX + 5, originY, originZ + 5, originX + 5, originY + 2, originZ + 5, log, true, true); // shelves editor.fillRectSolid( rand, originX - 4, originY, originZ - 5, originX - 3, originY, originZ - 5, deco, true, true); editor.fillRectSolid( rand, originX + 3, originY, originZ - 5, originX + 4, originY, originZ - 5, deco, true, true); editor.fillRectSolid( rand, originX - 4, originY, originZ + 5, originX - 3, originY, originZ + 5, deco, true, true); editor.fillRectSolid( rand, originX + 3, originY, originZ + 5, originX + 4, originY, originZ + 5, deco, true, true); editor.fillRectSolid( rand, originX - 5, originY, originZ - 4, originX - 5, originY, originZ - 3, deco, true, true); editor.fillRectSolid( rand, originX - 5, originY, originZ + 3, originX - 5, originY, originZ + 4, deco, true, true); editor.fillRectSolid( rand, originX + 5, originY, originZ - 4, originX + 5, originY, originZ - 3, deco, true, true); editor.fillRectSolid( rand, originX + 5, originY, originZ + 3, originX + 5, originY, originZ + 4, deco, true, true); HashSet<Coord> chestSpace = new HashSet<Coord>(); chestSpace.addAll( WorldEditor.getRectSolid( originX - 4, originY + 1, originZ - 5, originX - 3, originY + 1, originZ - 5)); chestSpace.addAll( WorldEditor.getRectSolid( originX + 3, originY + 1, originZ - 5, originX + 4, originY + 1, originZ - 5)); chestSpace.addAll( WorldEditor.getRectSolid( originX - 4, originY + 1, originZ + 5, originX - 3, originY + 1, originZ + 5)); chestSpace.addAll( WorldEditor.getRectSolid( originX + 3, originY + 1, originZ + 5, originX + 4, originY + 1, originZ + 5)); chestSpace.addAll( WorldEditor.getRectSolid( originX - 5, originY + 1, originZ - 4, originX - 5, originY + 1, originZ - 3)); chestSpace.addAll( WorldEditor.getRectSolid( originX - 5, originY + 1, originZ + 3, originX - 5, originY + 1, originZ + 4)); chestSpace.addAll( WorldEditor.getRectSolid( originX + 5, originY + 1, originZ - 4, originX + 5, originY + 1, originZ - 3)); chestSpace.addAll( WorldEditor.getRectSolid( originX + 5, originY + 1, originZ + 3, originX + 5, originY + 1, originZ + 4)); TreasureChest.generate( editor, rand, settings, new ArrayList<Coord>(chestSpace), TreasureChest.MUSIC); // horizontal beams editor.fillRectSolid( rand, originX - 5, originY + 3, originZ - 5, originX - 5, originY + 3, originZ + 5, log, true, true); editor.fillRectSolid( rand, originX - 5, originY + 3, originZ - 5, originX + 5, originY + 3, originZ - 5, log, true, true); editor.fillRectSolid( rand, originX - 5, originY + 3, originZ + 5, originX + 5, originY + 3, originZ + 5, log, true, true); editor.fillRectSolid( rand, originX + 5, originY + 3, originZ - 5, originX + 5, originY + 3, originZ + 5, log, true, true); // ceiling cross beams editor.fillRectSolid( rand, originX - 2, originY + 4, originZ - 5, originX - 2, originY + 4, originZ + 5, log, true, true); editor.fillRectSolid( rand, originX + 2, originY + 4, originZ - 5, originX + 2, originY + 4, originZ + 5, log, true, true); editor.fillRectSolid( rand, originX - 5, originY + 4, originZ - 2, originX + 5, originY + 4, originZ - 2, log, true, true); editor.fillRectSolid( rand, originX - 5, originY + 4, originZ + 2, originX + 5, originY + 4, originZ + 2, log, true, true); // ceiling lamp editor.setBlock(originX, originY + 4, originZ, Blocks.redstone_block); editor.setBlock(originX - 1, originY + 4, originZ, Blocks.redstone_lamp); editor.setBlock(originX + 1, originY + 4, originZ, Blocks.redstone_lamp); editor.setBlock(originX, originY + 4, originZ - 1, Blocks.redstone_lamp); editor.setBlock(originX, originY + 4, originZ + 1, Blocks.redstone_lamp); // ceiling fill editor.fillRectSolid( rand, originX - 5, originY + 4, originZ - 5, originX + 5, originY + 4, originZ + 5, deco, true, false); // music box editor.setBlock(originX, originY, originZ, Blocks.jukebox); return true; }
@Override public boolean generate( World world, Random rand, LevelSettings settings, Cardinal[] entrances, Coord origin) { int x = origin.getX(); int y = origin.getY(); int z = origin.getZ(); MetaBlock air = new MetaBlock(Blocks.air); MetaBlock oakLog = Log.getLog(Log.OAK); MetaBlock stair = new MetaBlock(Blocks.spruce_stairs); MetaBlock stonebrick = new MetaBlock(Blocks.stonebrick); MetaBlock cyan = new MetaBlock(Blocks.stained_hardened_clay); cyan.withProperty(BlockColored.COLOR, EnumDyeColor.CYAN); MetaBlock doubleSlab = new MetaBlock(Blocks.double_stone_slab); doubleSlab.withProperty(BlockDoubleStoneSlab.VARIANT_PROP, BlockStoneSlab.EnumType.STONE); MetaBlock sprucePlank = new MetaBlock(Blocks.planks); sprucePlank.withProperty(BlockPlanks.VARIANT_PROP, BlockPlanks.EnumType.SPRUCE); WorldGenPrimitive.fillRectSolid(world, rand, x - 4, y, z - 4, x + 4, y + 4, z + 5, air); WorldGenPrimitive.fillRectSolid( world, rand, x - 4, y - 1, z - 4, x + 4, y - 1, z + 5, new MetaBlock(Blocks.cobblestone)); WorldGenPrimitive.fillRectSolid( world, rand, x - 3, y - 1, z - 2, x + 3, y - 1, z + 3, cyan, true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 2, y - 1, z - 1, x + 2, y - 1, z + 2, doubleSlab, true, true); // wood panel walls BlockFactoryCheckers panels = new BlockFactoryCheckers( Log.getLog(Log.SPRUCE, Cardinal.UP), Log.getLog(Log.SPRUCE, Cardinal.EAST)); WorldGenPrimitive.fillRectSolid( world, rand, x - 4, y + 1, z + 6, x + 4, y + 3, z + 6, panels, true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 4, y + 1, z - 5, x + 4, y + 3, z - 5, panels, true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 4, y, z + 6, x + 4, y, z + 6, sprucePlank, true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 4, y, z - 5, x + 4, y, z - 5, sprucePlank, true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 5, y - 1, z - 4, x - 5, y, z + 5, sprucePlank, true, true); WorldGenPrimitive.fillRectSolid( world, rand, x + 5, y - 1, z - 4, x + 5, y, z + 5, sprucePlank, true, true); stair.withProperty(BlockStairs.FACING, EnumFacing.SOUTH); WorldGenPrimitive.fillRectSolid( world, rand, x - 4, y + 4, z - 4, x + 4, y + 4, z - 4, stair, true, true); stair.withProperty(BlockStairs.FACING, EnumFacing.NORTH); WorldGenPrimitive.fillRectSolid( world, rand, x - 4, y + 4, z + 5, x + 4, y + 4, z + 5, stair, true, true); // doors WorldGenPrimitive.fillRectSolid( world, rand, x - 1, y, z - 5, x + 1, y + 2, z - 5, new MetaBlock(Blocks.cobblestone)); WorldGenPrimitive.fillRectSolid(world, rand, x, y, z - 5, x, y + 1, z - 5, air); WorldGenPrimitive.fillRectSolid( world, rand, x - 1, y, z + 6, x + 1, y + 2, z + 6, new MetaBlock(Blocks.cobblestone)); WorldGenPrimitive.fillRectSolid(world, rand, x, y, z + 6, x, y + 1, z + 6, air); // west wall WorldGenPrimitive.fillRectSolid( world, rand, x - 5, y, z - 5, x - 5, y + 4, z + 6, sprucePlank, true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 5, y, z - 1, x - 5, y, z + 2, new MetaBlock(Blocks.noteblock)); WorldGenPrimitive.fillRectSolid( world, rand, x - 5, y + 1, z - 3, x - 5, y + 3, z + 4, new MetaBlock(Blocks.bookshelf)); MetaBlock black = new MetaBlock(Blocks.wool); black.withProperty(BlockColored.COLOR, EnumDyeColor.BLACK); WorldGenPrimitive.fillRectSolid( world, rand, x - 5, y + 1, z - 1, x - 5, y + 3, z + 2, black, true, true); MetaBlock cocao = new MetaBlock(Blocks.cocoa); cocao.withProperty(BlockCocoa.FACING, EnumFacing.EAST); WorldGenPrimitive.setBlock(world, x - 5, y + 2, z - 2, Log.getLog(Log.JUNGLE, Cardinal.EAST)); cocao.setBlock(world, new Coord(x - 4, y + 2, z - 2)); WorldGenPrimitive.setBlock(world, x - 5, y + 2, z + 3, Log.getLog(Log.JUNGLE, Cardinal.EAST)); cocao.setBlock(world, new Coord(x - 4, y + 2, z + 3)); lamp(world, new Coord(x - 2, y, z - 4)); lamp(world, new Coord(x + 2, y, z - 4)); lamp(world, new Coord(x - 2, y, z + 5)); lamp(world, new Coord(x + 2, y, z + 5)); // east wall WorldGenPrimitive.fillRectSolid( world, rand, x + 5, y + 1, z - 4, x + 5, y + 4, z + 5, stonebrick); MetaBlock lime = new MetaBlock(Blocks.wool); lime.withProperty(BlockColored.COLOR, EnumDyeColor.LIME); MetaBlock greenBlock = RogueConfig.getBoolean(RogueConfig.PRECIOUSBLOCKS) ? new MetaBlock(Blocks.emerald_block) : lime; WorldGenPrimitive.fillRectSolid( world, rand, x + 5, y, z - 1, x + 5, y + 4, z - 1, greenBlock, true, true); WorldGenPrimitive.fillRectSolid( world, rand, x + 5, y, z, x + 5, y, z + 1, greenBlock, true, true); WorldGenPrimitive.fillRectSolid(world, rand, x + 5, y + 1, z, x + 5, y + 1, z + 1, air); greenBlock.setBlock(world, new Coord(x + 5, y + 1, z + 2)); WorldGenPrimitive.fillRectSolid( world, rand, x + 5, y + 2, z, x + 5, y + 2, z + 1, greenBlock, true, true); WorldGenPrimitive.fillRectSolid(world, rand, x + 5, y + 3, z, x + 5, y + 3, z + 1, air); greenBlock.setBlock(world, new Coord(x + 5, y + 3, z + 2)); WorldGenPrimitive.fillRectSolid( world, rand, x + 5, y + 4, z, x + 5, y + 4, z + 1, greenBlock, true, true); // roof WorldGenPrimitive.fillRectSolid( world, rand, x - 4, y + 5, z - 5, x + 4, y + 6, z + 6, new MetaBlock(Blocks.stone)); WorldGenPrimitive.fillRectSolid( world, rand, x - 2, y + 5, z - 1, x + 2, y + 5, z - 1, WorldGenPrimitive.blockOrientation(stair, Cardinal.SOUTH, true), true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 2, y + 5, z + 2, x + 2, y + 5, z + 2, WorldGenPrimitive.blockOrientation(stair, Cardinal.NORTH, true), true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 3, y + 5, z, x - 3, y + 5, z + 1, WorldGenPrimitive.blockOrientation(stair, Cardinal.EAST, true), true, true); WorldGenPrimitive.fillRectSolid( world, rand, x + 3, y + 5, z, x + 3, y + 5, z + 1, WorldGenPrimitive.blockOrientation(stair, Cardinal.WEST, true), true, true); WorldGenPrimitive.fillRectSolid( world, rand, x - 2, y + 5, z, x + 2, y + 5, z + 1, new MetaBlock(Blocks.redstone_lamp)); WorldGenPrimitive.setBlock(world, x - 3, y + 5, z - 1, oakLog); WorldGenPrimitive.setBlock(world, x + 3, y + 5, z - 1, oakLog); WorldGenPrimitive.setBlock(world, x - 3, y + 5, z + 2, oakLog); WorldGenPrimitive.setBlock(world, x + 3, y + 5, z + 2, oakLog); // table WorldGenPrimitive.fillRectSolid( world, rand, x - 2, y, z, x - 2, y, z + 1, WorldGenPrimitive.blockOrientation(stair, Cardinal.WEST, true), true, true); WorldGenPrimitive.fillRectSolid( world, rand, x + 2, y, z, x + 2, y, z + 1, WorldGenPrimitive.blockOrientation(stair, Cardinal.EAST, true), true, true); MetaBlock spruceSlabUpsideDown = new MetaBlock(Blocks.wooden_slab); spruceSlabUpsideDown.withProperty(BlockPlanks.VARIANT_PROP, BlockPlanks.EnumType.SPRUCE); spruceSlabUpsideDown.withProperty(BlockSlab.HALF_PROP, BlockSlab.EnumBlockHalf.TOP); WorldGenPrimitive.fillRectSolid( world, rand, x - 1, y, z, x + 1, y, z + 1, spruceSlabUpsideDown, true, true); // chairs MetaBlock chair = new MetaBlock(Blocks.nether_brick_stairs); WorldGenPrimitive.blockOrientation(chair, Cardinal.SOUTH, false); chair.setBlock(world, new Coord(x - 1, y, z - 2)); chair.setBlock(world, new Coord(x + 1, y, z - 2)); WorldGenPrimitive.blockOrientation(chair, Cardinal.NORTH, false); chair.setBlock(world, new Coord(x - 1, y, z + 3)); chair.setBlock(world, new Coord(x + 1, y, z + 3)); // wall entrances WorldGenPrimitive.fillRectSolid( world, rand, x - 7, y - 1, z - 4, x - 6, y + 4, z + 4, stonebrick); WorldGenPrimitive.fillRectSolid( world, rand, x + 6, y - 1, z - 4, x + 7, y + 4, z + 4, stonebrick); ITreasureChest recordChest = new TreasureChestEmpty() .generate(world, rand, settings.getLoot(), new Coord(x - 4, y, z - 4), 0, false); recordChest.setInventorySlot(Record.getRecord(Record.STAL), recordChest.getInventorySize() / 2); WorldGenPrimitive.setBlock(world, x - 3, y, z - 4, Blocks.jukebox); ITreasureChest bdubsChest = new TreasureChestEmpty() .generate(world, rand, settings.getLoot(), new Coord(x - 3, y, z + 5), 0, false); bdubsChest.setInventorySlot( ItemNovelty.getItem(ItemNovelty.BDOUBLEO), (bdubsChest.getInventorySize() / 2) - 2); ItemStack shirt = new ItemStack(Items.leather_chestplate); Loot.setItemName(shirt, "Pink Sweater", null); Loot.setItemLore(shirt, "\"It's chinese red!\""); ItemArmour.dyeArmor(shirt, 250, 96, 128); bdubsChest.setInventorySlot(shirt, (bdubsChest.getInventorySize() / 2) + 2); ITreasureChest gennybChest = new TreasureChestEmpty() .generate(world, rand, settings.getLoot(), new Coord(x + 3, y, z + 5), 0, false); gennybChest.setInventorySlot( ItemNovelty.getItem(ItemNovelty.GENERIKB), gennybChest.getInventorySize() / 2); WorldGenPrimitive.setBlock(world, x + 4, y, z - 4, Blocks.bookshelf); WorldGenPrimitive.setBlock(world, x + 4, y + 1, z - 4, Blocks.brewing_stand); ITreasureChest contraband = new TreasureChestEmpty() .generate(world, rand, settings.getLoot(), new Coord(x + 3, y, z - 4), 0, false); for (int i = 0; i < 8; ++i) { ItemStack booze = PotionMixture.getBooze(rand); contraband.setInventorySlot(booze, rand.nextInt(contraband.getInventorySize())); } return true; }