mirror of
https://gitea.sffnetwork.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-11-24 11:29:44 +00:00
the whole game
This commit is contained in:
parent
816e9060b4
commit
f0617a5d22
2069 changed files with 581500 additions and 0 deletions
67
src/world/level/tile/TreeTile.h
Executable file
67
src/world/level/tile/TreeTile.h
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
#ifndef NET_MINECRAFT_WORLD_LEVEL_TILE__TreeTile_H__
|
||||
#define NET_MINECRAFT_WORLD_LEVEL_TILE__TreeTile_H__
|
||||
|
||||
//package net.minecraft.world.level.tile;
|
||||
|
||||
#include "../../../util/Random.h"
|
||||
#include "../material/Material.h"
|
||||
#include "../Level.h"
|
||||
|
||||
#include "Tile.h"
|
||||
#include "LeafTile.h"
|
||||
|
||||
class TreeTile: public Tile
|
||||
{
|
||||
public:
|
||||
static const int NORMAL_TRUNK = 0;
|
||||
static const int DARK_TRUNK = 1;
|
||||
static const int BIRCH_TRUNK = 2;
|
||||
|
||||
TreeTile(int id)
|
||||
: Tile(id, Material::wood)
|
||||
{
|
||||
tex = 20;
|
||||
}
|
||||
|
||||
int getResourceCount(Random* random) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getResource(int data, Random* random) {
|
||||
return Tile::treeTrunk->id;
|
||||
}
|
||||
|
||||
void onRemove(Level* level, int x, int y, int z) {
|
||||
int r = LeafTile::REQUIRED_WOOD_RANGE;
|
||||
int r2 = r + 1;
|
||||
|
||||
if (level->hasChunksAt(x - r2, y - r2, z - r2, x + r2, y + r2, z + r2)) {
|
||||
for (int xo = -r; xo <= r; xo++)
|
||||
for (int yo = -r; yo <= r; yo++)
|
||||
for (int zo = -r; zo <= r; zo++) {
|
||||
int t = level->getTile(x + xo, y + yo, z + zo);
|
||||
if (t == Tile::leaves->id) {
|
||||
int currentData = level->getData(x + xo, y + yo, z + zo);
|
||||
if ((currentData & LeafTile::UPDATE_LEAF_BIT) == 0) {
|
||||
level->setDataNoUpdate(x + xo, y + yo, z + zo, currentData | LeafTile::UPDATE_LEAF_BIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getTexture(int face, int data) {
|
||||
if (face == 1) return 21;
|
||||
if (face == 0) return 21;
|
||||
if (data == DARK_TRUNK) return 4 + 7 * 16;
|
||||
if (data == BIRCH_TRUNK) return 5 + 7 * 16;
|
||||
return 20;
|
||||
}
|
||||
|
||||
protected:
|
||||
int getSpawnResourcesAuxValue(int data) {
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_WORLD_LEVEL_TILE__TreeTile_H__*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue