use of net.minecraft.world.biome.Biome in project MinecraftForge by MinecraftForge.
the class ForgeHooksClient method getSkyBlendColour.
public static int getSkyBlendColour(World world, BlockPos center) {
if (center.getX() == skyX && center.getZ() == skyZ && skyInit) {
return skyRGBMultiplier;
}
skyInit = true;
GameSettings settings = Minecraft.getMinecraft().gameSettings;
int[] ranges = ForgeModContainer.blendRanges;
int distance = 0;
if (settings.fancyGraphics && ranges.length > 0) {
distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length - 1)];
}
int r = 0;
int g = 0;
int b = 0;
int divider = 0;
for (int x = -distance; x <= distance; ++x) {
for (int z = -distance; z <= distance; ++z) {
BlockPos pos = center.add(x, 0, z);
Biome biome = world.getBiome(pos);
int colour = biome.getSkyColorByTemp(biome.getFloatTemperature(pos));
r += (colour & 0xFF0000) >> 16;
g += (colour & 0x00FF00) >> 8;
b += colour & 0x0000FF;
divider++;
}
}
int multiplier = (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255;
skyX = center.getX();
skyZ = center.getZ();
skyRGBMultiplier = multiplier;
return skyRGBMultiplier;
}
use of net.minecraft.world.biome.Biome in project MinecraftForge by MinecraftForge.
the class ForgeModContainer method registerAllBiomesAndGenerateEvents.
private static void registerAllBiomesAndGenerateEvents() {
for (Biome biome : ForgeRegistries.BIOMES.getValues()) {
if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator) {
DeferredBiomeDecorator decorator = (DeferredBiomeDecorator) biome.theBiomeDecorator;
decorator.fireCreateEventAndReplace(biome);
}
BiomeDictionary.ensureHasTypes(biome);
}
}
use of net.minecraft.world.biome.Biome in project MinecraftForge by MinecraftForge.
the class BiomeSpawnableListTest method testAddAndRemoveSpawn.
@Test
public void testAddAndRemoveSpawn() throws Exception {
final Class<EntityHorse> entityClass = EntityHorse.class;
final int weightedProb = 1;
final int minGroupCount = 1;
final int maxGroupCount = 20;
final Biome biome = Biomes.PLAINS;
// Test 1: We can add a spawn for the non-vanilla EnumCreatureType
EntityRegistry.addSpawn(entityClass, weightedProb, minGroupCount, maxGroupCount, creatureTypeHorse, biome);
final boolean containsEntryAfterAdd = spawnableListContainsEntry(entityClass, weightedProb, minGroupCount, maxGroupCount, creatureTypeHorse, biome);
assertTrue("The SpawnListEntry wasn't added", containsEntryAfterAdd);
// Test 2: We can remove a spawn for the non-vanilla EnumCreatureType
EntityRegistry.removeSpawn(entityClass, creatureTypeHorse, biome);
final boolean containsEntryAfterRemove = spawnableListContainsEntry(entityClass, weightedProb, minGroupCount, maxGroupCount, creatureTypeHorse, biome);
assertFalse("The SpawnListEntry wasn't removed", containsEntryAfterRemove);
}
use of net.minecraft.world.biome.Biome in project RFToolsDimensions by McJty.
the class BiomeAbsorberTileEntity method placeDown.
public void placeDown() {
if (biomeId == null) {
Biome Biome = getWorld().getBiomeForCoordsBody(getPos());
if (Biome == null) {
biomeId = null;
absorbing = 0;
} else if (!Biome.getRegistryName().toString().equals(biomeId)) {
biomeId = Biome.getRegistryName().toString();
absorbing = DimletConstructionConfiguration.maxBiomeAbsorbtion;
}
markDirty();
}
}
use of net.minecraft.world.biome.Biome in project RFToolsDimensions by McJty.
the class BiomeAbsorberTileEntity method checkStateServer.
protected void checkStateServer() {
if (absorbing > 0) {
Biome Biome = getWorld().getBiomeForCoordsBody(getPos());
if (Biome == null || !Biome.getRegistryName().toString().equals(biomeId)) {
return;
}
absorbing--;
markDirtyClient();
}
}
Aggregations