mirror of
https://github.com/DrPerkyLegit/LCEServerTest.git
synced 2026-05-29 23:14:39 +00:00
removed git history
This commit is contained in:
102
Minecraft.World/MobSpawnerTileEntity.cpp
Normal file
102
Minecraft.World/MobSpawnerTileEntity.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
#include "stdafx.h"
|
||||
#include "net.minecraft.network.packet.h"
|
||||
#include "net.minecraft.world.level.h"
|
||||
#include "net.minecraft.world.level.tile.h"
|
||||
#include "MobSpawnerTileEntity.h"
|
||||
|
||||
MobSpawnerTileEntity::TileEntityMobSpawner::TileEntityMobSpawner(MobSpawnerTileEntity *parent)
|
||||
{
|
||||
m_parent = parent;
|
||||
}
|
||||
|
||||
void MobSpawnerTileEntity::TileEntityMobSpawner::broadcastEvent(int id)
|
||||
{
|
||||
m_parent->level->tileEvent(m_parent->x, m_parent->y, m_parent->z, Tile::mobSpawner_Id, id, 0);
|
||||
}
|
||||
|
||||
Level *MobSpawnerTileEntity::TileEntityMobSpawner::getLevel()
|
||||
{
|
||||
return m_parent->level;
|
||||
}
|
||||
|
||||
int MobSpawnerTileEntity::TileEntityMobSpawner::getX()
|
||||
{
|
||||
return m_parent->x;
|
||||
}
|
||||
|
||||
int MobSpawnerTileEntity::TileEntityMobSpawner::getY()
|
||||
{
|
||||
return m_parent->y;
|
||||
}
|
||||
|
||||
int MobSpawnerTileEntity::TileEntityMobSpawner::getZ()
|
||||
{
|
||||
return m_parent->z;
|
||||
}
|
||||
|
||||
void MobSpawnerTileEntity::TileEntityMobSpawner::setNextSpawnData(BaseMobSpawner::SpawnData *nextSpawnData)
|
||||
{
|
||||
BaseMobSpawner::setNextSpawnData(nextSpawnData);
|
||||
if (getLevel() != nullptr) getLevel()->sendTileUpdated(m_parent->x, m_parent->y, m_parent->z);
|
||||
}
|
||||
|
||||
MobSpawnerTileEntity::MobSpawnerTileEntity()
|
||||
{
|
||||
spawner = new TileEntityMobSpawner(this);
|
||||
}
|
||||
|
||||
MobSpawnerTileEntity::~MobSpawnerTileEntity()
|
||||
{
|
||||
delete spawner;
|
||||
}
|
||||
|
||||
void MobSpawnerTileEntity::load(CompoundTag *tag)
|
||||
{
|
||||
TileEntity::load(tag);
|
||||
spawner->load(tag);
|
||||
}
|
||||
|
||||
void MobSpawnerTileEntity::save(CompoundTag *tag)
|
||||
{
|
||||
TileEntity::save(tag);
|
||||
spawner->save(tag);
|
||||
}
|
||||
|
||||
void MobSpawnerTileEntity::tick()
|
||||
{
|
||||
spawner->tick();
|
||||
TileEntity::tick();
|
||||
}
|
||||
|
||||
shared_ptr<Packet> MobSpawnerTileEntity::getUpdatePacket()
|
||||
{
|
||||
CompoundTag *tag = new CompoundTag();
|
||||
save(tag);
|
||||
tag->remove(L"SpawnPotentials");
|
||||
return std::make_shared<TileEntityDataPacket>(x, y, z, TileEntityDataPacket::TYPE_MOB_SPAWNER, tag);
|
||||
}
|
||||
|
||||
bool MobSpawnerTileEntity::triggerEvent(int b0, int b1)
|
||||
{
|
||||
if (spawner->onEventTriggered(b0)) return true;
|
||||
return TileEntity::triggerEvent(b0, b1);
|
||||
}
|
||||
|
||||
BaseMobSpawner *MobSpawnerTileEntity::getSpawner()
|
||||
{
|
||||
return spawner;
|
||||
}
|
||||
|
||||
// 4J Added
|
||||
shared_ptr<TileEntity> MobSpawnerTileEntity::clone()
|
||||
{
|
||||
shared_ptr<MobSpawnerTileEntity> result = std::make_shared<MobSpawnerTileEntity>();
|
||||
TileEntity::clone(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void MobSpawnerTileEntity::setEntityId(const wstring &id)
|
||||
{
|
||||
spawner->setEntityId(id);
|
||||
}
|
||||
Reference in New Issue
Block a user