summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-10-26 00:40:19 +0200
committerKevin Chabowski <kevin@kch42.de>2013-10-26 00:40:19 +0200
commit36c05c623cfc2d5933f9cf8567f9bf800b635ed0 (patch)
tree3830c185e969829627166e4bd366c0ae269ca09f
parent75ee4c47af30002a5c3513696f2ae1c728f16979 (diff)
parentc8931d629b76d6a379f7e46819fb4616d1bf795c (diff)
downloadbiomed-36c05c623cfc2d5933f9cf8567f9bf800b635ed0.tar.gz
biomed-36c05c623cfc2d5933f9cf8567f9bf800b635ed0.tar.bz2
biomed-36c05c623cfc2d5933f9cf8567f9bf800b635ed0.zip
Merge branch 'minecraft-1.7'
-rw-r--r--biome_infos.go217
-rw-r--r--block_infos.go5
-rw-r--r--region_wrapper.go38
3 files changed, 189 insertions, 71 deletions
diff --git a/biome_infos.go b/biome_infos.go
index e9daabb..c45294c 100644
--- a/biome_infos.go
+++ b/biome_infos.go
@@ -29,59 +29,178 @@ var bioList = []mcmap.Biome{
mcmap.BioExtremeHillsEdge,
mcmap.BioJungle,
mcmap.BioJungleHills,
+ mcmap.BioJungleEdge,
+ mcmap.BioDeepOcean,
+ mcmap.BioStoneBeach,
+ mcmap.BioColdBeach,
+ mcmap.BioBirchForest,
+ mcmap.BioBirchForestHills,
+ mcmap.BioRoofedForest,
+ mcmap.BioColdTaiga,
+ mcmap.BioColdTaigaHills,
+ mcmap.BioMegaTaiga,
+ mcmap.BioMegaTaigaHills,
+ mcmap.BioExtremeHillsPlus,
+ mcmap.BioSavanna,
+ mcmap.BioSavannaPlateau,
+ mcmap.BioMesa,
+ mcmap.BioMesaPlateauF,
+ mcmap.BioMesaPlateau,
+ mcmap.BioSunflowerPlains,
+ mcmap.BioDesertM,
+ mcmap.BioExtremeHillsM,
+ mcmap.BioFlowerForest,
+ mcmap.BioTaigaM,
+ mcmap.BioSwamplandM,
+ mcmap.BioIcePlainsSpikes,
+ mcmap.BioIceMountainsSpikes,
+ mcmap.BioJungleM,
+ mcmap.BioJungleEdgeM,
+ mcmap.BioBirchForestM,
+ mcmap.BioBirchForestHillsM,
+ mcmap.BioRoofedForestM,
+ mcmap.BioColdTaigaM,
+ mcmap.BioMegaSpruceTaiga,
+ mcmap.BioMegaSpruceTaigaHills,
+ mcmap.BioExtremeHillsPlusM,
+ mcmap.BioSavannaM,
+ mcmap.BioSavannaPlateauM,
+ mcmap.BioMesaBryce,
+ mcmap.BioMesaPlateauFM,
+ mcmap.BioMesaPlateauM,
mcmap.BioUncalculated,
}
var bioColors = map[mcmap.Biome]*gdk.Color{
- mcmap.BioOcean: gdk.NewColor("#0000ff"),
- mcmap.BioPlains: gdk.NewColor("#9fe804"),
- mcmap.BioDesert: gdk.NewColor("#f5ff58"),
- mcmap.BioExtremeHills: gdk.NewColor("#a75300"),
- mcmap.BioForest: gdk.NewColor("#006f2a"),
- mcmap.BioTaiga: gdk.NewColor("#05795a"),
- mcmap.BioSwampland: gdk.NewColor("#6a7905"),
- mcmap.BioRiver: gdk.NewColor("#196eff"),
- mcmap.BioHell: gdk.NewColor("#d71900"),
- mcmap.BioSky: gdk.NewColor("#871eb3"),
- mcmap.BioFrozenOcean: gdk.NewColor("#d6f0ff"),
- mcmap.BioFrozenRiver: gdk.NewColor("#8fb6cd"),
- mcmap.BioIcePlains: gdk.NewColor("#fbfbfb"),
- mcmap.BioIceMountains: gdk.NewColor("#c6bfb1"),
- mcmap.BioMushroomIsland: gdk.NewColor("#9776a4"),
- mcmap.BioMushroomIslandShore: gdk.NewColor("#9e8ebc"),
- mcmap.BioBeach: gdk.NewColor("#fffdc9"),
- mcmap.BioDesertHills: gdk.NewColor("#adb354"),
- mcmap.BioForestHills: gdk.NewColor("#40694f"),
- mcmap.BioTaigaHills: gdk.NewColor("#5b8578"),
- mcmap.BioExtremeHillsEdge: gdk.NewColor("#a77748"),
- mcmap.BioJungle: gdk.NewColor("#22db04"),
- mcmap.BioJungleHills: gdk.NewColor("#63bf54"),
- mcmap.BioUncalculated: gdk.NewColor("#333333"),
+ mcmap.BioOcean: gdk.NewColor("#0000ff"),
+ mcmap.BioPlains: gdk.NewColor("#9fe804"),
+ mcmap.BioDesert: gdk.NewColor("#f5ff58"),
+ mcmap.BioExtremeHills: gdk.NewColor("#a75300"),
+ mcmap.BioForest: gdk.NewColor("#006f2a"),
+ mcmap.BioTaiga: gdk.NewColor("#05795a"),
+ mcmap.BioSwampland: gdk.NewColor("#6a7905"),
+ mcmap.BioRiver: gdk.NewColor("#196eff"),
+ mcmap.BioHell: gdk.NewColor("#d71900"),
+ mcmap.BioSky: gdk.NewColor("#871eb3"),
+ mcmap.BioFrozenOcean: gdk.NewColor("#d6f0ff"),
+ mcmap.BioFrozenRiver: gdk.NewColor("#8fb6cd"),
+ mcmap.BioIcePlains: gdk.NewColor("#fbfbfb"),
+ mcmap.BioIceMountains: gdk.NewColor("#c6bfb1"),
+ mcmap.BioMushroomIsland: gdk.NewColor("#9776a4"),
+ mcmap.BioMushroomIslandShore: gdk.NewColor("#9e8ebc"),
+ mcmap.BioBeach: gdk.NewColor("#fffdc9"),
+ mcmap.BioDesertHills: gdk.NewColor("#adb354"),
+ mcmap.BioForestHills: gdk.NewColor("#40694f"),
+ mcmap.BioTaigaHills: gdk.NewColor("#5b8578"),
+ mcmap.BioExtremeHillsEdge: gdk.NewColor("#a77748"),
+ mcmap.BioJungle: gdk.NewColor("#22db04"),
+ mcmap.BioJungleHills: gdk.NewColor("#63bf54"),
+ mcmap.BioJungleEdge: gdk.NewColor("#40ba2c"),
+ mcmap.BioDeepOcean: gdk.NewColor("#0000b3"),
+ mcmap.BioStoneBeach: gdk.NewColor("#9292a6"),
+ mcmap.BioColdBeach: gdk.NewColor("#c7c7e8"),
+ mcmap.BioBirchForest: gdk.NewColor("#1d964b"),
+ mcmap.BioBirchForestHills: gdk.NewColor("#498045"),
+ mcmap.BioRoofedForest: gdk.NewColor("#075a26"),
+ mcmap.BioColdTaiga: gdk.NewColor("#1b948e"),
+ mcmap.BioColdTaigaHills: gdk.NewColor("#1d7a76"),
+ mcmap.BioMegaTaiga: gdk.NewColor("#1f8f68"),
+ mcmap.BioMegaTaigaHills: gdk.NewColor("#217a5c"),
+ mcmap.BioExtremeHillsPlus: gdk.NewColor("#d76a00"),
+ mcmap.BioSavanna: gdk.NewColor("#b2bc0f"),
+ mcmap.BioSavannaPlateau: gdk.NewColor("#aba60e"),
+ mcmap.BioMesa: gdk.NewColor("#ff6c00"),
+ mcmap.BioMesaPlateauF: gdk.NewColor("#d9691e"),
+ mcmap.BioMesaPlateau: gdk.NewColor("#d95b07"),
+ mcmap.BioSunflowerPlains: gdk.NewColor("#ffd504"),
+ mcmap.BioDesertM: gdk.NewColor("#f4ff3f"),
+ mcmap.BioExtremeHillsM: gdk.NewColor("#8c4500"),
+ mcmap.BioFlowerForest: gdk.NewColor("#e02f4a"),
+ mcmap.BioTaigaM: gdk.NewColor("#0a6148"),
+ mcmap.BioSwamplandM: gdk.NewColor("#58630e"),
+ mcmap.BioIcePlainsSpikes: gdk.NewColor("#ace8e8"),
+ mcmap.BioIceMountainsSpikes: gdk.NewColor("#91cccc"),
+ mcmap.BioJungleM: gdk.NewColor("#30ba07"),
+ mcmap.BioJungleEdgeM: gdk.NewColor("#3e9130"),
+ mcmap.BioBirchForestM: gdk.NewColor("#228548"),
+ mcmap.BioBirchForestHillsM: gdk.NewColor("#2b7547"),
+ mcmap.BioRoofedForestM: gdk.NewColor("#1a5428"),
+ mcmap.BioColdTaigaM: gdk.NewColor("#0f706b"),
+ mcmap.BioMegaSpruceTaiga: gdk.NewColor("#198058"),
+ mcmap.BioMegaSpruceTaigaHills: gdk.NewColor("#156e4c"),
+ mcmap.BioExtremeHillsPlusM: gdk.NewColor("#ba5c00"),
+ mcmap.BioSavannaM: gdk.NewColor("#858111"),
+ mcmap.BioSavannaPlateauM: gdk.NewColor("#87830b"),
+ mcmap.BioMesaBryce: gdk.NewColor("#ff5100"),
+ mcmap.BioMesaPlateauFM: gdk.NewColor("#ba5a1a"),
+ mcmap.BioMesaPlateauM: gdk.NewColor("#ba4e06"),
+ 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,
+// snowLines maps a biome to the lowest y coordinate that can have snow naturally.
+// TODO: Get the actual values that Minecraft uses (could not find them).
+var snowLines = map[mcmap.Biome]int{
+ mcmap.BioOcean: mcmap.ChunkSizeY,
+ mcmap.BioPlains: mcmap.ChunkSizeY,
+ mcmap.BioDesert: mcmap.ChunkSizeY,
+ mcmap.BioExtremeHills: 95,
+ mcmap.BioForest: mcmap.ChunkSizeY,
+ mcmap.BioTaiga: mcmap.ChunkSizeY,
+ mcmap.BioSwampland: mcmap.ChunkSizeY,
+ mcmap.BioRiver: mcmap.ChunkSizeY,
+ mcmap.BioHell: mcmap.ChunkSizeY,
+ mcmap.BioSky: mcmap.ChunkSizeY,
+ mcmap.BioFrozenOcean: 0,
+ mcmap.BioFrozenRiver: 0,
+ mcmap.BioIcePlains: 0,
+ mcmap.BioIceMountains: 0,
+ mcmap.BioMushroomIsland: mcmap.ChunkSizeY,
+ mcmap.BioMushroomIslandShore: mcmap.ChunkSizeY,
+ mcmap.BioBeach: mcmap.ChunkSizeY,
+ mcmap.BioDesertHills: mcmap.ChunkSizeY,
+ mcmap.BioForestHills: mcmap.ChunkSizeY,
+ mcmap.BioTaigaHills: 0,
+ mcmap.BioExtremeHillsEdge: 95,
+ mcmap.BioJungle: mcmap.ChunkSizeY,
+ mcmap.BioJungleHills: mcmap.ChunkSizeY,
+ mcmap.BioJungleEdge: mcmap.ChunkSizeY,
+ mcmap.BioDeepOcean: mcmap.ChunkSizeY,
+ mcmap.BioStoneBeach: mcmap.ChunkSizeY,
+ mcmap.BioColdBeach: 0,
+ mcmap.BioBirchForest: mcmap.ChunkSizeY,
+ mcmap.BioBirchForestHills: mcmap.ChunkSizeY,
+ mcmap.BioRoofedForest: mcmap.ChunkSizeY,
+ mcmap.BioColdTaiga: 0,
+ mcmap.BioColdTaigaHills: 0,
+ mcmap.BioMegaTaiga: mcmap.ChunkSizeY,
+ mcmap.BioMegaTaigaHills: mcmap.ChunkSizeY,
+ mcmap.BioExtremeHillsPlus: 95,
+ mcmap.BioSavanna: mcmap.ChunkSizeY,
+ mcmap.BioSavannaPlateau: mcmap.ChunkSizeY,
+ mcmap.BioMesa: mcmap.ChunkSizeY,
+ mcmap.BioMesaPlateauF: mcmap.ChunkSizeY,
+ mcmap.BioMesaPlateau: mcmap.ChunkSizeY,
+ mcmap.BioSunflowerPlains: mcmap.ChunkSizeY,
+ mcmap.BioDesertM: mcmap.ChunkSizeY,
+ mcmap.BioExtremeHillsM: 95,
+ mcmap.BioFlowerForest: mcmap.ChunkSizeY,
+ mcmap.BioTaigaM: mcmap.ChunkSizeY,
+ mcmap.BioSwamplandM: mcmap.ChunkSizeY,
+ mcmap.BioIcePlainsSpikes: 0,
+ mcmap.BioIceMountainsSpikes: 0,
+ mcmap.BioJungleM: mcmap.ChunkSizeY,
+ mcmap.BioJungleEdgeM: mcmap.ChunkSizeY,
+ mcmap.BioBirchForestM: mcmap.ChunkSizeY,
+ mcmap.BioBirchForestHillsM: mcmap.ChunkSizeY,
+ mcmap.BioRoofedForestM: mcmap.ChunkSizeY,
+ mcmap.BioColdTaigaM: 0,
+ mcmap.BioMegaSpruceTaiga: mcmap.ChunkSizeY,
+ mcmap.BioMegaSpruceTaigaHills: mcmap.ChunkSizeY,
+ mcmap.BioExtremeHillsPlusM: 95,
+ mcmap.BioSavannaM: mcmap.ChunkSizeY,
+ mcmap.BioSavannaPlateauM: mcmap.ChunkSizeY,
+ mcmap.BioMesaBryce: mcmap.ChunkSizeY,
+ mcmap.BioMesaPlateauFM: mcmap.ChunkSizeY,
+ mcmap.BioMesaPlateauM: mcmap.ChunkSizeY,
+ mcmap.BioUncalculated: mcmap.ChunkSizeY,
}
diff --git a/block_infos.go b/block_infos.go
index f06c308..0c1c34b 100644
--- a/block_infos.go
+++ b/block_infos.go
@@ -141,6 +141,7 @@ var blockColors = map[mcmap.BlockID]*gdk.Color{
mcmap.BlkCarpet: gdk.NewColor("#ffffff"),
mcmap.BlkHardenedClay: gdk.NewColor("#767a82"),
mcmap.BlkBlockOfCoal: gdk.NewColor("#333333"),
+ mcmap.BlkPackedIce: gdk.NewColor("#63bff4"),
}
var blockCanSnowIn = map[mcmap.BlockID]bool{
@@ -182,7 +183,7 @@ var blockCanSnowIn = map[mcmap.BlockID]bool{
mcmap.BlkWool: true,
mcmap.BlkBlockMovedByPiston: false,
mcmap.BlkDandelion: false,
- mcmap.BlkRose: false,
+ mcmap.BlkFlower: false,
mcmap.BlkBrownMushroom: false,
mcmap.BlkRedMushroom: false,
mcmap.BlkBlockOfGold: true,
@@ -308,4 +309,6 @@ var blockCanSnowIn = map[mcmap.BlockID]bool{
mcmap.BlkCarpet: false,
mcmap.BlkHardenedClay: true,
mcmap.BlkBlockOfCoal: true,
+ mcmap.BlkPackedIce: false,
+ mcmap.BlkLargeFlower: false,
}
diff --git a/region_wrapper.go b/region_wrapper.go
index 2f8abe4..bf23913 100644
--- a/region_wrapper.go
+++ b/region_wrapper.go
@@ -242,9 +242,18 @@ func (rw *RegionWrapper) GetBiomeAt(x, z int) (mcmap.Biome, bool) {
return chunk.Biome(bx, bz), true
}
-func fixFreeze(bx, bz int, chunk *mcmap.Chunk) (newcol *gdk.Color) {
- for y := mcmap.ChunkSizeY - 1; y >= 0; y-- {
- if blk := chunk.Block(bx, y, bz); blk.ID != mcmap.BlkAir {
+func fixWeather(bio mcmap.Biome, bx, bz int, chunk *mcmap.Chunk) (newcol *gdk.Color) {
+ snowLine := snowLines[bio]
+
+ for y := mcmap.ChunkSizeY; y >= 0; y-- {
+ blk := chunk.Block(bx, y, bz)
+
+ if blk.ID == mcmap.BlkAir {
+ continue
+ }
+
+ if y >= snowLine {
+ // Freeze water and cover blocks with snow
if (blk.ID == mcmap.BlkStationaryWater) || (blk.ID == mcmap.BlkWater) {
blk.ID = mcmap.BlkIce
newcol = blockColors[mcmap.BlkIce]
@@ -256,17 +265,8 @@ func fixFreeze(bx, bz int, chunk *mcmap.Chunk) (newcol *gdk.Color) {
newcol = blockColors[mcmap.BlkSnow]
}
}
-
- break
- }
- }
-
- return
-}
-
-func fixMelt(bx, bz int, chunk *mcmap.Chunk) (newcol *gdk.Color) {
- for y := mcmap.ChunkSizeY - 1; y >= 0; y-- {
- if blk := chunk.Block(bx, y, bz); blk.ID != mcmap.BlkAir {
+ } else {
+ // Melt ice and remove snow cover
if blk.ID == mcmap.BlkIce {
blk.ID = mcmap.BlkStationaryWater
blk.Data = 0x0
@@ -280,9 +280,9 @@ func fixMelt(bx, bz int, chunk *mcmap.Chunk) (newcol *gdk.Color) {
}
}
}
-
- break
}
+
+ break
}
return
@@ -306,11 +306,7 @@ func (rw *RegionWrapper) SetBiomeAt(x, z int, bio mcmap.Biome) {
var newcol *gdk.Color
if rw.fixSnowIce {
- if coldBiome[bio] {
- newcol = fixFreeze(bx, bz, chunk)
- } else {
- newcol = fixMelt(bx, bz, chunk)
- }
+ newcol = fixWeather(bio, bx, bz, chunk)
}
chunk.MarkModified()