mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-18 05:21:54 +00:00
format .Client/Common/GameRules
This commit is contained in:
@@ -5,65 +5,64 @@
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h"
|
||||
|
||||
XboxStructureActionPlaceSpawner::XboxStructureActionPlaceSpawner()
|
||||
{
|
||||
m_tile = Tile::mobSpawner_Id;
|
||||
m_entityId = L"Pig";
|
||||
XboxStructureActionPlaceSpawner::XboxStructureActionPlaceSpawner() {
|
||||
m_tile = Tile::mobSpawner_Id;
|
||||
m_entityId = L"Pig";
|
||||
}
|
||||
|
||||
XboxStructureActionPlaceSpawner::~XboxStructureActionPlaceSpawner()
|
||||
{
|
||||
XboxStructureActionPlaceSpawner::~XboxStructureActionPlaceSpawner() {}
|
||||
|
||||
void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream* dos,
|
||||
unsigned int numAttrs) {
|
||||
XboxStructureActionPlaceBlock::writeAttributes(dos, numAttrs + 1);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_entity);
|
||||
dos->writeUTF(m_entityId);
|
||||
}
|
||||
|
||||
void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
XboxStructureActionPlaceBlock::writeAttributes(dos, numAttrs + 1);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_entity);
|
||||
dos->writeUTF(m_entityId);
|
||||
}
|
||||
|
||||
void XboxStructureActionPlaceSpawner::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue)
|
||||
{
|
||||
if(attributeName.compare(L"entity") == 0)
|
||||
{
|
||||
m_entityId = attributeValue;
|
||||
void XboxStructureActionPlaceSpawner::addAttribute(
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"entity") == 0) {
|
||||
m_entityId = attributeValue;
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"XboxStructureActionPlaceSpawner: Adding parameter entity=%ls\n",m_entityId.c_str());
|
||||
wprintf(
|
||||
L"XboxStructureActionPlaceSpawner: Adding parameter entity=%ls\n",
|
||||
m_entityId.c_str());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
XboxStructureActionPlaceBlock::addAttribute(attributeName, attributeValue);
|
||||
}
|
||||
} else {
|
||||
XboxStructureActionPlaceBlock::addAttribute(attributeName,
|
||||
attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB)
|
||||
{
|
||||
int worldX = structure->getWorldX( m_x, m_z );
|
||||
int worldY = structure->getWorldY( m_y );
|
||||
int worldZ = structure->getWorldZ( m_x, m_z );
|
||||
bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(
|
||||
StructurePiece* structure, Level* level, BoundingBox* chunkBB) {
|
||||
int worldX = structure->getWorldX(m_x, m_z);
|
||||
int worldY = structure->getWorldY(m_y);
|
||||
int worldZ = structure->getWorldZ(m_x, m_z);
|
||||
|
||||
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
||||
{
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
|
||||
{
|
||||
// Remove the current tile entity
|
||||
level->removeTileEntity( worldX, worldY, worldZ );
|
||||
level->setTile( worldX, worldY, worldZ, 0 );
|
||||
}
|
||||
if (chunkBB->isInside(worldX, worldY, worldZ)) {
|
||||
if (level->getTileEntity(worldX, worldY, worldZ) != NULL) {
|
||||
// Remove the current tile entity
|
||||
level->removeTileEntity(worldX, worldY, worldZ);
|
||||
level->setTile(worldX, worldY, worldZ, 0);
|
||||
}
|
||||
|
||||
level->setTile( worldX, worldY, worldZ, m_tile );
|
||||
std::shared_ptr<MobSpawnerTileEntity> entity = std::dynamic_pointer_cast<MobSpawnerTileEntity>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||
level->setTile(worldX, worldY, worldZ, m_tile);
|
||||
std::shared_ptr<MobSpawnerTileEntity> entity =
|
||||
std::dynamic_pointer_cast<MobSpawnerTileEntity>(
|
||||
level->getTileEntity(worldX, worldY, worldZ));
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);
|
||||
wprintf(
|
||||
L"XboxStructureActionPlaceSpawner - placing a %ls spawner at "
|
||||
L"(%d,%d,%d)\n",
|
||||
m_entityId.c_str(), worldX, worldY, worldZ);
|
||||
#endif
|
||||
if( entity != NULL )
|
||||
{
|
||||
entity->setEntityId(m_entityId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (entity != NULL) {
|
||||
entity->setEntityId(m_entityId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user