implement biome color
This commit is contained in:
@@ -485,8 +485,12 @@ export default class World {
|
||||
return MathHelper.calculateCelestialAngle(this.time, partialTicks);
|
||||
}
|
||||
|
||||
getTemperature(x, z) {
|
||||
return 1.24;
|
||||
getTemperature(x, y, z) {
|
||||
return 0.75; // TODO implement biomes
|
||||
}
|
||||
|
||||
getHumidity(x, y, z) {
|
||||
return 0.85; // TODO implement biomes
|
||||
}
|
||||
|
||||
getSkyColor(x, z, partialTicks) {
|
||||
|
||||
@@ -48,6 +48,10 @@ export default class Block {
|
||||
return typeId === 0 || !Block.getById(typeId).isSolid();
|
||||
}
|
||||
|
||||
getColor(world, x, y, z, face) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
getLightValue() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,22 @@ export default class BlockGrass extends Block {
|
||||
this.sound = Block.sounds.grass;
|
||||
}
|
||||
|
||||
getColor(world, x, y, z, face) {
|
||||
// Only top face has a biome color
|
||||
if (face !== EnumBlockFace.TOP) {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
// Inventory items have a default color
|
||||
if (world === null) {
|
||||
return 0x7cbd6b;
|
||||
}
|
||||
|
||||
let temperature = world.getTemperature(x, y, z);
|
||||
let humidity = world.getHumidity(x, y, z);
|
||||
return world.minecraft.grassColorizer.getColor(temperature, humidity);
|
||||
}
|
||||
|
||||
getTextureForFace(face) {
|
||||
switch (face) {
|
||||
case EnumBlockFace.TOP:
|
||||
|
||||
@@ -9,6 +9,17 @@ export default class BlockLeave extends Block {
|
||||
this.sound = Block.sounds.grass;
|
||||
}
|
||||
|
||||
getColor(world, x, y, z, face) {
|
||||
// Inventory items have a default color
|
||||
if (world === null) {
|
||||
return 0 << 16 | 255 << 8 | 0;
|
||||
}
|
||||
|
||||
let temperature = world.getTemperature(x, y, z);
|
||||
let humidity = world.getHumidity(x, y, z);
|
||||
return world.minecraft.grassColorizer.getColor(temperature, humidity);
|
||||
}
|
||||
|
||||
getOpacity() {
|
||||
return 0.3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user