mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-06-09 02:32:56 +00:00
feat: Melon Feature
fix: polished stone variants spawning on top of certain biomes.
This commit is contained in:
parent
38775d0f26
commit
aaae8b01a9
|
|
@ -147,7 +147,9 @@ Biome::Biome(int id) : id(id)
|
|||
{
|
||||
color = 0;
|
||||
topMaterial = static_cast<byte>(Tile::grass_Id);
|
||||
topMaterialData = 0;
|
||||
material = static_cast<byte>(Tile::dirt_Id);
|
||||
materialData = 0;
|
||||
leafColor = 0x4EE031;
|
||||
_hasRain = true;
|
||||
depth = 0.1f;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,9 @@ void ExtremeHillsBiome::buildSurfaceAtDefault(Level *level, Random *random, byte
|
|||
else if (noiseVal > 1.0 && type != 1)
|
||||
{
|
||||
topMaterial = static_cast<byte>(Tile::stone_Id);
|
||||
topMaterialData = 0;
|
||||
material = static_cast<byte>(Tile::stone_Id);
|
||||
materialData = 0;
|
||||
}
|
||||
|
||||
Biome::buildSurfaceAtDefault(level, random, chunkBlocks, x, z, noiseVal);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "net.minecraft.world.level.h"
|
||||
#include "net.minecraft.world.entity.animal.h"
|
||||
#include "JungleBiome.h"
|
||||
#include "MelonFeature.h"
|
||||
|
||||
JungleBiome::JungleBiome(int id, bool isEdge) : Biome(id)
|
||||
{
|
||||
|
|
@ -70,4 +71,16 @@
|
|||
}
|
||||
delete vines;
|
||||
PIXEndNamedEvent();
|
||||
|
||||
PIXBeginNamedEvent(0, "Adding melons");
|
||||
if (random->nextInt(4) == 0) // Common: 1 in 4 chunks
|
||||
{
|
||||
int x = xo + random->nextInt(16) + 8;
|
||||
int z = zo + random->nextInt(16) + 8;
|
||||
int y = random->nextInt(Level::genDepth);
|
||||
MelonFeature *melonFeature = new MelonFeature();
|
||||
melonFeature->place(level, random, x, y, z);
|
||||
delete melonFeature;
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
}
|
||||
23
Minecraft.World/MelonFeature.cpp
Normal file
23
Minecraft.World/MelonFeature.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "stdafx.h"
|
||||
#include "net.minecraft.world.level.h"
|
||||
#include "net.minecraft.world.level.tile.h"
|
||||
#include "MelonFeature.h"
|
||||
|
||||
bool MelonFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
int x2 = x + random->nextInt(8) - random->nextInt(8);
|
||||
int y2 = y + random->nextInt(4) - random->nextInt(4);
|
||||
int z2 = z + random->nextInt(8) - random->nextInt(8);
|
||||
if (level->isEmptyTile(x2, y2, z2) && level->getTile(x2, y2 - 1, z2) == Tile::grass_Id)
|
||||
{
|
||||
if (Tile::melon->mayPlace(level, x2, y2, z2))
|
||||
{
|
||||
level->setTileAndData(x2, y2, z2, Tile::melon_Id, 0, Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
9
Minecraft.World/MelonFeature.h
Normal file
9
Minecraft.World/MelonFeature.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
#include "Feature.h"
|
||||
|
||||
|
||||
class MelonFeature : public Feature
|
||||
{
|
||||
public:
|
||||
virtual bool place(Level *level, Random *random, int x, int y, int z);
|
||||
};
|
||||
|
|
@ -12,7 +12,9 @@ MutatedBiome::MutatedBiome(int id, Biome* baseBiome)
|
|||
|
||||
color = baseBiome->color;
|
||||
topMaterial = baseBiome->topMaterial;
|
||||
topMaterialData = baseBiome->topMaterialData;
|
||||
material = baseBiome->material;
|
||||
materialData = baseBiome->materialData;
|
||||
leafColor = baseBiome->leafColor;
|
||||
depth = baseBiome->depth + 0.1f;
|
||||
scale = baseBiome->scale + 0.2f;
|
||||
|
|
|
|||
|
|
@ -85,12 +85,23 @@ void MutatedSavannaBiome::buildSurfaceAtDefault(Level *level, Random *random, by
|
|||
if (noiseVal > 1.75)
|
||||
{
|
||||
topMaterial = static_cast<byte>(Tile::stone_Id);
|
||||
topMaterialData = 0;
|
||||
material = static_cast<byte>(Tile::stone_Id);
|
||||
materialData = 0;
|
||||
}
|
||||
else if (noiseVal > -0.5)
|
||||
{
|
||||
topMaterial = static_cast<byte>(Tile::dirt_Id);
|
||||
topMaterialData = 0;
|
||||
material = static_cast<byte>(Tile::dirt_Id);
|
||||
materialData = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
topMaterial = static_cast<byte>(Tile::grass_Id);
|
||||
topMaterialData = 0;
|
||||
material = static_cast<byte>(Tile::dirt_Id);
|
||||
materialData = 0;
|
||||
}
|
||||
|
||||
Biome::buildSurfaceAtDefault(level, random, chunkBlocks, x, z, noiseVal);
|
||||
|
|
|
|||
|
|
@ -1498,6 +1498,8 @@ set(_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_LEVEL_LEVELGEN_FEATURE
|
|||
"${CMAKE_CURRENT_SOURCE_DIR}/PineFeature.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PumpkinFeature.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PumpkinFeature.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MelonFeature.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MelonFeature.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/ReedsFeature.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/ReedsFeature.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/SandFeature.cpp"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "OreFeature.h"
|
||||
#include "PineFeature.h"
|
||||
#include "PumpkinFeature.h"
|
||||
#include "MelonFeature.h"
|
||||
#include "ReedsFeature.h"
|
||||
#include "SpringFeature.h"
|
||||
#include "SpruceFeature.h"
|
||||
|
|
|
|||
Loading…
Reference in a new issue