4jcraft/targets/minecraft/world/level/tile/MobSpawnerTile.cpp
2026-04-01 18:17:44 -05:00

42 lines
1.4 KiB
C++

#include "MobSpawnerTile.h"
#include <memory>
#include "java/Random.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/material/Material.h"
#include "minecraft/world/level/tile/BaseEntityTile.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h"
MobSpawnerTile::MobSpawnerTile(int id)
: BaseEntityTile(id, Material::stone, false) {}
std::shared_ptr<TileEntity> MobSpawnerTile::newTileEntity(Level* level) {
return std::make_shared<MobSpawnerTileEntity>();
}
int MobSpawnerTile::getResource(int data, Random* random,
int playerBonusLevel) {
return 0;
}
int MobSpawnerTile::getResourceCount(Random* random) { return 0; }
bool MobSpawnerTile::isSolidRender(bool isServerLevel) { return false; }
bool MobSpawnerTile::blocksLight() { return false; }
void MobSpawnerTile::spawnResources(Level* level, int x, int y, int z, int data,
float odds, int playerBonusLevel) {
Tile::spawnResources(level, x, y, z, data, odds, playerBonusLevel);
// also spawn experience if the block is broken
{
int magicCount =
15 + level->random->nextInt(15) + level->random->nextInt(15);
popExperience(level, x, y, z, magicCount);
}
}
int MobSpawnerTile::cloneTileId(Level* level, int x, int y, int z) { return 0; }