From c15c92e507f37a476b29f391564b760c38f538a9 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 17 Aug 2013 22:29:42 +0200 Subject: Snow/Ice can now optionally be removed/added. --- biome_infos.go | 27 +++++ block_infos.go | 311 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ blockcolors.go | 144 -------------------------- main.go | 15 ++- mapwidget.go | 57 ++++++++++- 5 files changed, 405 insertions(+), 149 deletions(-) create mode 100644 block_infos.go delete mode 100644 blockcolors.go diff --git a/biome_infos.go b/biome_infos.go index 7ee1d3c..e9daabb 100644 --- a/biome_infos.go +++ b/biome_infos.go @@ -58,3 +58,30 @@ var bioColors = map[mcmap.Biome]*gdk.Color{ mcmap.BioJungleHills: gdk.NewColor("#63bf54"), mcmap.BioUncalculated: gdk.NewColor("#333333"), } + +var coldBiome = map[mcmap.Biome]bool{ + mcmap.BioOcean: false, + mcmap.BioPlains: false, + mcmap.BioDesert: false, + mcmap.BioExtremeHills: false, + mcmap.BioForest: false, + mcmap.BioTaiga: true, + mcmap.BioSwampland: false, + mcmap.BioRiver: false, + mcmap.BioHell: false, + mcmap.BioSky: false, + mcmap.BioFrozenOcean: true, + mcmap.BioFrozenRiver: true, + mcmap.BioIcePlains: true, + mcmap.BioIceMountains: true, + mcmap.BioMushroomIsland: false, + mcmap.BioMushroomIslandShore: false, + mcmap.BioBeach: false, + mcmap.BioDesertHills: false, + mcmap.BioForestHills: false, + mcmap.BioTaigaHills: true, + mcmap.BioExtremeHillsEdge: false, + mcmap.BioJungle: false, + mcmap.BioJungleHills: false, + mcmap.BioUncalculated: false, +} diff --git a/block_infos.go b/block_infos.go new file mode 100644 index 0000000..f06c308 --- /dev/null +++ b/block_infos.go @@ -0,0 +1,311 @@ +package main + +import ( + "github.com/kch42/gomcmap/mcmap" + "github.com/mattn/go-gtk/gdk" +) + +var blockColors = map[mcmap.BlockID]*gdk.Color{ + mcmap.BlkStone: gdk.NewColor("#666666"), + mcmap.BlkGrassBlock: gdk.NewColor("#00aa00"), + mcmap.BlkDirt: gdk.NewColor("#644804"), + mcmap.BlkCobblestone: gdk.NewColor("#7a7a7a"), + mcmap.BlkWoodPlanks: gdk.NewColor("#a4721c"), + mcmap.BlkBedrock: gdk.NewColor("#111111"), + mcmap.BlkWater: gdk.NewColor("#0000ff"), + mcmap.BlkStationaryWater: gdk.NewColor("#0000ff"), + mcmap.BlkLava: gdk.NewColor("#ff4400"), + mcmap.BlkStationaryLava: gdk.NewColor("#ff4400"), + mcmap.BlkSand: gdk.NewColor("#f1ee85"), + mcmap.BlkGravel: gdk.NewColor("#9ba3a9"), + mcmap.BlkGoldOre: gdk.NewColor("#ffa200"), + mcmap.BlkIronOre: gdk.NewColor("#e1e1e1"), + mcmap.BlkCoalOre: gdk.NewColor("#333333"), + mcmap.BlkWood: gdk.NewColor("#a4721c"), + mcmap.BlkLeaves: gdk.NewColor("#57a100"), + mcmap.BlkGlass: gdk.NewColor("#eeeeff"), + mcmap.BlkLapisLazuliOre: gdk.NewColor("#3114e3"), + mcmap.BlkLapisLazuliBlock: gdk.NewColor("#3114e3"), + mcmap.BlkDispenser: gdk.NewColor("#7a7a7a"), + mcmap.BlkSandstone: gdk.NewColor("#f1ee85"), + mcmap.BlkNoteBlock: gdk.NewColor("#a4721c"), + mcmap.BlkBed: gdk.NewColor("#a00000"), + mcmap.BlkPoweredRail: gdk.NewColor("#ff0000"), + mcmap.BlkDetectorRail: gdk.NewColor("#ff0000"), + mcmap.BlkStickyPiston: gdk.NewColor("#91ba12"), + mcmap.BlkCobweb: gdk.NewColor("#dddddd"), + mcmap.BlkGrass: gdk.NewColor("#a0f618"), + mcmap.BlkPiston: gdk.NewColor("#a4721c"), + mcmap.BlkPistonExtension: gdk.NewColor("#a4721c"), + mcmap.BlkWool: gdk.NewColor("#ffffff"), + mcmap.BlkBlockOfGold: gdk.NewColor("#ffa200"), + mcmap.BlkBlockOfIron: gdk.NewColor("#e1e1e1"), + mcmap.BlkTNT: gdk.NewColor("#a20022"), + mcmap.BlkBookshelf: gdk.NewColor("#a4721c"), + mcmap.BlkMossStone: gdk.NewColor("#589b71"), + mcmap.BlkObsidian: gdk.NewColor("#111144"), + mcmap.BlkTorch: gdk.NewColor("#ffcc00"), + mcmap.BlkFire: gdk.NewColor("#ffcc00"), + mcmap.BlkMonsterSpawner: gdk.NewColor("#344e6a"), + mcmap.BlkOakWoodStairs: gdk.NewColor("#a4721c"), + mcmap.BlkChest: gdk.NewColor("#a4721c"), + mcmap.BlkRedstoneWire: gdk.NewColor("#ff0000"), + mcmap.BlkDiamondOre: gdk.NewColor("#00fff6"), + mcmap.BlkBlockOfDiamond: gdk.NewColor("#00fff6"), + mcmap.BlkCraftingTable: gdk.NewColor("#a4721c"), + mcmap.BlkWheat: gdk.NewColor("#e7ae00"), + mcmap.BlkFarmland: gdk.NewColor("#644804"), + mcmap.BlkFurnace: gdk.NewColor("#7a7a7a"), + mcmap.BlkBurningFurnace: gdk.NewColor("#7a7a7a"), + mcmap.BlkSignPost: gdk.NewColor("#a4721c"), + mcmap.BlkWoodenDoor: gdk.NewColor("#a4721c"), + mcmap.BlkLadders: gdk.NewColor("#a4721c"), + mcmap.BlkRail: gdk.NewColor("#dbdbdb"), + mcmap.BlkCobblestoneStairs: gdk.NewColor("#7a7a7a"), + mcmap.BlkWallSign: gdk.NewColor("#a4721c"), + mcmap.BlkLever: gdk.NewColor("#a4721c"), + mcmap.BlkStonePressurePlate: gdk.NewColor("#666666"), + mcmap.BlkIronDoor: gdk.NewColor("#e1e1e1"), + mcmap.BlkWoodenPressurePlate: gdk.NewColor("#a4721c"), + mcmap.BlkRedstoneOre: gdk.NewColor("#a00000"), + mcmap.BlkGlowingRedstoneOre: gdk.NewColor("#ff0000"), + mcmap.BlkRedstoneTorchInactive: gdk.NewColor("#ff0000"), + mcmap.BlkRedstoneTorchActive: gdk.NewColor("#ff0000"), + mcmap.BlkStoneButton: gdk.NewColor("#666666"), + mcmap.BlkSnow: gdk.NewColor("#e5fffe"), + mcmap.BlkIce: gdk.NewColor("#9fdcff"), + mcmap.BlkSnowBlock: gdk.NewColor("#e5fffe"), + mcmap.BlkCactus: gdk.NewColor("#01bc3a"), + mcmap.BlkClay: gdk.NewColor("#767a82"), + mcmap.BlkSugarCane: gdk.NewColor("#12db50"), + mcmap.BlkJukebox: gdk.NewColor("#a4721c"), + mcmap.BlkFence: gdk.NewColor("#a4721c"), + mcmap.BlkPumpkin: gdk.NewColor("#ff7000"), + mcmap.BlkNetherrack: gdk.NewColor("#851c2d"), + mcmap.BlkSoulSand: gdk.NewColor("#796a59"), + mcmap.BlkGlowstone: gdk.NewColor("#ffff00"), + mcmap.BlkNetherPortal: gdk.NewColor("#ff00ff"), + mcmap.BlkJackOLantern: gdk.NewColor("#ff7000"), + mcmap.BlkRedstoneRepeaterInactive: gdk.NewColor("#ff0000"), + mcmap.BlkRedstoneRepeaterActive: gdk.NewColor("#ff0000"), + mcmap.BlkTrapdoor: gdk.NewColor("#a4721c"), + mcmap.BlkStoneBricks: gdk.NewColor("#666666"), + mcmap.BlkHugeBrownMushroom: gdk.NewColor("#b07859"), + mcmap.BlkHugeRedMushroom: gdk.NewColor("#dd0000"), + mcmap.BlkIronBars: gdk.NewColor("#e1e1e1"), + mcmap.BlkGlassPane: gdk.NewColor("#eeeeff"), + mcmap.BlkMelon: gdk.NewColor("#9ac615"), + mcmap.BlkVines: gdk.NewColor("#50720d"), + mcmap.BlkFenceGate: gdk.NewColor("#a4721c"), + mcmap.BlkBrickStairs: gdk.NewColor("#c42500"), + mcmap.BlkStoneBrickStairs: gdk.NewColor("#666666"), + mcmap.BlkMycelium: gdk.NewColor("#7c668c"), + mcmap.BlkLilyPad: gdk.NewColor("#50720d"), + mcmap.BlkNetherBrick: gdk.NewColor("#c42500"), + mcmap.BlkNetherBrickFence: gdk.NewColor("#c42500"), + mcmap.BlkNetherBrickStairs: gdk.NewColor("#c42500"), + mcmap.BlkEnchantmentTable: gdk.NewColor("#222244"), + mcmap.BlkBrewingStand: gdk.NewColor("#666666"), + mcmap.BlkCauldron: gdk.NewColor("#666666"), + mcmap.BlkEndPortal: gdk.NewColor("#000000"), + mcmap.BlkEndPortalBlock: gdk.NewColor("#e0dbce"), + mcmap.BlkEndStone: gdk.NewColor("#e0dbce"), + mcmap.BlkRedstoneLampInactive: gdk.NewColor("#ffff00"), + mcmap.BlkRedstoneLampActive: gdk.NewColor("#ffff00"), + mcmap.BlkSandstoneStairs: gdk.NewColor("#f1ee85"), + mcmap.BlkEmeraldOre: gdk.NewColor("#00c140"), + mcmap.BlkEnderChest: gdk.NewColor("#222244"), + mcmap.BlkBlockOfEmerald: gdk.NewColor("#00c140"), + mcmap.BlkSpruceWoodStairs: gdk.NewColor("#a4721c"), + mcmap.BlkBirchWoodStairs: gdk.NewColor("#a4721c"), + mcmap.BlkJungleWoodStairs: gdk.NewColor("#a4721c"), + mcmap.BlkCommandBlock: gdk.NewColor("#e8ec78"), + mcmap.BlkBeacon: gdk.NewColor("#00fff6"), + mcmap.BlkCobblestoneWall: gdk.NewColor("#7a7a7a"), + mcmap.BlkCarrots: gdk.NewColor("#ff6000"), + mcmap.BlkPotatoes: gdk.NewColor("#c6cd0c"), + mcmap.BlkWoodenButton: gdk.NewColor("#a4721c"), + mcmap.BlkAnvil: gdk.NewColor("#444444"), + mcmap.BlkTrappedChest: gdk.NewColor("#a4721c"), + mcmap.BlkRedstoneComparatorInactive: gdk.NewColor("#ff0000"), + mcmap.BlkRedstoneComparatorActive: gdk.NewColor("#ff0000"), + mcmap.BlkBlockOfRedstone: gdk.NewColor("#ff0000"), + mcmap.BlkNetherQuartzOre: gdk.NewColor("#e7e7e7"), + mcmap.BlkHopper: gdk.NewColor("#444444"), + mcmap.BlkBlockOfQuartz: gdk.NewColor("#e7e7e7"), + mcmap.BlkQuartzStairs: gdk.NewColor("#e7e7e7"), + mcmap.BlkActivatorRail: gdk.NewColor("#ff0000"), + mcmap.BlkDropper: gdk.NewColor("#444444"), + mcmap.BlkStainedClay: gdk.NewColor("#767a82"), + mcmap.BlkHayBlock: gdk.NewColor("#e7ae00"), + mcmap.BlkCarpet: gdk.NewColor("#ffffff"), + mcmap.BlkHardenedClay: gdk.NewColor("#767a82"), + mcmap.BlkBlockOfCoal: gdk.NewColor("#333333"), +} + +var blockCanSnowIn = map[mcmap.BlockID]bool{ + mcmap.BlkAir: false, + mcmap.BlkStone: true, + mcmap.BlkGrassBlock: true, + mcmap.BlkDirt: true, + mcmap.BlkCobblestone: true, + mcmap.BlkWoodPlanks: true, + mcmap.BlkSaplings: false, + mcmap.BlkBedrock: true, + mcmap.BlkWater: false, + mcmap.BlkStationaryWater: false, + mcmap.BlkLava: false, + mcmap.BlkStationaryLava: false, + mcmap.BlkSand: true, + mcmap.BlkGravel: true, + mcmap.BlkGoldOre: true, + mcmap.BlkIronOre: true, + mcmap.BlkCoalOre: true, + mcmap.BlkWood: true, + mcmap.BlkLeaves: true, + mcmap.BlkSponge: true, + mcmap.BlkGlass: false, + mcmap.BlkLapisLazuliOre: true, + mcmap.BlkLapisLazuliBlock: true, + mcmap.BlkDispenser: true, + mcmap.BlkSandstone: true, + mcmap.BlkNoteBlock: true, + mcmap.BlkBed: false, + mcmap.BlkPoweredRail: false, + mcmap.BlkDetectorRail: false, + mcmap.BlkStickyPiston: true, + mcmap.BlkCobweb: false, + mcmap.BlkGrass: false, + mcmap.BlkDeadBush: false, + mcmap.BlkPiston: true, + mcmap.BlkPistonExtension: false, + mcmap.BlkWool: true, + mcmap.BlkBlockMovedByPiston: false, + mcmap.BlkDandelion: false, + mcmap.BlkRose: false, + mcmap.BlkBrownMushroom: false, + mcmap.BlkRedMushroom: false, + mcmap.BlkBlockOfGold: true, + mcmap.BlkBlockOfIron: true, + mcmap.BlkDoubleSlabs: true, + mcmap.BlkSlabs: false, + mcmap.BlkBricks: true, + mcmap.BlkTNT: true, + mcmap.BlkBookshelf: true, + mcmap.BlkMossStone: true, + mcmap.BlkObsidian: true, + mcmap.BlkTorch: false, + mcmap.BlkFire: false, + mcmap.BlkMonsterSpawner: true, + mcmap.BlkOakWoodStairs: true, + mcmap.BlkChest: false, + mcmap.BlkRedstoneWire: false, + mcmap.BlkDiamondOre: true, + mcmap.BlkBlockOfDiamond: true, + mcmap.BlkCraftingTable: true, + mcmap.BlkWheat: false, + mcmap.BlkFarmland: false, + mcmap.BlkFurnace: false, + mcmap.BlkBurningFurnace: false, + mcmap.BlkSignPost: false, + mcmap.BlkWoodenDoor: false, + mcmap.BlkLadders: false, + mcmap.BlkRail: false, + mcmap.BlkCobblestoneStairs: false, + mcmap.BlkWallSign: false, + mcmap.BlkLever: false, + mcmap.BlkStonePressurePlate: false, + mcmap.BlkIronDoor: false, + mcmap.BlkWoodenPressurePlate: false, + mcmap.BlkRedstoneOre: true, + mcmap.BlkGlowingRedstoneOre: true, + mcmap.BlkRedstoneTorchInactive: false, + mcmap.BlkRedstoneTorchActive: false, + mcmap.BlkStoneButton: false, + mcmap.BlkSnow: false, + mcmap.BlkIce: false, + mcmap.BlkSnowBlock: true, + mcmap.BlkCactus: false, + mcmap.BlkClay: true, + mcmap.BlkSugarCane: false, + mcmap.BlkJukebox: true, + mcmap.BlkFence: false, + mcmap.BlkPumpkin: true, + mcmap.BlkNetherrack: true, + mcmap.BlkSoulSand: true, + mcmap.BlkGlowstone: true, + mcmap.BlkNetherPortal: false, + mcmap.BlkJackOLantern: true, + mcmap.BlkCakeBlock: false, + mcmap.BlkRedstoneRepeaterInactive: false, + mcmap.BlkRedstoneRepeaterActive: false, + mcmap.BlkLockedChest: false, + mcmap.BlkTrapdoor: false, + mcmap.BlkMonsterEgg: false, + mcmap.BlkStoneBricks: true, + mcmap.BlkHugeBrownMushroom: true, + mcmap.BlkHugeRedMushroom: true, + mcmap.BlkIronBars: false, + mcmap.BlkGlassPane: false, + mcmap.BlkMelon: true, + mcmap.BlkPumpkinStem: false, + mcmap.BlkMelonStem: false, + mcmap.BlkVines: false, + mcmap.BlkFenceGate: false, + mcmap.BlkBrickStairs: false, + mcmap.BlkStoneBrickStairs: false, + mcmap.BlkMycelium: true, + mcmap.BlkLilyPad: false, + mcmap.BlkNetherBrick: true, + mcmap.BlkNetherBrickFence: false, + mcmap.BlkNetherBrickStairs: false, + mcmap.BlkNetherWart: false, + mcmap.BlkEnchantmentTable: false, + mcmap.BlkBrewingStand: false, + mcmap.BlkCauldron: false, + mcmap.BlkEndPortal: false, + mcmap.BlkEndPortalBlock: false, + mcmap.BlkEndStone: true, + mcmap.BlkDragonEgg: false, + mcmap.BlkRedstoneLampInactive: true, + mcmap.BlkRedstoneLampActive: true, + mcmap.BlkWoodenDoubleSlab: true, + mcmap.BlkWoodenSlab: false, + mcmap.BlkCocoa: false, + mcmap.BlkSandstoneStairs: false, + mcmap.BlkEmeraldOre: true, + mcmap.BlkEnderChest: false, + mcmap.BlkTripwireHook: false, + mcmap.BlkTripwire: false, + mcmap.BlkBlockOfEmerald: true, + mcmap.BlkSpruceWoodStairs: false, + mcmap.BlkBirchWoodStairs: false, + mcmap.BlkJungleWoodStairs: false, + mcmap.BlkCommandBlock: true, + mcmap.BlkBeacon: false, + mcmap.BlkCobblestoneWall: false, + mcmap.BlkFlowerPot: false, + mcmap.BlkCarrots: false, + mcmap.BlkPotatoes: false, + mcmap.BlkWoodenButton: false, + mcmap.BlkMobHead: false, + mcmap.BlkAnvil: false, + mcmap.BlkTrappedChest: false, + mcmap.BlkWeightedPressurePlateLight: false, + mcmap.BlkWeightedPressurePlateHeavy: false, + mcmap.BlkRedstoneComparatorInactive: false, + mcmap.BlkRedstoneComparatorActive: false, + mcmap.BlkDaylightSensor: false, + mcmap.BlkBlockOfRedstone: true, + mcmap.BlkNetherQuartzOre: true, + mcmap.BlkHopper: false, + mcmap.BlkBlockOfQuartz: true, + mcmap.BlkQuartzStairs: false, + mcmap.BlkActivatorRail: false, + mcmap.BlkDropper: false, + mcmap.BlkStainedClay: true, + mcmap.BlkHayBlock: true, + mcmap.BlkCarpet: false, + mcmap.BlkHardenedClay: true, + mcmap.BlkBlockOfCoal: true, +} diff --git a/blockcolors.go b/blockcolors.go deleted file mode 100644 index bac126b..0000000 --- a/blockcolors.go +++ /dev/null @@ -1,144 +0,0 @@ -package main - -import ( - "github.com/kch42/gomcmap/mcmap" - "github.com/mattn/go-gtk/gdk" -) - -var blockColors = map[mcmap.BlockID]*gdk.Color{ - mcmap.BlkStone: gdk.NewColor("#666666"), - mcmap.BlkGrassBlock: gdk.NewColor("#00aa00"), - mcmap.BlkDirt: gdk.NewColor("#644804"), - mcmap.BlkCobblestone: gdk.NewColor("#7a7a7a"), - mcmap.BlkWoodPlanks: gdk.NewColor("#a4721c"), - mcmap.BlkBedrock: gdk.NewColor("#111111"), - mcmap.BlkWater: gdk.NewColor("#0000ff"), - mcmap.BlkStationaryWater: gdk.NewColor("#0000ff"), - mcmap.BlkLava: gdk.NewColor("#ff4400"), - mcmap.BlkStationaryLava: gdk.NewColor("#ff4400"), - mcmap.BlkSand: gdk.NewColor("#f1ee85"), - mcmap.BlkGravel: gdk.NewColor("#9ba3a9"), - mcmap.BlkGoldOre: gdk.NewColor("#ffa200"), - mcmap.BlkIronOre: gdk.NewColor("#e1e1e1"), - mcmap.BlkCoalOre: gdk.NewColor("#333333"), - mcmap.BlkWood: gdk.NewColor("#a4721c"), - mcmap.BlkLeaves: gdk.NewColor("#57a100"), - mcmap.BlkGlass: gdk.NewColor("#eeeeff"), - mcmap.BlkLapisLazuliOre: gdk.NewColor("#3114e3"), - mcmap.BlkLapisLazuliBlock: gdk.NewColor("#3114e3"), - mcmap.BlkDispenser: gdk.NewColor("#7a7a7a"), - mcmap.BlkSandstone: gdk.NewColor("#f1ee85"), - mcmap.BlkNoteBlock: gdk.NewColor("#a4721c"), - mcmap.BlkBed: gdk.NewColor("#a00000"), - mcmap.BlkPoweredRail: gdk.NewColor("#ff0000"), - mcmap.BlkDetectorRail: gdk.NewColor("#ff0000"), - mcmap.BlkStickyPiston: gdk.NewColor("#91ba12"), - mcmap.BlkCobweb: gdk.NewColor("#dddddd"), - mcmap.BlkGrass: gdk.NewColor("#a0f618"), - mcmap.BlkPiston: gdk.NewColor("#a4721c"), - mcmap.BlkPistonExtension: gdk.NewColor("#a4721c"), - mcmap.BlkWool: gdk.NewColor("#ffffff"), - mcmap.BlkBlockOfGold: gdk.NewColor("#ffa200"), - mcmap.BlkBlockOfIron: gdk.NewColor("#e1e1e1"), - mcmap.BlkTNT: gdk.NewColor("#a20022"), - mcmap.BlkBookshelf: gdk.NewColor("#a4721c"), - mcmap.BlkMossStone: gdk.NewColor("#589b71"), - mcmap.BlkObsidian: gdk.NewColor("#111144"), - mcmap.BlkTorch: gdk.NewColor("#ffcc00"), - mcmap.BlkFire: gdk.NewColor("#ffcc00"), - mcmap.BlkMonsterSpawner: gdk.NewColor("#344e6a"), - mcmap.BlkOakWoodStairs: gdk.NewColor("#a4721c"), - mcmap.BlkChest: gdk.NewColor("#a4721c"), - mcmap.BlkRedstoneWire: gdk.NewColor("#ff0000"), - mcmap.BlkDiamondOre: gdk.NewColor("#00fff6"), - mcmap.BlkBlockOfDiamond: gdk.NewColor("#00fff6"), - mcmap.BlkCraftingTable: gdk.NewColor("#a4721c"), - mcmap.BlkWheat: gdk.NewColor("#e7ae00"), - mcmap.BlkFarmland: gdk.NewColor("#644804"), - mcmap.BlkFurnace: gdk.NewColor("#7a7a7a"), - mcmap.BlkBurningFurnace: gdk.NewColor("#7a7a7a"), - mcmap.BlkSignPost: gdk.NewColor("#a4721c"), - mcmap.BlkWoodenDoor: gdk.NewColor("#a4721c"), - mcmap.BlkLadders: gdk.NewColor("#a4721c"), - mcmap.BlkRail: gdk.NewColor("#dbdbdb"), - mcmap.BlkCobblestoneStairs: gdk.NewColor("#7a7a7a"), - mcmap.BlkWallSign: gdk.NewColor("#a4721c"), - mcmap.BlkLever: gdk.NewColor("#a4721c"), - mcmap.BlkStonePressurePlate: gdk.NewColor("#666666"), - mcmap.BlkIronDoor: gdk.NewColor("#e1e1e1"), - mcmap.BlkWoodenPressurePlate: gdk.NewColor("#a4721c"), - mcmap.BlkRedstoneOre: gdk.NewColor("#a00000"), - mcmap.BlkGlowingRedstoneOre: gdk.NewColor("#ff0000"), - mcmap.BlkRedstoneTorchInactive: gdk.NewColor("#ff0000"), - mcmap.BlkRedstoneTorchActive: gdk.NewColor("#ff0000"), - mcmap.BlkStoneButton: gdk.NewColor("#666666"), - mcmap.BlkSnow: gdk.NewColor("#e5fffe"), - mcmap.BlkIce: gdk.NewColor("#9fdcff"), - mcmap.BlkSnowBlock: gdk.NewColor("#e5fffe"), - mcmap.BlkCactus: gdk.NewColor("#01bc3a"), - mcmap.BlkClay: gdk.NewColor("#767a82"), - mcmap.BlkSugarCane: gdk.NewColor("#12db50"), - mcmap.BlkJukebox: gdk.NewColor("#a4721c"), - mcmap.BlkFence: gdk.NewColor("#a4721c"), - mcmap.BlkPumpkin: gdk.NewColor("#ff7000"), - mcmap.BlkNetherrack: gdk.NewColor("#851c2d"), - mcmap.BlkSoulSand: gdk.NewColor("#796a59"), - mcmap.BlkGlowstone: gdk.NewColor("#ffff00"), - mcmap.BlkNetherPortal: gdk.NewColor("#ff00ff"), - mcmap.BlkJackOLantern: gdk.NewColor("#ff7000"), - mcmap.BlkRedstoneRepeaterInactive: gdk.NewColor("#ff0000"), - mcmap.BlkRedstoneRepeaterActive: gdk.NewColor("#ff0000"), - mcmap.BlkTrapdoor: gdk.NewColor("#a4721c"), - mcmap.BlkStoneBricks: gdk.NewColor("#666666"), - mcmap.BlkHugeBrownMushroom: gdk.NewColor("#b07859"), - mcmap.BlkHugeRedMushroom: gdk.NewColor("#dd0000"), - mcmap.BlkIronBars: gdk.NewColor("#e1e1e1"), - mcmap.BlkGlassPane: gdk.NewColor("#eeeeff"), - mcmap.BlkMelon: gdk.NewColor("#9ac615"), - mcmap.BlkVines: gdk.NewColor("#50720d"), - mcmap.BlkFenceGate: gdk.NewColor("#a4721c"), - mcmap.BlkBrickStairs: gdk.NewColor("#c42500"), - mcmap.BlkStoneBrickStairs: gdk.NewColor("#666666"), - mcmap.BlkMycelium: gdk.NewColor("#7c668c"), - mcmap.BlkLilyPad: gdk.NewColor("#50720d"), - mcmap.BlkNetherBrick: gdk.NewColor("#c42500"), - mcmap.BlkNetherBrickFence: gdk.NewColor("#c42500"), - mcmap.BlkNetherBrickStairs: gdk.NewColor("#c42500"), - mcmap.BlkEnchantmentTable: gdk.NewColor("#222244"), - mcmap.BlkBrewingStand: gdk.NewColor("#666666"), - mcmap.BlkCauldron: gdk.NewColor("#666666"), - mcmap.BlkEndPortal: gdk.NewColor("#000000"), - mcmap.BlkEndPortalBlock: gdk.NewColor("#e0dbce"), - mcmap.BlkEndStone: gdk.NewColor("#e0dbce"), - mcmap.BlkRedstoneLampInactive: gdk.NewColor("#ffff00"), - mcmap.BlkRedstoneLampActive: gdk.NewColor("#ffff00"), - mcmap.BlkSandstoneStairs: gdk.NewColor("#f1ee85"), - mcmap.BlkEmeraldOre: gdk.NewColor("#00c140"), - mcmap.BlkEnderChest: gdk.NewColor("#222244"), - mcmap.BlkBlockOfEmerald: gdk.NewColor("#00c140"), - mcmap.BlkSpruceWoodStairs: gdk.NewColor("#a4721c"), - mcmap.BlkBirchWoodStairs: gdk.NewColor("#a4721c"), - mcmap.BlkJungleWoodStairs: gdk.NewColor("#a4721c"), - mcmap.BlkCommandBlock: gdk.NewColor("#e8ec78"), - mcmap.BlkBeacon: gdk.NewColor("#00fff6"), - mcmap.BlkCobblestoneWall: gdk.NewColor("#7a7a7a"), - mcmap.BlkCarrots: gdk.NewColor("#ff6000"), - mcmap.BlkPotatoes: gdk.NewColor("#c6cd0c"), - mcmap.BlkWoodenButton: gdk.NewColor("#a4721c"), - mcmap.BlkAnvil: gdk.NewColor("#444444"), - mcmap.BlkTrappedChest: gdk.NewColor("#a4721c"), - mcmap.BlkRedstoneComparatorInactive: gdk.NewColor("#ff0000"), - mcmap.BlkRedstoneComparatorActive: gdk.NewColor("#ff0000"), - mcmap.BlkBlockOfRedstone: gdk.NewColor("#ff0000"), - mcmap.BlkNetherQuartzOre: gdk.NewColor("#e7e7e7"), - mcmap.BlkHopper: gdk.NewColor("#444444"), - mcmap.BlkBlockOfQuartz: gdk.NewColor("#e7e7e7"), - mcmap.BlkQuartzStairs: gdk.NewColor("#e7e7e7"), - mcmap.BlkActivatorRail: gdk.NewColor("#ff0000"), - mcmap.BlkDropper: gdk.NewColor("#444444"), - mcmap.BlkStainedClay: gdk.NewColor("#767a82"), - mcmap.BlkHayBlock: gdk.NewColor("#e7ae00"), - mcmap.BlkCarpet: gdk.NewColor("#ffffff"), - mcmap.BlkHardenedClay: gdk.NewColor("#767a82"), - mcmap.BlkBlockOfCoal: gdk.NewColor("#333333"), -} diff --git a/main.go b/main.go index 3520de5..d6ea47e 100644 --- a/main.go +++ b/main.go @@ -10,9 +10,11 @@ import ( ) type GUI struct { - window *gtk.Window - statusbar *gtk.Statusbar + window *gtk.Window + statusbar *gtk.Statusbar + showbiomes *gtk.CheckButton + fixsnowice *gtk.CheckButton statusContext uint lastStatus string @@ -155,6 +157,11 @@ func (g *GUI) mkSidebar() *gtk.ScrolledWindow { g.showbiomes.Connect("toggled", g.showbiomesToggled) vbox.PackStart(g.showbiomes, false, false, 3) + g.fixsnowice = gtk.NewCheckButtonWithLabel("Fix Snow/Ice") + g.fixsnowice.SetTooltipText("Add Snow/Ice for Taiga/Ice Plains. Remove Snow/Ice for other biomes.") + g.fixsnowice.Connect("toggled", g.fixsnowiceToggled) + vbox.PackStart(g.fixsnowice, false, false, 3) + fill := gtk.NewRadioButtonWithLabel(nil, "Fill") fill.SetActive(true) fill.Connect("toggled", g.mkUpdateToolFx(fill, NewFillTool())) @@ -274,6 +281,10 @@ func (g *GUI) showbiomesToggled() { g.mapw.SetShowBiomes(g.showbiomes.GetActive()) } +func (g *GUI) fixsnowiceToggled() { + g.mapw.SetFixSnowIce(g.fixsnowice.GetActive()) +} + /*func (g *GUI) undo() { fmt.Println("Undo") }*/ diff --git a/mapwidget.go b/mapwidget.go index 37a05d0..3592e42 100644 --- a/mapwidget.go +++ b/mapwidget.go @@ -74,7 +74,7 @@ type MapWidget struct { isInit bool - showBiomes bool + showBiomes, fixSnowIce bool offX, offZ int mx1, mx2, my1, my2 int @@ -113,6 +113,10 @@ func (mw *MapWidget) SetShowBiomes(b bool) { mw.redraw <- true } +func (mw *MapWidget) SetFixSnowIce(b bool) { + mw.fixSnowIce = b +} + func (mw *MapWidget) SetTool(t Tool) { mw.tool = t } @@ -489,6 +493,44 @@ func (mw *MapWidget) SetBiomeAt(x, z int, bio mcmap.Biome) { } chunk.SetBiome(bx, bz, bio) + + var newcol *gdk.Color + if mw.fixSnowIce { + for y := chunk.Height(bx, bz); y >= 0; y-- { + if blk := chunk.Block(bx, y, bz); blk.ID != mcmap.BlkAir { + if coldBiome[bio] { + if (blk.ID == mcmap.BlkStationaryWater) || (blk.ID == mcmap.BlkWater) { + blk.ID = mcmap.BlkIce + newcol = blockColors[mcmap.BlkIce] + } else if blockCanSnowIn[blk.ID] { + if yFix := y + 1; yFix < mcmap.ChunkSizeY { + blkFix := chunk.Block(bx, yFix, bz) + blkFix.ID = mcmap.BlkSnow + blkFix.Data = 0x0 + newcol = blockColors[mcmap.BlkSnow] + } + } + } else { + if blk.ID == mcmap.BlkIce { + blk.ID = mcmap.BlkStationaryWater + blk.Data = 0x0 + newcol = blockColors[mcmap.BlkStationaryWater] + } else if blk.ID == mcmap.BlkSnow { + blk.ID = mcmap.BlkAir + for y2 := y - 1; y2 >= 0; y2-- { + if col, ok := blockColors[chunk.Block(bx, y2, bz).ID]; ok { + newcol = col + break + } + } + } + } + + break + } + } + } + chunk.MarkModified() // Update cache @@ -497,12 +539,21 @@ func (mw *MapWidget) SetBiomeAt(x, z int, bio mcmap.Biome) { } // Update tile - if tile, ok := mw.biotiles[pos]; ok { + if biotile, ok := mw.biotiles[pos]; ok { gdk.ThreadsEnter() - drawable := tile.GetDrawable() + + drawable := biotile.GetDrawable() gc := gdk.NewGC(drawable) gc.SetRgbFgColor(bioColors[bio]) drawable.DrawRectangle(gc, true, bx*zoom, bz*zoom, zoom, zoom) + + if newcol != nil { + drawable = mw.maptiles[pos].GetDrawable() + gc = gdk.NewGC(drawable) + gc.SetRgbFgColor(newcol) + drawable.DrawRectangle(gc, true, bx*zoom, bz*zoom, zoom, zoom) + } + gdk.ThreadsLeave() } } -- cgit v1.2.3-70-g09d2