mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-12 03:48:22 +00:00
TU19: merge Minecraft.World/Blocks
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
const std::wstring CocoaTile::TEXTURE_AGES[] = {L"cocoa_0", L"cocoa_1",
|
||||
L"cocoa_2"};
|
||||
|
||||
CocoaTile::CocoaTile(int id) : DirectionalTile(id, Material::plant, false) {
|
||||
CocoaTile::CocoaTile(int id)
|
||||
: DirectionalTile(id, Material::plant, false) {
|
||||
setTicking(true);
|
||||
}
|
||||
|
||||
@@ -25,13 +26,14 @@ Icon* CocoaTile::getTextureForAge(int age) {
|
||||
void CocoaTile::tick(Level* level, int x, int y, int z, Random* random) {
|
||||
if (!canSurvive(level, x, y, z)) {
|
||||
this->spawnResources(level, x, y, z, level->getData(x, y, z), 0);
|
||||
level->setTile(x, y, z, 0);
|
||||
level->setTileAndData(x, y, z, 0, 0, UPDATE_CLIENTS);
|
||||
} else if (level->random->nextInt(5) == 0) {
|
||||
int data = level->getData(x, y, z);
|
||||
int age = getAge(data);
|
||||
if (age < 2) {
|
||||
age++;
|
||||
level->setData(x, y, z, (age << 2) | (getDirection(data)));
|
||||
level->setData(x, y, z, (age << 2) | (getDirection(data)),
|
||||
Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,10 +103,10 @@ void CocoaTile::updateShape(LevelSource* level, int x, int y, int z,
|
||||
}
|
||||
|
||||
void CocoaTile::setPlacedBy(Level* level, int x, int y, int z,
|
||||
std::shared_ptr<Mob> by,
|
||||
std::shared_ptr<LivingEntity> by,
|
||||
std::shared_ptr<ItemInstance> itemInstance) {
|
||||
int dir = (((Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3) + 0) % 4;
|
||||
level->setData(x, y, z, dir);
|
||||
level->setData(x, y, z, dir, Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
|
||||
int CocoaTile::getPlacedOnFaceDataValue(Level* level, int x, int y, int z,
|
||||
@@ -119,7 +121,7 @@ int CocoaTile::getPlacedOnFaceDataValue(Level* level, int x, int y, int z,
|
||||
void CocoaTile::neighborChanged(Level* level, int x, int y, int z, int type) {
|
||||
if (!canSurvive(level, x, y, z)) {
|
||||
this->spawnResources(level, x, y, z, level->getData(x, y, z), 0);
|
||||
level->setTile(x, y, z, 0);
|
||||
level->setTileAndData(x, y, z, 0, 0, UPDATE_CLIENTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,4 +157,4 @@ void CocoaTile::registerIcons(IconRegister* iconRegister) {
|
||||
for (int i = 0; i < COCOA_TEXTURES_LENGTH; i++) {
|
||||
icons[i] = iconRegister->registerIcon(TEXTURE_AGES[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user