mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-21 18:12:56 +00:00
Merge pull request #329 from Merc6/refactor/remove-aabb-tls
Refactor/remove aabb tls
This commit is contained in:
commit
8cbdb636aa
|
|
@ -726,7 +726,6 @@ void Minecraft::run()
|
|||
{
|
||||
// try { // 4J - removed try/catch
|
||||
// if (minecraftApplet != null && !minecraftApplet.isActive()) break; // 4J - removed
|
||||
AABB::resetPool();
|
||||
|
||||
// if (parent == NULL && Display.isCloseRequested()) { // 4J - removed
|
||||
// stop();
|
||||
|
|
@ -1282,7 +1281,6 @@ void Minecraft::run_middle() {
|
|||
// try { // 4J - removed try/catch
|
||||
// if (minecraftApplet != null &&
|
||||
// !minecraftApplet.isActive()) break; // 4J - removed
|
||||
AABB::resetPool();
|
||||
|
||||
// if (parent == NULL && Display.isCloseRequested()) {
|
||||
// // 4J - removed
|
||||
|
|
@ -2226,7 +2224,6 @@ void Minecraft::run_end() { destroy(); }
|
|||
void Minecraft::emergencySave() {
|
||||
// 4J - lots of try/catches removed here, and garbage collector things
|
||||
levelRenderer->clear();
|
||||
AABB::clearPool();
|
||||
setLevel(NULL);
|
||||
}
|
||||
|
||||
|
|
@ -2402,7 +2399,6 @@ void Minecraft::levelTickUpdateFunc(void* pParam) {
|
|||
}
|
||||
|
||||
void Minecraft::levelTickThreadInitFunc() {
|
||||
AABB::CreateNewThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,6 @@ int MinecraftServer::runPostUpdate(void* lpParam) {
|
|||
MinecraftServer* server = (MinecraftServer*)lpParam;
|
||||
Entity::useSmallIds(); // This thread can end up spawning entities as
|
||||
// resources
|
||||
AABB::CreateNewThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
Tile::CreateNewThreadStorage();
|
||||
|
|
@ -365,7 +364,6 @@ int MinecraftServer::runPostUpdate(void* lpParam) {
|
|||
LeaveCriticalSection(&server->m_postProcessCS);
|
||||
// #endif //__PS3__
|
||||
Tile::ReleaseThreadStorage();
|
||||
AABB::ReleaseThreadStorage();
|
||||
Level::destroyLightingCache();
|
||||
|
||||
ShutdownManager::HasFinished(ShutdownManager::ePostProcessThread);
|
||||
|
|
@ -1650,8 +1648,6 @@ void MinecraftServer::tick() {
|
|||
ironTimers.erase(toRemove[i]);
|
||||
}
|
||||
|
||||
AABB::resetPool();
|
||||
|
||||
tickCount++;
|
||||
|
||||
// 4J We need to update client difficulty levels based on the servers
|
||||
|
|
|
|||
|
|
@ -1010,7 +1010,7 @@ void ClientConnection::handleMovePlayer(
|
|||
player->xd = player->yd = player->zd = 0;
|
||||
player->absMoveTo(x, y, z, yRot, xRot);
|
||||
packet->x = player->x;
|
||||
packet->y = player->bb->y0;
|
||||
packet->y = player->bb.y0;
|
||||
packet->z = player->z;
|
||||
packet->yView = player->y;
|
||||
connection->send(packet);
|
||||
|
|
|
|||
|
|
@ -272,8 +272,9 @@ void PlayerConnection::handleMovePlayer(
|
|||
*/
|
||||
|
||||
float r = 1 / 16.0f;
|
||||
AABB shrunk = player->bb.shrink(r, r, r);
|
||||
bool oldOk =
|
||||
level->getCubes(player, player->bb->copy()->shrink(r, r, r))
|
||||
level->getCubes(player, &shrunk)
|
||||
->empty();
|
||||
|
||||
if (player->onGround && !packet->onGround && yDist > 0) {
|
||||
|
|
@ -324,17 +325,19 @@ void PlayerConnection::handleMovePlayer(
|
|||
}
|
||||
player->absMoveTo(xt, yt, zt, yRotT, xRotT);
|
||||
|
||||
// TODO: check if this can be elided
|
||||
shrunk = player->bb.shrink(r, r, r);
|
||||
bool newOk =
|
||||
level->getCubes(player, player->bb->copy()->shrink(r, r, r))
|
||||
level->getCubes(player, &shrunk)
|
||||
->empty();
|
||||
if (oldOk && (fail || !newOk) && !player->isSleeping()) {
|
||||
teleport(xLastOk, yLastOk, zLastOk, yRotT, xRotT);
|
||||
return;
|
||||
}
|
||||
AABB* testBox = player->bb->copy()->grow(r, r, r)->expand(0, -0.55, 0);
|
||||
AABB testBox = player->bb.grow(r, r, r).expand(0, -0.55, 0);
|
||||
// && server.level.getCubes(player, testBox).size() == 0
|
||||
if (!server->isFlightAllowed() && !player->gameMode->isCreative() &&
|
||||
!level->containsAnyBlocks(testBox) && !player->isAllowedToFly()) {
|
||||
!level->containsAnyBlocks(&testBox) && !player->isAllowedToFly()) {
|
||||
if (oyDist >= (-0.5f / 16.0f)) {
|
||||
aboveGroundTickCount++;
|
||||
if (aboveGroundTickCount > 80) {
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ void PlayerList::validatePlayerSpawnPosition(
|
|||
player->y, player->z, player->dimension);
|
||||
|
||||
ServerLevel* level = server->getLevel(player->dimension);
|
||||
while (level->getCubes(player, player->bb)->size() != 0) {
|
||||
while (level->getCubes(player, &player->bb)->size() != 0) {
|
||||
player->setPos(player->x, player->y + 1, player->z);
|
||||
}
|
||||
app.DebugPrintf("Final pos is %f, %f, %f in dimension %d\n", player->x,
|
||||
|
|
@ -456,7 +456,7 @@ void PlayerList::validatePlayerSpawnPosition(
|
|||
}
|
||||
delete bedPosition;
|
||||
}
|
||||
while (level->getCubes(player, player->bb)->size() != 0) {
|
||||
while (level->getCubes(player, &player->bb)->size() != 0) {
|
||||
player->setPos(player->x, player->y + 1, player->z);
|
||||
}
|
||||
|
||||
|
|
@ -749,7 +749,7 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
|
|||
// Ensure the area the player is spawning in is loaded!
|
||||
level->cache->create(((int)player->x) >> 4, ((int)player->z) >> 4);
|
||||
|
||||
while (!level->getCubes(player, player->bb)->empty()) {
|
||||
while (!level->getCubes(player, &player->bb)->empty()) {
|
||||
player->setPos(player->x, player->y + 1, player->z);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4707,7 +4707,6 @@ int CMinecraftApp::EthernetDisconnectReturned(
|
|||
int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
// app.SetGameStarted(false);
|
||||
|
|
@ -7698,7 +7697,6 @@ void CMinecraftApp::LeaveSaveNotificationSection() {
|
|||
int CMinecraftApp::RemoteSaveThreadProc(void* lpParameter) {
|
||||
// The game should be stopped while we are doing this, but the connections
|
||||
// ticks may try to create some AABB's or Vec3's
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
// 4J-PB - Xbox 360 - 163153 - [CRASH] TU17: Code: Multiplayer: During the
|
||||
|
|
|
|||
|
|
@ -8,12 +8,13 @@
|
|||
#include "ApplySchematicRuleDefinition.h"
|
||||
#include "LevelGenerationOptions.h"
|
||||
#include "ConsoleSchematicFile.h"
|
||||
#include "../../Minecraft.World/Util/AABB.h"
|
||||
|
||||
ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(
|
||||
LevelGenerationOptions* levelGenOptions) {
|
||||
m_levelGenOptions = levelGenOptions;
|
||||
m_location = Vec3(0, 0, 0);
|
||||
m_locationBox = NULL;
|
||||
m_locationBox = std::nullopt;
|
||||
m_totalBlocksChanged = 0;
|
||||
m_totalBlocksChangedLighting = 0;
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||
|
|
@ -130,7 +131,7 @@ void ApplySchematicRuleDefinition::updateLocationBox() {
|
|||
if (m_schematic == NULL)
|
||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
m_locationBox = AABB::newPermanent(0, 0, 0, 0, 0, 0);
|
||||
m_locationBox = AABB(0, 0, 0, 0, 0, 0);
|
||||
|
||||
m_locationBox->x0 = m_location.x;
|
||||
m_locationBox->y0 = m_location.y;
|
||||
|
|
@ -162,8 +163,8 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
|
|||
if (m_schematic == NULL)
|
||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
if (m_locationBox == NULL) updateLocationBox();
|
||||
if (chunkBox->intersects(m_locationBox)) {
|
||||
if (!m_locationBox.has_value()) updateLocationBox();
|
||||
if (chunkBox->intersects(*m_locationBox)) {
|
||||
m_locationBox->y1 =
|
||||
std::min((double)Level::maxBuildHeight, m_locationBox->y1);
|
||||
|
||||
|
|
@ -173,12 +174,12 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
|
|||
#endif
|
||||
PIXBeginNamedEvent(0, "Applying blocks and data");
|
||||
m_totalBlocksChanged += m_schematic->applyBlocksAndData(
|
||||
chunk, chunkBox, m_locationBox, m_rotation);
|
||||
chunk, chunkBox, &*m_locationBox, m_rotation);
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// Add the tileEntities
|
||||
PIXBeginNamedEvent(0, "Applying tile entities");
|
||||
m_schematic->applyTileEntities(chunk, chunkBox, m_locationBox,
|
||||
m_schematic->applyTileEntities(chunk, chunkBox, &*m_locationBox,
|
||||
m_rotation);
|
||||
PIXEndNamedEvent();
|
||||
|
||||
|
|
@ -206,8 +207,8 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
|||
if (m_schematic == NULL)
|
||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
if (m_locationBox == NULL) updateLocationBox();
|
||||
if (chunkBox->intersects(m_locationBox)) {
|
||||
if (!m_locationBox.has_value()) updateLocationBox();
|
||||
if (chunkBox->intersects(*m_locationBox)) {
|
||||
m_locationBox->y1 =
|
||||
std::min((double)Level::maxBuildHeight, m_locationBox->y1);
|
||||
|
||||
|
|
@ -217,7 +218,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
|||
#endif
|
||||
PIXBeginNamedEvent(0, "Patching lighting");
|
||||
m_totalBlocksChangedLighting += m_schematic->applyLighting(
|
||||
chunk, chunkBox, m_locationBox, m_rotation);
|
||||
chunk, chunkBox, &*m_locationBox, m_rotation);
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// TODO This does not take into account things that go outside the
|
||||
|
|
@ -237,12 +238,12 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
|||
|
||||
bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0,
|
||||
int x1, int y1, int z1) {
|
||||
if (m_locationBox == NULL) updateLocationBox();
|
||||
if (!m_locationBox.has_value()) updateLocationBox();
|
||||
return m_locationBox->intersects(x0, y0, z0, x1, y1, z1);
|
||||
}
|
||||
|
||||
int ApplySchematicRuleDefinition::getMinY() {
|
||||
if (m_locationBox == NULL) updateLocationBox();
|
||||
if (!m_locationBox.has_value()) updateLocationBox();
|
||||
return m_locationBox->y0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
#include <optional>
|
||||
#include "GameRuleDefinition.h"
|
||||
#include "ConsoleSchematicFile.h"
|
||||
#include "../../Minecraft.World/Util/AABB.h"
|
||||
|
||||
class AABB;
|
||||
class Vec3;
|
||||
|
|
@ -14,7 +16,7 @@ private:
|
|||
std::wstring m_schematicName;
|
||||
ConsoleSchematicFile* m_schematic;
|
||||
Vec3 m_location;
|
||||
AABB* m_locationBox;
|
||||
std::optional<AABB> m_locationBox;
|
||||
ConsoleSchematicFile::ESchematicRotation m_rotation;
|
||||
int m_dimension;
|
||||
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox,
|
|||
targetZ);
|
||||
|
||||
Vec3 pos(targetX, targetY, targetZ);
|
||||
if (chunkBox->containsIncludingLowerBound(&pos)) {
|
||||
if (chunkBox->containsIncludingLowerBound(pos)) {
|
||||
std::shared_ptr<TileEntity> teCopy = chunk->getTileEntity(
|
||||
(int)targetX & 15, (int)targetY & 15, (int)targetZ & 15);
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox,
|
|||
// Add 0.01 as the AABB::contains function returns false if a value is
|
||||
// <= the lower bound
|
||||
Vec3 pos(targetX + 0.01, targetY + 0.01, targetZ + 0.01);
|
||||
if (!chunkBox->containsIncludingLowerBound(&pos)) {
|
||||
if (!chunkBox->containsIncludingLowerBound(pos)) {
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -733,9 +733,9 @@ void ConsoleSchematicFile::generateSchematicFile(
|
|||
}
|
||||
tag.put(L"TileEntities", tileEntitiesTag);
|
||||
|
||||
AABB* bb = AABB::newTemp(xStart, yStart, zStart, xEnd, yEnd, zEnd);
|
||||
AABB bb(xStart, yStart, zStart, xEnd, yEnd, zEnd);
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
level->getEntities(nullptr, bb);
|
||||
level->getEntities(nullptr, &bb);
|
||||
ListTag<CompoundTag>* entitiesTag = new ListTag<CompoundTag>(L"entities");
|
||||
|
||||
for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) {
|
||||
|
|
|
|||
|
|
@ -253,13 +253,12 @@ void LevelGenerationOptions::addAttribute(const std::wstring& attributeName,
|
|||
void LevelGenerationOptions::processSchematics(LevelChunk* chunk) {
|
||||
PIXBeginNamedEvent(0, "Processing schematics for chunk (%d,%d)", chunk->x,
|
||||
chunk->z);
|
||||
AABB* chunkBox =
|
||||
AABB::newTemp(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
|
||||
Level::maxBuildHeight, chunk->z * 16 + 16);
|
||||
AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
|
||||
Level::maxBuildHeight, chunk->z * 16 + 16);
|
||||
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
|
||||
++it) {
|
||||
ApplySchematicRuleDefinition* rule = *it;
|
||||
rule->processSchematic(chunkBox, chunk);
|
||||
rule->processSchematic(&chunkBox, chunk);
|
||||
}
|
||||
|
||||
int cx = (chunk->x << 4);
|
||||
|
|
@ -282,13 +281,12 @@ void LevelGenerationOptions::processSchematics(LevelChunk* chunk) {
|
|||
void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) {
|
||||
PIXBeginNamedEvent(0, "Processing schematics (lighting) for chunk (%d,%d)",
|
||||
chunk->x, chunk->z);
|
||||
AABB* chunkBox =
|
||||
AABB::newTemp(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
|
||||
Level::maxBuildHeight, chunk->z * 16 + 16);
|
||||
AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
|
||||
Level::maxBuildHeight, chunk->z * 16 + 16);
|
||||
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
|
||||
++it) {
|
||||
ApplySchematicRuleDefinition* rule = *it;
|
||||
rule->processSchematicLighting(chunkBox, chunk);
|
||||
rule->processSchematicLighting(&chunkBox, chunk);
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,9 @@
|
|||
|
||||
NamedAreaRuleDefinition::NamedAreaRuleDefinition() {
|
||||
m_name = L"";
|
||||
m_area = AABB::newPermanent(0, 0, 0, 0, 0, 0);
|
||||
m_area = AABB(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
NamedAreaRuleDefinition::~NamedAreaRuleDefinition() { delete m_area; }
|
||||
|
||||
void NamedAreaRuleDefinition::writeAttributes(DataOutputStream* dos,
|
||||
unsigned int numAttributes) {
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 7);
|
||||
|
|
@ -18,18 +16,18 @@ void NamedAreaRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
dos->writeUTF(m_name);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
||||
dos->writeUTF(_toString(m_area->x0));
|
||||
dos->writeUTF(_toString(m_area.x0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
||||
dos->writeUTF(_toString(m_area->y0));
|
||||
dos->writeUTF(_toString(m_area.y0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
||||
dos->writeUTF(_toString(m_area->z0));
|
||||
dos->writeUTF(_toString(m_area.z0));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
||||
dos->writeUTF(_toString(m_area->x1));
|
||||
dos->writeUTF(_toString(m_area.x1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
||||
dos->writeUTF(_toString(m_area->y1));
|
||||
dos->writeUTF(_toString(m_area.y1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
||||
dos->writeUTF(_toString(m_area->z1));
|
||||
dos->writeUTF(_toString(m_area.z1));
|
||||
}
|
||||
|
||||
void NamedAreaRuleDefinition::addAttribute(const std::wstring& attributeName,
|
||||
|
|
@ -41,31 +39,31 @@ void NamedAreaRuleDefinition::addAttribute(const std::wstring& attributeName,
|
|||
m_name.c_str());
|
||||
#endif
|
||||
} else if (attributeName.compare(L"x0") == 0) {
|
||||
m_area->x0 = _fromString<int>(attributeValue);
|
||||
m_area.x0 = _fromString<int>(attributeValue);
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x0=%f\n",
|
||||
m_area->x0);
|
||||
m_area.x0);
|
||||
} else if (attributeName.compare(L"y0") == 0) {
|
||||
m_area->y0 = _fromString<int>(attributeValue);
|
||||
if (m_area->y0 < 0) m_area->y0 = 0;
|
||||
m_area.y0 = _fromString<int>(attributeValue);
|
||||
if (m_area.y0 < 0) m_area.y0 = 0;
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter y0=%f\n",
|
||||
m_area->y0);
|
||||
m_area.y0);
|
||||
} else if (attributeName.compare(L"z0") == 0) {
|
||||
m_area->z0 = _fromString<int>(attributeValue);
|
||||
m_area.z0 = _fromString<int>(attributeValue);
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z0=%f\n",
|
||||
m_area->z0);
|
||||
m_area.z0);
|
||||
} else if (attributeName.compare(L"x1") == 0) {
|
||||
m_area->x1 = _fromString<int>(attributeValue);
|
||||
m_area.x1 = _fromString<int>(attributeValue);
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x1=%f\n",
|
||||
m_area->x1);
|
||||
m_area.x1);
|
||||
} else if (attributeName.compare(L"y1") == 0) {
|
||||
m_area->y1 = _fromString<int>(attributeValue);
|
||||
if (m_area->y1 < 0) m_area->y1 = 0;
|
||||
m_area.y1 = _fromString<int>(attributeValue);
|
||||
if (m_area.y1 < 0) m_area.y1 = 0;
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter y1=%f\n",
|
||||
m_area->y1);
|
||||
m_area.y1);
|
||||
} else if (attributeName.compare(L"z1") == 0) {
|
||||
m_area->z1 = _fromString<int>(attributeValue);
|
||||
m_area.z1 = _fromString<int>(attributeValue);
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z1=%f\n",
|
||||
m_area->z1);
|
||||
m_area.z1);
|
||||
} else {
|
||||
GameRuleDefinition::addAttribute(attributeName, attributeValue);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
#include "../../Minecraft.World/Util/AABB.h"
|
||||
|
||||
class NamedAreaRuleDefinition : public GameRuleDefinition {
|
||||
private:
|
||||
std::wstring m_name;
|
||||
AABB* m_area;
|
||||
AABB m_area;
|
||||
|
||||
public:
|
||||
NamedAreaRuleDefinition();
|
||||
~NamedAreaRuleDefinition();
|
||||
|
||||
virtual void writeAttributes(DataOutputStream* dos,
|
||||
unsigned int numAttributes);
|
||||
|
|
@ -21,6 +21,6 @@ public:
|
|||
virtual void addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue);
|
||||
|
||||
AABB* getArea() { return m_area; }
|
||||
AABB* getArea() { return &m_area; }
|
||||
std::wstring getName() { return m_name; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -950,7 +950,6 @@ bool CGameNetworkManager::IsNetworkThreadRunning() {
|
|||
int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
Tile::CreateNewThreadStorage();
|
||||
|
||||
|
|
@ -1009,7 +1008,6 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
|||
}
|
||||
|
||||
SetThreadName(-1, "Minecraft Server thread");
|
||||
AABB::CreateNewThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
OldChunkStorage::UseDefaultThreadStorage();
|
||||
Entity::useSmallIds();
|
||||
|
|
@ -1022,7 +1020,6 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
|||
lpParameter); // saveData, app.GetGameHostOption(eGameHostOption_All));
|
||||
|
||||
Tile::ReleaseThreadStorage();
|
||||
AABB::ReleaseThreadStorage();
|
||||
Level::destroyLightingCache();
|
||||
|
||||
if (lpParameter != NULL) delete (NetworkGameInitData*)lpParameter;
|
||||
|
|
@ -1033,7 +1030,6 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
|||
int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
// app.SetGameStarted(false);
|
||||
|
|
@ -1185,7 +1181,6 @@ void CGameNetworkManager::_LeaveGame() {
|
|||
int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
|
|
|||
|
|
@ -10,23 +10,19 @@ AreaConstraint::AreaConstraint(int descriptionId, double x0, double y0,
|
|||
bool contains /*= true*/,
|
||||
bool restrictsMovement /*=true*/)
|
||||
: TutorialConstraint(descriptionId) {
|
||||
messageArea =
|
||||
AABB::newPermanent(x0 + 2, y0 + 2, z0 + 2, x1 - 2, y1 - 2, z1 - 2);
|
||||
movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1);
|
||||
messageArea = AABB(x0 + 2, y0 + 2, z0 + 2, x1 - 2, y1 - 2, z1 - 2);
|
||||
movementArea = AABB(x0, y0, z0, x1, y1, z1);
|
||||
|
||||
this->contains = contains;
|
||||
m_restrictsMovement = restrictsMovement;
|
||||
}
|
||||
|
||||
AreaConstraint::~AreaConstraint() {
|
||||
delete messageArea;
|
||||
delete movementArea;
|
||||
}
|
||||
|
||||
bool AreaConstraint::isConstraintSatisfied(int iPad) {
|
||||
Minecraft* minecraft = Minecraft::GetInstance();
|
||||
|
||||
// TODO: check if this can be elided
|
||||
Vec3 ipad_player = minecraft->localplayers[iPad]->getPos(1);
|
||||
return messageArea->contains(&ipad_player) == contains;
|
||||
return messageArea.contains(ipad_player) == contains;
|
||||
}
|
||||
|
||||
bool AreaConstraint::isConstraintRestrictive(int iPad) {
|
||||
|
|
@ -40,12 +36,12 @@ bool AreaConstraint::canMoveToPosition(double xo, double yo, double zo,
|
|||
Vec3 targetPos(xt, yt, zt);
|
||||
Minecraft* minecraft = Minecraft::GetInstance();
|
||||
|
||||
if (movementArea->contains(&targetPos) == contains) {
|
||||
if (movementArea.contains(targetPos) == contains) {
|
||||
return true;
|
||||
}
|
||||
Vec3 origPos(xo, yo, zo);
|
||||
|
||||
double currDist = origPos.distanceTo(movementArea);
|
||||
double targetDist = targetPos.distanceTo(movementArea);
|
||||
double currDist = origPos.distanceTo(&movementArea);
|
||||
double targetDist = targetPos.distanceTo(&movementArea);
|
||||
return targetDist < currDist;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ class AABB;
|
|||
|
||||
class AreaConstraint : public TutorialConstraint {
|
||||
private:
|
||||
AABB* movementArea;
|
||||
AABB* messageArea;
|
||||
AABB movementArea;
|
||||
AABB messageArea;
|
||||
bool contains; // If true we must stay in this area, if false must stay out
|
||||
// of this area
|
||||
bool m_restrictsMovement;
|
||||
|
|
@ -18,10 +18,9 @@ public:
|
|||
AreaConstraint(int descriptionId, double x0, double y0, double z0,
|
||||
double x1, double y1, double z1, bool contains = true,
|
||||
bool restrictsMovement = true);
|
||||
~AreaConstraint();
|
||||
|
||||
virtual bool isConstraintSatisfied(int iPad);
|
||||
virtual bool isConstraintRestrictive(int iPad);
|
||||
virtual bool canMoveToPosition(double xo, double yo, double zo, double xt,
|
||||
double yt, double zt);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ AreaHint::AreaHint(eTutorial_Hint id, Tutorial* tutorial,
|
|||
double x1, double y1, double z1, bool allowFade /*= false*/,
|
||||
bool contains /*= true*/)
|
||||
: TutorialHint(id, tutorial, descriptionId, e_Hint_Area, allowFade) {
|
||||
area = AABB::newPermanent(x0, y0, z0, x1, y1, z1);
|
||||
area = AABB(x0, y0, z0, x1, y1, z1);
|
||||
|
||||
this->contains = contains;
|
||||
|
||||
|
|
@ -20,15 +20,13 @@ AreaHint::AreaHint(eTutorial_Hint id, Tutorial* tutorial,
|
|||
m_completeState = completeState;
|
||||
}
|
||||
|
||||
AreaHint::~AreaHint() { delete area; }
|
||||
|
||||
int AreaHint::tick() {
|
||||
Minecraft* minecraft = Minecraft::GetInstance();
|
||||
Vec3 player_pos = minecraft->player->getPos(1);
|
||||
|
||||
if ((m_displayState == e_Tutorial_State_Any ||
|
||||
m_tutorial->getCurrentState() == m_displayState) &&
|
||||
m_hintNeeded && area->contains(&player_pos) == contains) {
|
||||
m_hintNeeded && area.contains(player_pos) == contains) {
|
||||
if (m_completeState == e_Tutorial_State_None) {
|
||||
m_hintNeeded = false;
|
||||
} else if (m_tutorial->isStateCompleted(m_completeState)) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class AABB;
|
|||
|
||||
class AreaHint : public TutorialHint {
|
||||
private:
|
||||
AABB* area;
|
||||
AABB area;
|
||||
bool contains; // If true we must stay in this area, if false must stay out
|
||||
// of this area
|
||||
|
||||
|
|
@ -21,7 +21,6 @@ public:
|
|||
eTutorial_State displayState, eTutorial_State completeState,
|
||||
int descriptionId, double x0, double y0, double z0, double x1,
|
||||
double y1, double z1, bool allowFade = true, bool contains = true);
|
||||
~AreaHint();
|
||||
|
||||
virtual int tick();
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ ChangeStateConstraint::ChangeStateConstraint(
|
|||
bool contains /*= true*/, bool changeGameMode /*= false*/,
|
||||
GameType* targetGameMode /*= 0*/)
|
||||
: TutorialConstraint(-1) {
|
||||
movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1);
|
||||
movementArea = AABB(x0, y0, z0, x1, y1, z1);
|
||||
|
||||
this->contains = contains;
|
||||
|
||||
|
|
@ -40,7 +40,6 @@ ChangeStateConstraint::ChangeStateConstraint(
|
|||
}
|
||||
|
||||
ChangeStateConstraint::~ChangeStateConstraint() {
|
||||
delete movementArea;
|
||||
if (m_sourceStatesCount > 0) delete[] m_sourceStates;
|
||||
}
|
||||
|
||||
|
|
@ -85,9 +84,11 @@ void ChangeStateConstraint::tick(int iPad) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: check if this can be elided
|
||||
Vec3 ipad_player = minecraft->localplayers[iPad]->getPos(1);
|
||||
if (!m_bHasChanged && inASourceState &&
|
||||
movementArea->contains(&ipad_player) == contains) {
|
||||
movementArea.contains(ipad_player) == contains) {
|
||||
m_bHasChanged = true;
|
||||
m_changedFromState = m_tutorial->getCurrentState();
|
||||
m_tutorial->changeTutorialState(m_targetState);
|
||||
|
|
@ -125,7 +126,7 @@ void ChangeStateConstraint::tick(int iPad) {
|
|||
}
|
||||
}
|
||||
} else if (m_bHasChanged &&
|
||||
movementArea->contains(&ipad_player) != contains) {
|
||||
movementArea.contains(ipad_player) != contains) {
|
||||
m_bHasChanged = false;
|
||||
m_tutorial->changeTutorialState(m_changedFromState);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class GameType;
|
|||
|
||||
class ChangeStateConstraint : public TutorialConstraint {
|
||||
private:
|
||||
AABB* movementArea;
|
||||
AABB movementArea;
|
||||
bool contains; // If true we must stay in this area, if false must stay out
|
||||
// of this area
|
||||
bool m_changeGameMode;
|
||||
|
|
|
|||
|
|
@ -383,7 +383,6 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) {
|
|||
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
|
@ -420,7 +419,6 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) {
|
|||
int IUIScene_PauseMenu::ExitWorldThreadProc(void* lpParameter) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
// app.SetGameStarted(false);
|
||||
|
|
|
|||
|
|
@ -222,7 +222,6 @@ HRESULT CScene_Death::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled) {
|
|||
}
|
||||
|
||||
int CScene_Death::RespawnThreadProc(void* lpParameter) {
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
size_t iPad = (size_t)lpParameter;
|
||||
|
||||
|
|
|
|||
|
|
@ -1075,7 +1075,6 @@ int UIScene_PauseMenu::SaveWorldThreadProc(LPVOID lpParameter) {
|
|||
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
|
@ -1107,7 +1106,6 @@ int UIScene_PauseMenu::SaveWorldThreadProc(LPVOID lpParameter) {
|
|||
int UIScene_PauseMenu::ExitWorldThreadProc(void* lpParameter) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
// app.SetGameStarted(false);
|
||||
|
|
|
|||
|
|
@ -794,7 +794,6 @@ void oldWinMainInit() {
|
|||
// Initialise TLS for tesselator, for this main thread
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
// Initialise TLS for AABB and Vec3 pools, for this main thread
|
||||
AABB::CreateNewThreadStorage();
|
||||
OldChunkStorage::CreateNewThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
Tile::CreateNewThreadStorage();
|
||||
|
|
|
|||
|
|
@ -856,7 +856,6 @@ return -1;
|
|||
// Initialise TLS for tesselator, for this main thread
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
// Initialise TLS for AABB and Vec3 pools, for this main thread
|
||||
AABB::CreateNewThreadStorage();
|
||||
Compression::CreateNewThreadStorage();
|
||||
OldChunkStorage::CreateNewThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
|
|
|
|||
|
|
@ -1040,7 +1040,6 @@ void RegisterAwardsWithProfileManager() {
|
|||
}
|
||||
|
||||
int StartMinecraftThreadProc(void* lpParameter) {
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
RenderManager.InitialiseContext();
|
||||
Minecraft::start(std::wstring(), std::wstring());
|
||||
|
|
@ -1376,7 +1375,6 @@ int main(int argc, const char* argv[]) {
|
|||
// Initialise TLS for tesselator, for this main thread
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
// Initialise TLS for AABB and Vec3 pools, for this main thread
|
||||
AABB::CreateNewThreadStorage();
|
||||
Compression::CreateNewThreadStorage();
|
||||
OldChunkStorage::CreateNewThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
|
|
|
|||
|
|
@ -1210,7 +1210,6 @@ int main() {
|
|||
// Initialise TLS for tesselator, for this main thread
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
// Initialise TLS for AABB and Vec3 pools, for this main thread
|
||||
AABB::CreateNewThreadStorage();
|
||||
OldChunkStorage::CreateNewThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
Tile::CreateNewThreadStorage();
|
||||
|
|
|
|||
|
|
@ -329,8 +329,8 @@ bool Tile_SPU::isSolidRender(bool isServerLevel) { return true; }
|
|||
// {
|
||||
// int newCount =
|
||||
// ExperienceOrb::getExperienceValue(amount); amount -=
|
||||
// newCount; level->addEntity(std::shared_ptr<ExperienceOrb>( new
|
||||
// ExperienceOrb(level, x + .5, y + .5, z + .5, newCount)));
|
||||
// newCount; level->addEntity(std::shared_ptr<ExperienceOrb>(
|
||||
// new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount)));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -660,7 +660,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||
// Initialise TLS for tesselator, for this main thread
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
// Initialise TLS for AABB and Vec3 pools, for this main thread
|
||||
AABB::CreateNewThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
|
||||
Minecraft::main();
|
||||
|
|
|
|||
|
|
@ -895,7 +895,6 @@ int main() {
|
|||
// Initialise TLS for tesselator, for this main thread
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
// Initialise TLS for AABB and Vec3 pools, for this main thread
|
||||
AABB::CreateNewThreadStorage();
|
||||
Compression::CreateNewThreadStorage();
|
||||
OldChunkStorage::CreateNewThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
|
|
|
|||
|
|
@ -940,7 +940,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||
// Initialise TLS for tesselator, for this main thread
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
// Initialise TLS for AABB and Vec3 pools, for this main thread
|
||||
AABB::CreateNewThreadStorage();
|
||||
Compression::CreateNewThreadStorage();
|
||||
OldChunkStorage::CreateNewThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
|
|
|
|||
|
|
@ -699,7 +699,6 @@ int __cdecl main() {
|
|||
// Initialise TLS for tesselator, for this main thread
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
// Initialise TLS for AABB and Vec3 pools, for this main thread
|
||||
AABB::CreateNewThreadStorage();
|
||||
Compression::CreateNewThreadStorage();
|
||||
OldChunkStorage::CreateNewThreadStorage();
|
||||
Level::enableLightingCache();
|
||||
|
|
|
|||
|
|
@ -245,10 +245,10 @@ void LocalPlayer::aiStep() {
|
|||
if (ySlideOffset < 0.2f) ySlideOffset = 0.2f;
|
||||
}
|
||||
|
||||
checkInTile(x - bbWidth * 0.35, bb->y0 + 0.5, z + bbWidth * 0.35);
|
||||
checkInTile(x - bbWidth * 0.35, bb->y0 + 0.5, z - bbWidth * 0.35);
|
||||
checkInTile(x + bbWidth * 0.35, bb->y0 + 0.5, z - bbWidth * 0.35);
|
||||
checkInTile(x + bbWidth * 0.35, bb->y0 + 0.5, z + bbWidth * 0.35);
|
||||
checkInTile(x - bbWidth * 0.35, bb.y0 + 0.5, z + bbWidth * 0.35);
|
||||
checkInTile(x - bbWidth * 0.35, bb.y0 + 0.5, z - bbWidth * 0.35);
|
||||
checkInTile(x + bbWidth * 0.35, bb.y0 + 0.5, z - bbWidth * 0.35);
|
||||
checkInTile(x + bbWidth * 0.35, bb.y0 + 0.5, z + bbWidth * 0.35);
|
||||
|
||||
bool enoughFoodToSprint =
|
||||
getFoodData()->getFoodLevel() >
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ void MultiplayerLocalPlayer::sendPosition() {
|
|||
}
|
||||
|
||||
double xdd = x - xLast;
|
||||
double ydd1 = bb->y0 - yLast1;
|
||||
double ydd1 = bb.y0 - yLast1;
|
||||
double zdd = z - zLast;
|
||||
|
||||
double rydd = yRot - yRotLast;
|
||||
|
|
@ -158,11 +158,11 @@ void MultiplayerLocalPlayer::sendPosition() {
|
|||
if (move && rot) {
|
||||
connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::PosRot(
|
||||
x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying)));
|
||||
x, bb.y0, y, z, yRot, xRot, onGround, abilities.flying)));
|
||||
} else if (move) {
|
||||
connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Pos(
|
||||
x, bb->y0, y, z, onGround, abilities.flying)));
|
||||
x, bb.y0, y, z, onGround, abilities.flying)));
|
||||
} else if (rot) {
|
||||
connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Rot(
|
||||
|
|
@ -178,7 +178,7 @@ void MultiplayerLocalPlayer::sendPosition() {
|
|||
|
||||
if (move) {
|
||||
xLast = x;
|
||||
yLast1 = bb->y0;
|
||||
yLast1 = bb.y0;
|
||||
yLast2 = y;
|
||||
zLast = z;
|
||||
positionReminder = 0;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ Chunk::Chunk(Level* level, LevelRenderer::rteMap& globalRenderableTileEntities,
|
|||
: globalRenderableTileEntities(&globalRenderableTileEntities),
|
||||
globalRenderableTileEntities_cs(&globalRenderableTileEntities_cs) {
|
||||
clipChunk->visible = false;
|
||||
bb = NULL;
|
||||
const double g = 6;
|
||||
bb = AABB(-g, -g, -g, XZSIZE + g, SIZE + g, XZSIZE + g);
|
||||
id = 0;
|
||||
|
||||
this->level = level;
|
||||
|
|
@ -92,21 +93,13 @@ void Chunk::setPos(int x, int y, int z) {
|
|||
#endif
|
||||
|
||||
float g = 6.0f;
|
||||
// 4J - changed to just set the value rather than make a new one, if we've
|
||||
// already created storage
|
||||
if (bb == NULL) {
|
||||
bb = AABB::newPermanent(-g, -g, -g, XZSIZE + g, SIZE + g, XZSIZE + g);
|
||||
} else {
|
||||
// 4J MGH - bounds are relative to the position now, so the AABB will be
|
||||
// setup already, either above, or from the tesselator bounds.
|
||||
// bb->set(-g, -g, -g, SIZE+g, SIZE+g, SIZE+g);
|
||||
}
|
||||
clipChunk->aabb[0] = bb->x0 + x;
|
||||
clipChunk->aabb[1] = bb->y0 + y;
|
||||
clipChunk->aabb[2] = bb->z0 + z;
|
||||
clipChunk->aabb[3] = bb->x1 + x;
|
||||
clipChunk->aabb[4] = bb->y1 + y;
|
||||
clipChunk->aabb[5] = bb->z1 + z;
|
||||
|
||||
clipChunk->aabb[0] = bb.x0 + x;
|
||||
clipChunk->aabb[1] = bb.y0 + y;
|
||||
clipChunk->aabb[2] = bb.z0 + z;
|
||||
clipChunk->aabb[3] = bb.x1 + x;
|
||||
clipChunk->aabb[4] = bb.y1 + y;
|
||||
clipChunk->aabb[5] = bb.z1 + z;
|
||||
|
||||
assigned = true;
|
||||
|
||||
|
|
@ -508,11 +501,8 @@ void Chunk::rebuild() {
|
|||
|
||||
// 4J MGH - added this to take the bound from the value calc'd in the
|
||||
// tesselator
|
||||
if (bb) {
|
||||
bb->set(bounds.boundingBox[0], bounds.boundingBox[1],
|
||||
bounds.boundingBox[2], bounds.boundingBox[3],
|
||||
bounds.boundingBox[4], bounds.boundingBox[5]);
|
||||
}
|
||||
bb = {bounds.boundingBox[0], bounds.boundingBox[1], bounds.boundingBox[2],
|
||||
bounds.boundingBox[3], bounds.boundingBox[4], bounds.boundingBox[5]};
|
||||
|
||||
delete tileRenderer;
|
||||
delete region;
|
||||
|
|
@ -1033,7 +1023,7 @@ int Chunk::getList(int layer) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
void Chunk::cull(Culler* culler) { clipChunk->visible = culler->isVisible(bb); }
|
||||
void Chunk::cull(Culler* culler) { clipChunk->visible = culler->isVisible(&bb); }
|
||||
|
||||
void Chunk::renderBB() {
|
||||
// glCallList(lists + 2); // 4J - removed - TODO put back in
|
||||
|
|
@ -1064,8 +1054,6 @@ void Chunk::clearDirty() {
|
|||
#endif
|
||||
}
|
||||
|
||||
Chunk::~Chunk() { delete bb; }
|
||||
|
||||
bool Chunk::emptyFlagSet(int layer) {
|
||||
return levelRenderer->getGlobalChunkFlag(
|
||||
x, y, z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, layer);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
int xRenderOffs, yRenderOffs, zRenderOffs;
|
||||
|
||||
int xm, ym, zm;
|
||||
AABB* bb;
|
||||
AABB bb;
|
||||
ClipChunk* clipChunk;
|
||||
|
||||
int id;
|
||||
|
|
@ -88,5 +88,4 @@ public:
|
|||
void setDirty();
|
||||
void clearDirty(); // 4J added
|
||||
bool emptyFlagSet(int layer);
|
||||
~Chunk();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void EntityRenderer::renderFlame(std::shared_ptr<Entity> e, double x, double y,
|
|||
float xo = 0.0f;
|
||||
|
||||
float h = e->bbHeight / s;
|
||||
float yo = (float)(e->y - e->bb->y0);
|
||||
float yo = (float)(e->y - e->bb.y0);
|
||||
|
||||
glRotatef(-entityRenderDispatcher->playerRotY, 0, 1, 0);
|
||||
|
||||
|
|
@ -394,4 +394,4 @@ void EntityRenderer::registerTerrainTextures(IconRegister* iconRegister) {}
|
|||
ResourceLocation* EntityRenderer::getTextureLocation(
|
||||
std::shared_ptr<Entity> mob) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ void FireballRenderer::renderFlame(std::shared_ptr<Entity> e, double x,
|
|||
// float yo = 0.0f;
|
||||
|
||||
float h = e->bbHeight / s;
|
||||
float yo = (float)(e->y - e->bb->y0);
|
||||
float yo = (float)(e->y - e->bb.y0);
|
||||
|
||||
// glRotatef(-entityRenderDispatcher->playerRotY, 0, 1, 0);
|
||||
|
||||
|
|
@ -118,4 +118,4 @@ void FireballRenderer::renderFlame(std::shared_ptr<Entity> e, double x,
|
|||
ResourceLocation* FireballRenderer::getTextureLocation(
|
||||
std::shared_ptr<Entity> mob) {
|
||||
return &TextureAtlas::LOCATION_ITEMS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,11 +309,12 @@ void GameRenderer::pick(float a) {
|
|||
to = to.add(from.x, from.y, from.z);
|
||||
hovered = nullptr;
|
||||
float overlap = 1;
|
||||
std::vector<std::shared_ptr<Entity> >* objects = mc->level->getEntities(
|
||||
mc->cameraTargetPlayer,
|
||||
mc->cameraTargetPlayer->bb
|
||||
->expand(b.x * (range), b.y * (range), b.z * (range))
|
||||
->grow(overlap, overlap, overlap));
|
||||
AABB grown = mc->cameraTargetPlayer->bb
|
||||
.expand(b.x * (range), b.y * (range), b.z * (range))
|
||||
.grow(overlap, overlap, overlap);
|
||||
|
||||
std::vector<std::shared_ptr<Entity> >* objects =
|
||||
mc->level->getEntities(mc->cameraTargetPlayer, &grown);
|
||||
double nearest = dist;
|
||||
|
||||
AUTO_VAR(itEnd, objects->end());
|
||||
|
|
@ -322,9 +323,9 @@ void GameRenderer::pick(float a) {
|
|||
if (!e->isPickable()) continue;
|
||||
|
||||
float rr = e->getPickRadius();
|
||||
AABB* bb = e->bb->grow(rr, rr, rr);
|
||||
HitResult* p = bb->clip(&from, &to);
|
||||
if (bb->contains(&from)) {
|
||||
AABB bb = e->bb.grow(rr, rr, rr);
|
||||
HitResult* p = bb.clip(from, to);
|
||||
if (bb.contains(from)) {
|
||||
if (0 < nearest || nearest == 0) {
|
||||
hovered = e;
|
||||
nearest = 0;
|
||||
|
|
@ -1120,7 +1121,6 @@ void GameRenderer::FinishedReassigning() {
|
|||
|
||||
int GameRenderer::runUpdate(void* lpParam) {
|
||||
Minecraft* minecraft = Minecraft::GetInstance();
|
||||
AABB::CreateNewThreadStorage();
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
Compression::UseDefaultThreadStorage();
|
||||
RenderManager.InitialiseContext();
|
||||
|
|
@ -1199,7 +1199,6 @@ int GameRenderer::runUpdate(void* lpParam) {
|
|||
|
||||
// PIXEndNamedEvent();
|
||||
|
||||
AABB::resetPool();
|
||||
m_updateEvents->Set(eUpdateEventIsFinished);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -585,14 +585,14 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) {
|
|||
|
||||
bool shouldRender =
|
||||
(entity->shouldRender(cam) &&
|
||||
(entity->noCulling || culler->isVisible(entity->bb)));
|
||||
(entity->noCulling || culler->isVisible(&entity->bb)));
|
||||
|
||||
// Render the mob if the mob's leash holder is within the culler
|
||||
if (!shouldRender && entity->instanceof(eTYPE_MOB)) {
|
||||
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(entity);
|
||||
if (mob->isLeashed() && (mob->getLeashHolder() != NULL)) {
|
||||
std::shared_ptr<Entity> leashHolder = mob->getLeashHolder();
|
||||
shouldRender = culler->isVisible(leashHolder->bb);
|
||||
shouldRender = culler->isVisible(&leashHolder->bb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2479,10 +2479,13 @@ void LevelRenderer::renderHitOutline(std::shared_ptr<Player> player,
|
|||
double xo = player->xOld + (player->x - player->xOld) * a;
|
||||
double yo = player->yOld + (player->y - player->yOld) * a;
|
||||
double zo = player->zOld + (player->z - player->zOld) * a;
|
||||
render(Tile::tiles[tileId]
|
||||
->getTileAABB(level[iPad], h->x, h->y, h->z)
|
||||
->grow(ss, ss, ss)
|
||||
->cloneMove(-xo, -yo, -zo));
|
||||
|
||||
AABB bb = Tile::tiles[tileId]
|
||||
->getTileAABB(level[iPad], h->x, h->y, h->z)
|
||||
.grow(ss, ss, ss)
|
||||
.move(-xo, -yo, -zo);
|
||||
|
||||
render(&bb);
|
||||
}
|
||||
glDepthMask(true);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
|
@ -3859,12 +3862,6 @@ LevelRenderer::DestroyedTileManager::RecentTile::RecentTile(int x, int y, int z,
|
|||
rebuilt = false;
|
||||
}
|
||||
|
||||
LevelRenderer::DestroyedTileManager::RecentTile::~RecentTile() {
|
||||
for (AUTO_VAR(it, boxes.begin()); it != boxes.end(); it++) {
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
|
||||
LevelRenderer::DestroyedTileManager::DestroyedTileManager() {
|
||||
InitializeCriticalSection(&m_csDestroyedTiles);
|
||||
}
|
||||
|
|
@ -3888,20 +3885,12 @@ void LevelRenderer::DestroyedTileManager::destroyingTileAt(Level* level, int x,
|
|||
// ones, so make a temporary list and then copy over
|
||||
|
||||
RecentTile* recentTile = new RecentTile(x, y, z, level);
|
||||
AABB* box = AABB::newTemp((float)x, (float)y, (float)z, (float)(x + 1),
|
||||
(float)(y + 1), (float)(z + 1));
|
||||
AABB box((float)x, (float)y, (float)z, (float)(x + 1), (float)(y + 1),
|
||||
(float)(z + 1));
|
||||
Tile* tile = Tile::tiles[level->getTile(x, y, z)];
|
||||
|
||||
if (tile != NULL) {
|
||||
tile->addAABBs(level, x, y, z, box, &recentTile->boxes, nullptr);
|
||||
}
|
||||
|
||||
// Make these temporary AABBs into permanently allocated AABBs
|
||||
for (unsigned int i = 0; i < recentTile->boxes.size(); i++) {
|
||||
recentTile->boxes[i] = AABB::newPermanent(
|
||||
recentTile->boxes[i]->x0, recentTile->boxes[i]->y0,
|
||||
recentTile->boxes[i]->z0, recentTile->boxes[i]->x1,
|
||||
recentTile->boxes[i]->y1, recentTile->boxes[i]->z1);
|
||||
tile->addAABBs(level, x, y, z, &box, &recentTile->boxes, nullptr);
|
||||
}
|
||||
|
||||
m_destroyedTiles.push_back(recentTile);
|
||||
|
|
@ -3974,14 +3963,13 @@ void LevelRenderer::DestroyedTileManager::addAABBs(Level* level, AABB* box,
|
|||
// interested in, add them to the output list, making a temp
|
||||
// AABB copy so that we can destroy our own copy without
|
||||
// worrying about the lifespan of the copy we've passed out
|
||||
if (m_destroyedTiles[i]->boxes[j]->intersects(box)) {
|
||||
boxes->push_back(
|
||||
AABB::newTemp(m_destroyedTiles[i]->boxes[j]->x0,
|
||||
m_destroyedTiles[i]->boxes[j]->y0,
|
||||
m_destroyedTiles[i]->boxes[j]->z0,
|
||||
m_destroyedTiles[i]->boxes[j]->x1,
|
||||
m_destroyedTiles[i]->boxes[j]->y1,
|
||||
m_destroyedTiles[i]->boxes[j]->z1));
|
||||
if (m_destroyedTiles[i]->boxes[j].intersects(*box)) {
|
||||
boxes->push_back({m_destroyedTiles[i]->boxes[j].x0,
|
||||
m_destroyedTiles[i]->boxes[j].y0,
|
||||
m_destroyedTiles[i]->boxes[j].z0,
|
||||
m_destroyedTiles[i]->boxes[j].x1,
|
||||
m_destroyedTiles[i]->boxes[j].y1,
|
||||
m_destroyedTiles[i]->boxes[j].z1});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4042,7 +4030,6 @@ void LevelRenderer::staticCtor() {
|
|||
}
|
||||
|
||||
int LevelRenderer::rebuildChunkThreadProc(void* lpParam) {
|
||||
AABB::CreateNewThreadStorage();
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
RenderManager.InitialiseContext();
|
||||
Chunk::CreateNewThreadStorage();
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ public:
|
|||
int timeout_ticks;
|
||||
bool rebuilt;
|
||||
RecentTile(int x, int y, int z, Level* level);
|
||||
~RecentTile();
|
||||
~RecentTile() = default;
|
||||
};
|
||||
CRITICAL_SECTION m_csDestroyedTiles;
|
||||
std::vector<RecentTile*> m_destroyedTiles;
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ void CritParticle::_init(Level* level, std::shared_ptr<Entity> entity,
|
|||
}
|
||||
|
||||
CritParticle::CritParticle(Level* level, std::shared_ptr<Entity> entity)
|
||||
: Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2,
|
||||
: Particle(level, entity->x, entity->bb.y0 + entity->bbHeight / 2,
|
||||
entity->z, entity->xd, entity->yd, entity->zd) {
|
||||
_init(level, entity, eParticleType_crit);
|
||||
}
|
||||
|
||||
CritParticle::CritParticle(Level* level, std::shared_ptr<Entity> entity,
|
||||
ePARTICLE_TYPE type)
|
||||
: Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2,
|
||||
: Particle(level, entity->x, entity->bb.y0 + entity->bbHeight / 2,
|
||||
entity->z, entity->xd, entity->yd, entity->zd) {
|
||||
_init(level, entity, type);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ void CritParticle::tick() {
|
|||
if (xa * xa + ya * ya + za * za > 1) continue;
|
||||
double x = entity->x + xa * entity->bbWidth / 4;
|
||||
double y =
|
||||
entity->bb->y0 + entity->bbHeight / 2 + ya * entity->bbHeight / 4;
|
||||
entity->bb.y0 + entity->bbHeight / 2 + ya * entity->bbHeight / 4;
|
||||
double z = entity->z + za * entity->bbWidth / 4;
|
||||
level->addParticle(particleName, x, y, z, xa, ya + 0.2, za);
|
||||
}
|
||||
|
|
@ -55,4 +55,4 @@ void CritParticle::tick() {
|
|||
|
||||
int CritParticle::getParticleTexture() {
|
||||
return ParticleEngine::ENTITY_PARTICLE_TEXTURE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ void PlayerCloudParticle::tick() {
|
|||
zd *= 0.96f;
|
||||
std::shared_ptr<Player> p = level->getNearestPlayer(shared_from_this(), 2);
|
||||
if (p != NULL) {
|
||||
if (y > p->bb->y0) {
|
||||
y += (p->bb->y0 - y) * 0.2;
|
||||
if (y > p->bb.y0) {
|
||||
y += (p->bb.y0 - y) * 0.2;
|
||||
yd += (p->yd - yd) * 0.2;
|
||||
setPos(x, y, z);
|
||||
}
|
||||
|
|
@ -63,4 +63,4 @@ void PlayerCloudParticle::tick() {
|
|||
xd *= 0.7f;
|
||||
zd *= 0.7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ void LookControl::setLookAt(std::shared_ptr<Entity> target, float yMax,
|
|||
target->y +
|
||||
std::dynamic_pointer_cast<LivingEntity>(target)->getHeadHeight();
|
||||
else
|
||||
wantedY = (target->bb->y0 + target->bb->y1) / 2;
|
||||
wantedY = (target->bb.y0 + target->bb.y1) / 2;
|
||||
wantedZ = target->z;
|
||||
this->yMax = yMax;
|
||||
this->xMax = xMax;
|
||||
|
|
@ -88,4 +88,4 @@ double LookControl::getWantedX() { return wantedX; }
|
|||
|
||||
double LookControl::getWantedY() { return wantedY; }
|
||||
|
||||
double LookControl::getWantedZ() { return wantedZ; }
|
||||
double LookControl::getWantedZ() { return wantedZ; }
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void MoveControl::tick() {
|
|||
if (!_hasWanted) return;
|
||||
_hasWanted = false;
|
||||
|
||||
int yFloor = floor(mob->bb->y0 + .5f);
|
||||
int yFloor = floor(mob->bb.y0 + .5f);
|
||||
|
||||
double xd = wantedX - mob->x;
|
||||
double zd = wantedZ - mob->z;
|
||||
|
|
@ -66,4 +66,4 @@ float MoveControl::rotlerp(float a, float b, float max) {
|
|||
diff = -max;
|
||||
}
|
||||
return a + diff;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,10 @@ bool AvoidPlayerGoal::canUse() {
|
|||
mob->level->getNearestPlayer(mob->shared_from_this(), maxDist));
|
||||
if (toAvoid.lock() == NULL) return false;
|
||||
} else {
|
||||
AABB grown_bb = mob->bb.grow(maxDist, 3, maxDist);
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
mob->level->getEntitiesOfClass(
|
||||
avoidType, mob->bb->grow(maxDist, 3, maxDist), entitySelector);
|
||||
avoidType, &grown_bb, entitySelector);
|
||||
if (entities->empty()) {
|
||||
delete entities;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -48,8 +48,9 @@ void BreedGoal::tick() {
|
|||
|
||||
std::shared_ptr<Animal> BreedGoal::getFreePartner() {
|
||||
float r = 8;
|
||||
AABB grown_bb = animal->bb.grow(r, r, r);
|
||||
std::vector<std::shared_ptr<Entity> >* others =
|
||||
level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(r, r, r));
|
||||
level->getEntitiesOfClass(typeid(*animal), &grown_bb);
|
||||
double dist = std::numeric_limits<double>::max();
|
||||
std::shared_ptr<Animal> partner = nullptr;
|
||||
for (AUTO_VAR(it, others->begin()); it != others->end(); ++it) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ FleeSunGoal::FleeSunGoal(PathfinderMob* mob, double speedModifier) {
|
|||
bool FleeSunGoal::canUse() {
|
||||
if (!level->isDay()) return false;
|
||||
if (!mob->isOnFire()) return false;
|
||||
if (!level->canSeeSky(Mth::floor(mob->x), (int)mob->bb->y0,
|
||||
if (!level->canSeeSky(Mth::floor(mob->x), (int)mob->bb.y0,
|
||||
Mth::floor(mob->z)))
|
||||
return false;
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ std::optional<Vec3> FleeSunGoal::getHidePos() {
|
|||
Random* random = mob->getRandom();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int xt = Mth::floor(mob->x + random->nextInt(20) - 10);
|
||||
int yt = Mth::floor(mob->bb->y0 + random->nextInt(6) - 3);
|
||||
int yt = Mth::floor(mob->bb.y0 + random->nextInt(6) - 3);
|
||||
int zt = Mth::floor(mob->z + random->nextInt(20) - 10);
|
||||
if (!level->canSeeSky(xt, yt, zt) &&
|
||||
mob->getWalkTargetValue(xt, yt, zt) < 0)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void FollowOwnerGoal::tick() {
|
|||
// find a good spawn position nearby the owner
|
||||
int sx = Mth::floor(owner.lock()->x) - 2;
|
||||
int sz = Mth::floor(owner.lock()->z) - 2;
|
||||
int y = Mth::floor(owner.lock()->bb->y0);
|
||||
int y = Mth::floor(owner.lock()->bb.y0);
|
||||
for (int x = 0; x <= 4; x++) {
|
||||
for (int z = 0; z <= 4; z++) {
|
||||
if (x >= 1 && z >= 1 && x <= 3 && z <= 3) {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ FollowParentGoal::FollowParentGoal(Animal* animal, double speedModifier) {
|
|||
bool FollowParentGoal::canUse() {
|
||||
if (animal->getAge() >= 0) return false;
|
||||
|
||||
AABB grown_bb = animal->bb.grow(8, 4, 8);
|
||||
std::vector<std::shared_ptr<Entity> >* parents =
|
||||
animal->level->getEntitiesOfClass(typeid(*animal),
|
||||
animal->bb->grow(8, 4, 8));
|
||||
animal->level->getEntitiesOfClass(typeid(*animal), &grown_bb);
|
||||
|
||||
std::shared_ptr<Animal> closest = nullptr;
|
||||
double closestDistSqr = std::numeric_limits<double>::max();
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ void HurtByTargetGoal::start() {
|
|||
|
||||
if (alertSameType) {
|
||||
double within = getFollowDistance();
|
||||
AABB mob_bb = AABB(mob->x, mob->y, mob->z, mob->x + 1, mob->y + 1, mob->z + 1).grow(within, 4, within);
|
||||
std::vector<std::shared_ptr<Entity> >* nearby =
|
||||
mob->level->getEntitiesOfClass(
|
||||
typeid(*mob), AABB::newTemp(mob->x, mob->y, mob->z, mob->x + 1,
|
||||
mob->y + 1, mob->z + 1)
|
||||
->grow(within, 4, within));
|
||||
typeid(*mob), &mob_bb);
|
||||
for (AUTO_VAR(it, nearby->begin()); it != nearby->end(); ++it) {
|
||||
std::shared_ptr<PathfinderMob> other =
|
||||
std::dynamic_pointer_cast<PathfinderMob>(*it);
|
||||
|
|
@ -40,4 +39,4 @@ void HurtByTargetGoal::start() {
|
|||
}
|
||||
|
||||
TargetGoal::start();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ bool LookAtPlayerGoal::canUse() {
|
|||
lookAt =
|
||||
mob->level->getNearestPlayer(mob->shared_from_this(), lookDistance);
|
||||
} else {
|
||||
AABB mob_bb = mob->bb.grow(lookDistance, 3, lookDistance);
|
||||
lookAt = std::weak_ptr<Entity>(mob->level->getClosestEntityOfClass(
|
||||
lookAtType, mob->bb->grow(lookDistance, 3, lookDistance),
|
||||
mob->shared_from_this()));
|
||||
lookAtType, &mob_bb, mob->shared_from_this()));
|
||||
}
|
||||
return lookAt.lock() != NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ bool MakeLoveGoal::canUse() {
|
|||
if (village.lock() == NULL) return false;
|
||||
if (!villageNeedsMoreVillagers()) return false;
|
||||
|
||||
AABB villager_bb = villager->bb.grow(8, 3, 8);
|
||||
std::shared_ptr<Entity> mate = level->getClosestEntityOfClass(
|
||||
typeid(Villager), villager->bb->grow(8, 3, 8),
|
||||
villager->shared_from_this());
|
||||
typeid(Villager), &villager_bb, villager->shared_from_this());
|
||||
if (mate == NULL) return false;
|
||||
|
||||
partner =
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ bool MeleeAttackGoal::canUse() {
|
|||
std::shared_ptr<LivingEntity> target = mob->getTarget();
|
||||
if (target == NULL) return false;
|
||||
if (!target->isAlive()) return false;
|
||||
if (attackType != eTYPE_NOTSET && !target->instanceof (attackType))
|
||||
if (attackType != eTYPE_NOTSET && !target->instanceof(attackType))
|
||||
return false;
|
||||
path.reset(mob->getNavigation()->createPath(target));
|
||||
return path != nullptr;
|
||||
|
|
@ -79,7 +79,7 @@ void MeleeAttackGoal::tick() {
|
|||
|
||||
double meleeRadiusSqr =
|
||||
(mob->bbWidth * 2) * (mob->bbWidth * 2) + target->bbWidth;
|
||||
if (mob->distanceToSqr(target->x, target->bb->y0, target->z) >
|
||||
if (mob->distanceToSqr(target->x, target->bb.y0, target->z) >
|
||||
meleeRadiusSqr)
|
||||
return;
|
||||
if (attackTime > 0) return;
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ bool NearestAttackableTargetGoal::canUse() {
|
|||
return false;
|
||||
double within = getFollowDistance();
|
||||
|
||||
AABB mob_bb = mob->bb.grow(within, 4, within);
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
mob->level->getEntitiesOfClass(
|
||||
targetType, mob->bb->grow(within, 4, within), selector);
|
||||
mob->level->getEntitiesOfClass(targetType, &mob_bb, selector);
|
||||
|
||||
bool result = false;
|
||||
if (entities != NULL && !entities->empty()) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void OcelotAttackGoal::tick() {
|
|||
mob->getLookControl()->setLookAt(target.lock(), 30, 30);
|
||||
|
||||
double meleeRadiusSqr = (mob->bbWidth * 2) * (mob->bbWidth * 2);
|
||||
double distSqr = mob->distanceToSqr(target.lock()->x, target.lock()->bb->y0,
|
||||
double distSqr = mob->distanceToSqr(target.lock()->x, target.lock()->bb.y0,
|
||||
target.lock()->z);
|
||||
|
||||
double speedModifier = Ocelot::WALK_SPEED_MOD;
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ OfferFlowerGoal::OfferFlowerGoal(VillagerGolem* golem) {
|
|||
bool OfferFlowerGoal::canUse() {
|
||||
if (!golem->level->isDay()) return false;
|
||||
if (golem->getRandom()->nextInt(8000) != 0) return false;
|
||||
AABB golem_bb = golem->bb.grow(6, 2, 6);
|
||||
villager = std::weak_ptr<Villager>(std::dynamic_pointer_cast<Villager>(
|
||||
golem->level->getClosestEntityOfClass(typeid(Villager),
|
||||
golem->bb->grow(6, 2, 6),
|
||||
golem->level->getClosestEntityOfClass(typeid(Villager), &golem_bb,
|
||||
golem->shared_from_this())));
|
||||
return villager.lock() != NULL;
|
||||
}
|
||||
|
|
@ -39,4 +39,4 @@ void OfferFlowerGoal::stop() {
|
|||
void OfferFlowerGoal::tick() {
|
||||
golem->getLookControl()->setLookAt(villager.lock(), 30, 30);
|
||||
--_tick;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ bool PlayGoal::canUse() {
|
|||
if (mob->getAge() >= 0) return false;
|
||||
if (mob->getRandom()->nextInt(400) != 0) return false;
|
||||
|
||||
AABB mob_bb = mob->bb.grow(6, 3, 6);
|
||||
std::vector<std::shared_ptr<Entity> >* children =
|
||||
mob->level->getEntitiesOfClass(typeid(Villager),
|
||||
mob->bb->grow(6, 3, 6));
|
||||
mob->level->getEntitiesOfClass(typeid(Villager), &mob_bb);
|
||||
double closestDistSqr = std::numeric_limits<double>::max();
|
||||
// for (Entity c : children)
|
||||
for (AUTO_VAR(it, children->begin()); it != children->end(); ++it) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void RangedAttackGoal::tick() {
|
|||
if (target.lock() == NULL) return;
|
||||
|
||||
double targetDistSqr = mob->distanceToSqr(
|
||||
target.lock()->x, target.lock()->bb->y0, target.lock()->z);
|
||||
target.lock()->x, target.lock()->bb.y0, target.lock()->z);
|
||||
bool canSee = mob->getSensing()->canSee(target.lock());
|
||||
|
||||
if (canSee) {
|
||||
|
|
@ -100,4 +100,4 @@ void RangedAttackGoal::tick() {
|
|||
attackTime = Mth::floor(dist * (attackIntervalMax - attackIntervalMin) +
|
||||
attackIntervalMin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,10 @@ bool TakeFlowerGoal::canUse() {
|
|||
if (villager->getAge() >= 0) return false;
|
||||
if (!villager->level->isDay()) return false;
|
||||
|
||||
AABB villager_bb = villager->bb.grow(6, 2, 6);
|
||||
std::vector<std::shared_ptr<Entity> >* golems =
|
||||
villager->level->getEntitiesOfClass(typeid(VillagerGolem),
|
||||
villager->bb->grow(6, 2, 6));
|
||||
&villager_bb);
|
||||
if (golems->size() == 0) {
|
||||
delete golems;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ PathFinder::~PathFinder() {
|
|||
}
|
||||
|
||||
Path* PathFinder::findPath(Entity* from, Entity* to, float maxDist) {
|
||||
return findPath(from, to->x, to->bb->y0, to->z, maxDist);
|
||||
return findPath(from, to->x, to->bb.y0, to->z, maxDist);
|
||||
}
|
||||
|
||||
Path* PathFinder::findPath(Entity* from, int x, int y, int z, float maxDist) {
|
||||
|
|
@ -46,9 +46,9 @@ Path* PathFinder::findPath(Entity* e, double xt, double yt, double zt,
|
|||
nodes.clear();
|
||||
|
||||
bool resetAvoidWater = avoidWater;
|
||||
int startY = Mth::floor(e->bb->y0 + 0.5f);
|
||||
int startY = Mth::floor(e->bb.y0 + 0.5f);
|
||||
if (canFloat && e->isInWater()) {
|
||||
startY = (int)(e->bb->y0);
|
||||
startY = (int)(e->bb.y0);
|
||||
int tileId = level->getTile((int)Mth::floor(e->x), startY,
|
||||
(int)Mth::floor(e->z));
|
||||
while (tileId == Tile::water_Id || tileId == Tile::calmWater_Id) {
|
||||
|
|
@ -59,9 +59,9 @@ Path* PathFinder::findPath(Entity* e, double xt, double yt, double zt,
|
|||
resetAvoidWater = avoidWater;
|
||||
avoidWater = false;
|
||||
} else
|
||||
startY = Mth::floor(e->bb->y0 + 0.5f);
|
||||
startY = Mth::floor(e->bb.y0 + 0.5f);
|
||||
|
||||
Node* from = getNode((int)floor(e->bb->x0), startY, (int)floor(e->bb->z0));
|
||||
Node* from = getNode((int)floor(e->bb.x0), startY, (int)floor(e->bb.z0));
|
||||
Node* to = getNode((int)floor(xt - e->bbWidth / 2), (int)floor(yt),
|
||||
(int)floor(zt - e->bbWidth / 2));
|
||||
|
||||
|
|
|
|||
|
|
@ -188,9 +188,9 @@ Vec3 PathNavigation::getTempMobPos() {
|
|||
}
|
||||
|
||||
int PathNavigation::getSurfaceY() {
|
||||
if (!mob->isInWater() || !canFloat) return (int)(mob->bb->y0 + 0.5);
|
||||
if (!mob->isInWater() || !canFloat) return (int)(mob->bb.y0 + 0.5);
|
||||
|
||||
int surface = (int)(mob->bb->y0);
|
||||
int surface = (int)(mob->bb.y0);
|
||||
int tileId =
|
||||
level->getTile(Mth::floor(mob->x), surface, Mth::floor(mob->z));
|
||||
int steps = 0;
|
||||
|
|
@ -198,7 +198,7 @@ int PathNavigation::getSurfaceY() {
|
|||
++surface;
|
||||
tileId =
|
||||
level->getTile(Mth::floor(mob->x), surface, Mth::floor(mob->z));
|
||||
if (++steps > 16) return (int)(mob->bb->y0);
|
||||
if (++steps > 16) return (int)(mob->bb.y0);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ bool PathNavigation::isInLiquid() {
|
|||
}
|
||||
|
||||
void PathNavigation::trimPathFromSun() {
|
||||
if (level->canSeeSky(Mth::floor(mob->x), (int)(mob->bb->y0 + 0.5),
|
||||
if (level->canSeeSky(Mth::floor(mob->x), (int)(mob->bb.y0 + 0.5),
|
||||
Mth::floor(mob->z)))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
#include "../Headers/net.minecraft.h"
|
||||
#include "../Headers/net.minecraft.world.h"
|
||||
#include "BasePressurePlateTile.h"
|
||||
#include <optional>
|
||||
#include "Util/AABB.h"
|
||||
|
||||
BasePressurePlateTile::BasePressurePlateTile(int id, const std::wstring& tex,
|
||||
Material* material)
|
||||
|
|
@ -38,8 +40,9 @@ int BasePressurePlateTile::getTickDelay(Level* level) {
|
|||
return SharedConstants::TICKS_PER_SECOND;
|
||||
}
|
||||
|
||||
AABB* BasePressurePlateTile::getAABB(Level* level, int x, int y, int z) {
|
||||
return NULL;
|
||||
std::optional<AABB> BasePressurePlateTile::getAABB(Level* level, int x, int y,
|
||||
int z) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool BasePressurePlateTile::isSolidRender(bool isServerLevel) { return false; }
|
||||
|
|
@ -111,9 +114,9 @@ void BasePressurePlateTile::checkPressed(Level* level, int x, int y, int z,
|
|||
}
|
||||
}
|
||||
|
||||
AABB* BasePressurePlateTile::getSensitiveAABB(int x, int y, int z) {
|
||||
AABB BasePressurePlateTile::getSensitiveAABB(int x, int y, int z) {
|
||||
float b = 2 / 16.0f;
|
||||
return AABB::newTemp(x + b, y, z + b, x + 1 - b, y + 0.25, z + 1 - b);
|
||||
return AABB(x + b, y, z + b, x + 1 - b, y + 0.25, z + 1 - b);
|
||||
}
|
||||
|
||||
void BasePressurePlateTile::onRemove(Level* level, int x, int y, int z, int id,
|
||||
|
|
@ -160,4 +163,4 @@ int BasePressurePlateTile::getPistonPushReaction() {
|
|||
|
||||
void BasePressurePlateTile::registerIcons(IconRegister* iconRegister) {
|
||||
icon = iconRegister->registerIcon(texture);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ protected:
|
|||
|
||||
public:
|
||||
virtual int getTickDelay(Level* level);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool blocksLight();
|
||||
virtual bool isCubeShaped();
|
||||
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
protected:
|
||||
virtual void checkPressed(Level* level, int x, int y, int z, int oldSignal);
|
||||
virtual AABB* getSensitiveAABB(int x, int y, int z);
|
||||
virtual AABB getSensitiveAABB(int x, int y, int z);
|
||||
|
||||
public:
|
||||
virtual void onRemove(Level* level, int x, int y, int z, int id, int data);
|
||||
|
|
@ -56,4 +56,4 @@ protected:
|
|||
|
||||
public:
|
||||
virtual void registerIcons(IconRegister* iconRegister);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "../Headers/net.minecraft.world.level.h"
|
||||
#include "../Headers/net.minecraft.world.h"
|
||||
#include "BaseRailTile.h"
|
||||
#include <optional>
|
||||
|
||||
BaseRailTile::Rail::Rail(Level* level, int x, int y, int z) {
|
||||
this->level = level;
|
||||
|
|
@ -311,7 +312,7 @@ BaseRailTile::BaseRailTile(int id, bool usesDataBit)
|
|||
|
||||
bool BaseRailTile::isUsesDataBit() { return usesDataBit; }
|
||||
|
||||
AABB* BaseRailTile::getAABB(Level* level, int x, int y, int z) { return NULL; }
|
||||
std::optional<AABB> BaseRailTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; }
|
||||
|
||||
bool BaseRailTile::blocksLight() { return false; }
|
||||
|
||||
|
|
@ -415,4 +416,4 @@ void BaseRailTile::onRemove(Level* level, int x, int y, int z, int id,
|
|||
level->updateNeighborsAt(x, y, z, id);
|
||||
level->updateNeighborsAt(x, y - 1, z, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public:
|
|||
using Tile::getResourceCount;
|
||||
|
||||
bool isUsesDataBit();
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual bool blocksLight();
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual HitResult* clip(Level* level, int xt, int yt, int zt, Vec3* a,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "../Headers/net.minecraft.world.phys.h"
|
||||
#include "../Headers/net.minecraft.h"
|
||||
#include "ButtonTile.h"
|
||||
#include <optional>
|
||||
#include "../Util/SoundTypes.h"
|
||||
|
||||
ButtonTile::ButtonTile(int id, bool sensitive)
|
||||
|
|
@ -20,7 +21,7 @@ Icon* ButtonTile::getTexture(int face, int data) {
|
|||
return Tile::stone->getTexture(Facing::UP);
|
||||
}
|
||||
|
||||
AABB* ButtonTile::getAABB(Level* level, int x, int y, int z) { return NULL; }
|
||||
std::optional<AABB> ButtonTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; }
|
||||
|
||||
int ButtonTile::getTickDelay(Level* level) { return sensitive ? 30 : 20; }
|
||||
|
||||
|
|
@ -261,9 +262,12 @@ void ButtonTile::checkPressed(Level* level, int x, int y, int z) {
|
|||
|
||||
updateShape(data);
|
||||
Tile::ThreadStorage* tls = m_tlsShape;
|
||||
std::vector<std::shared_ptr<Entity> >* entities = level->getEntitiesOfClass(
|
||||
typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0,
|
||||
x + tls->xx1, y + tls->yy1, z + tls->zz1));
|
||||
AABB arrow_aabb{
|
||||
x + tls->xx0, y + tls->yy0, z + tls->zz0,
|
||||
x + tls->xx1, y + tls->yy1, z + tls->zz1,
|
||||
};
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
level->getEntitiesOfClass(typeid(Arrow), &arrow_aabb);
|
||||
shouldBePressed = !entities->empty();
|
||||
delete entities;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ protected:
|
|||
|
||||
public:
|
||||
Icon* getTexture(int face, int data);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual int getTickDelay(Level* level);
|
||||
virtual bool blocksLight();
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
|
|
@ -74,4 +74,4 @@ public:
|
|||
// 4J Added so we can check before we try to add a tile to the tick list if
|
||||
// it's actually going to do seomthing
|
||||
virtual bool shouldTileTick(Level* level, int x, int y, int z);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ void CactusTile::tick(Level* level, int x, int y, int z, Random* random) {
|
|||
}
|
||||
}
|
||||
|
||||
AABB* CactusTile::getAABB(Level* level, int x, int y, int z) {
|
||||
std::optional<AABB> CactusTile::getAABB(Level* level, int x, int y, int z) {
|
||||
float r = 1 / 16.0f;
|
||||
return AABB::newTemp(x + r, y, z + r, x + 1 - r, y + 1 - r, z + 1 - r);
|
||||
return AABB{x + r, static_cast<double>(y), z + r, x + 1 - r, y + 1 - r, z + 1 - r};
|
||||
}
|
||||
|
||||
AABB* CactusTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
AABB CactusTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
float r = 1 / 16.0f;
|
||||
return AABB::newTemp(x + r, y, z + r, x + 1 - r, y + 1, z + 1 - r);
|
||||
return AABB(x + r, y, z + r, x + 1 - r, y + 1, z + 1 - r);
|
||||
}
|
||||
|
||||
Icon* CactusTile::getTexture(int face, int data) {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ protected:
|
|||
|
||||
public:
|
||||
virtual void tick(Level* level, int x, int y, int z, Random* random);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB* getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual Icon* getTexture(int face, int data);
|
||||
virtual bool isCubeShaped();
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
|
|
@ -37,4 +37,4 @@ public:
|
|||
// 4J Added so we can check before we try to add a tile to the tick list if
|
||||
// it's actually going to do seomthing
|
||||
virtual bool shouldTileTick(Level* level, int x, int y, int z);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,20 +34,20 @@ void CakeTile::updateDefaultShape() {
|
|||
this->setShape(r, 0, r, 1 - r, h, 1 - r);
|
||||
}
|
||||
|
||||
AABB* CakeTile::getAABB(Level* level, int x, int y, int z) {
|
||||
std::optional<AABB> CakeTile::getAABB(Level* level, int x, int y, int z) {
|
||||
int d = level->getData(x, y, z);
|
||||
float r = 1 / 16.0f;
|
||||
float r2 = (1 + d * 2) / 16.0f;
|
||||
float h = 8 / 16.0f;
|
||||
return AABB::newTemp(x + r2, y, z + r, x + 1 - r, y + h - r, z + 1 - r);
|
||||
return AABB{x + r2, static_cast<double>(y), z + r, x + 1 - r, y + h - r, z + 1 - r};
|
||||
}
|
||||
|
||||
AABB* CakeTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
AABB CakeTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
int d = level->getData(x, y, z);
|
||||
float r = 1 / 16.0f;
|
||||
float r2 = (1 + d * 2) / 16.0f;
|
||||
float h = 8 / 16.0f;
|
||||
return AABB::newTemp(x + r2, y, z + r, x + 1 - r, y + h, z + 1 - r);
|
||||
return AABB(x + r2, y, z + r, x + 1 - r, y + h, z + 1 - r);
|
||||
}
|
||||
|
||||
Icon* CakeTile::getTexture(int face, int data) {
|
||||
|
|
@ -124,4 +124,4 @@ int CakeTile::getResource(int data, Random* random, int playerBonusLevel) {
|
|||
|
||||
int CakeTile::cloneTileId(Level* level, int x, int y, int z) {
|
||||
return Item::cake_Id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ protected:
|
|||
std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<
|
||||
TileEntity>()); // 4J added forceData, forceEntity param
|
||||
virtual void updateDefaultShape();
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB* getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual Icon* getTexture(int face, int data);
|
||||
//@Override
|
||||
void registerIcons(IconRegister* iconRegister);
|
||||
|
|
@ -49,4 +49,4 @@ public:
|
|||
virtual int getResourceCount(Random* random);
|
||||
virtual int getResource(int data, Random* random, int playerBonusLevel);
|
||||
int cloneTileId(Level* level, int x, int y, int z);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -345,8 +345,9 @@ int ChestTile::getDirectSignal(LevelSource* level, int x, int y, int z,
|
|||
}
|
||||
|
||||
bool ChestTile::isCatSittingOnChest(Level* level, int x, int y, int z) {
|
||||
std::vector<std::shared_ptr<Entity> >* entities = level->getEntitiesOfClass(
|
||||
typeid(Ocelot), AABB::newTemp(x, y + 1, z, x + 1, y + 2, z + 1));
|
||||
AABB ocelot_aabb(x, y + 1, z, x + 1, y + 2, z + 1);
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
level->getEntitiesOfClass(typeid(Ocelot), &ocelot_aabb);
|
||||
for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) {
|
||||
std::shared_ptr<Ocelot> ocelot = std::dynamic_pointer_cast<Ocelot>(*it);
|
||||
if (ocelot->isSitting()) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "../Headers/net.minecraft.world.h"
|
||||
#include "../Headers/net.minecraft.h"
|
||||
#include "CocoaTile.h"
|
||||
#include "Util/AABB.h"
|
||||
|
||||
const std::wstring CocoaTile::TEXTURE_AGES[] = {L"cocoa_0", L"cocoa_1",
|
||||
L"cocoa_2"};
|
||||
|
|
@ -56,12 +57,12 @@ bool CocoaTile::isCubeShaped() { return false; }
|
|||
|
||||
bool CocoaTile::isSolidRender(bool isServerLevel) { return false; }
|
||||
|
||||
AABB* CocoaTile::getAABB(Level* level, int x, int y, int z) {
|
||||
std::optional<AABB> CocoaTile::getAABB(Level* level, int x, int y, int z) {
|
||||
updateShape(level, x, y, z);
|
||||
return DirectionalTile::getAABB(level, x, y, z);
|
||||
}
|
||||
|
||||
AABB* CocoaTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
AABB CocoaTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
updateShape(level, x, y, z);
|
||||
return DirectionalTile::getTileAABB(level, x, y, z);
|
||||
}
|
||||
|
|
@ -157,4 +158,4 @@ void CocoaTile::registerIcons(IconRegister* iconRegister) {
|
|||
for (int i = 0; i < COCOA_TEXTURES_LENGTH; i++) {
|
||||
icons[i] = iconRegister->registerIcon(TEXTURE_AGES[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ public:
|
|||
virtual int getRenderShape();
|
||||
virtual bool isCubeShaped();
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB* getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual void updateShape(LevelSource* level, int x, int y, int z,
|
||||
int forceData = -1,
|
||||
std::shared_ptr<TileEntity> forceEntity =
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ void DetectorRailTile::checkPressed(Level* level, int x, int y, int z,
|
|||
bool shouldBePressed = false;
|
||||
|
||||
float b = 2 / 16.0f;
|
||||
std::vector<std::shared_ptr<Entity> >* entities = level->getEntitiesOfClass(
|
||||
typeid(Minecart),
|
||||
AABB::newTemp(x + b, y, z + b, x + 1 - b, y + 1 - b, z + 1 - b));
|
||||
AABB minecart_aabb(x + b, y, z + b, x + b - b, y + b - b, z + 1 - b);
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
level->getEntitiesOfClass(typeid(Minecart), &minecart_aabb);
|
||||
if (!entities->empty()) {
|
||||
shouldBePressed = true;
|
||||
}
|
||||
|
|
@ -105,10 +105,10 @@ int DetectorRailTile::getAnalogOutputSignal(Level* level, int x, int y, int z,
|
|||
int dir) {
|
||||
if ((level->getData(x, y, z) & RAIL_DATA_BIT) > 0) {
|
||||
float b = 2 / 16.0f;
|
||||
AABB minecart_bb(x + b, y, z + b, x + 1 - b, y + 1 - b, z + 1 - b);
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
level->getEntitiesOfClass(
|
||||
typeid(Minecart),
|
||||
AABB::newTemp(x + b, y, z + b, x + 1 - b, y + 1 - b, z + 1 - b),
|
||||
typeid(Minecart), &minecart_bb,
|
||||
EntitySelector::CONTAINER_ENTITY_SELECTOR);
|
||||
|
||||
if (entities->size() > 0) {
|
||||
|
|
@ -133,4 +133,4 @@ Icon* DetectorRailTile::getTexture(int face, int data) {
|
|||
return icons[1];
|
||||
}
|
||||
return icons[0];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,16 +85,14 @@ bool DoorTile::isCubeShaped() { return false; }
|
|||
|
||||
int DoorTile::getRenderShape() { return Tile::SHAPE_DOOR; }
|
||||
|
||||
AABB* DoorTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
AABB DoorTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
updateShape(level, x, y, z);
|
||||
AABB* retval = Tile::getTileAABB(level, x, y, z);
|
||||
return retval;
|
||||
return Tile::getTileAABB(level, x, y, z);
|
||||
}
|
||||
|
||||
AABB* DoorTile::getAABB(Level* level, int x, int y, int z) {
|
||||
std::optional<AABB> DoorTile::getAABB(Level* level, int x, int y, int z) {
|
||||
updateShape(level, x, y, z);
|
||||
AABB* retval = Tile::getAABB(level, x, y, z);
|
||||
return retval;
|
||||
return Tile::getAABB(level, x, y, z);
|
||||
}
|
||||
|
||||
void DoorTile::updateShape(
|
||||
|
|
@ -307,4 +305,4 @@ void DoorTile::playerWillDestroy(Level* level, int x, int y, int z, int data,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ public:
|
|||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool isCubeShaped();
|
||||
virtual int getRenderShape();
|
||||
virtual AABB* getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual void updateShape(
|
||||
LevelSource* level, int x, int y, int z, int forceData = -1,
|
||||
std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ void FallingTile::causeFallDamage(float distance) {
|
|||
// entities (invalidating our iterator)
|
||||
std::vector<std::shared_ptr<Entity> >* entities =
|
||||
new std::vector<std::shared_ptr<Entity> >(
|
||||
*level->getEntities(shared_from_this(), bb));
|
||||
*level->getEntities(shared_from_this(), &bb));
|
||||
DamageSource* source = tile == Tile::anvil_Id
|
||||
? DamageSource::anvil
|
||||
: DamageSource::fallingBlock;
|
||||
|
|
@ -242,4 +242,4 @@ Level* FallingTile::getLevel() { return level; }
|
|||
|
||||
void FallingTile::setHurtsEntities(bool value) { this->hurtEntities = value; }
|
||||
|
||||
bool FallingTile::displayFireAnimation() { return false; }
|
||||
bool FallingTile::displayFireAnimation() { return false; }
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ FarmTile::FarmTile(int id) : Tile(id, Material::dirt, false) {
|
|||
// 4J Added override
|
||||
void FarmTile::updateDefaultShape() { setShape(0, 0, 0, 1, 15 / 16.0f, 1); }
|
||||
|
||||
AABB* FarmTile::getAABB(Level* level, int x, int y, int z) {
|
||||
return AABB::newTemp(x + 0, y + 0, z + 0, x + 1, y + 1, z + 1);
|
||||
std::optional<AABB> FarmTile::getAABB(Level* level, int x, int y, int z) {
|
||||
return AABB(x + 0, y + 0, z + 0, x + 1, y + 1, z + 1);
|
||||
}
|
||||
|
||||
bool FarmTile::isSolidRender(bool isServerLevel) { return false; }
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ protected:
|
|||
|
||||
public:
|
||||
virtual void updateDefaultShape(); // 4J Added override
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool isCubeShaped();
|
||||
virtual Icon* getTexture(int face, int data);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "../Headers/net.minecraft.world.level.h"
|
||||
#include "../Headers/net.minecraft.h"
|
||||
#include "../Level/Events/LevelEvent.h"
|
||||
#include "Util/Direction.h"
|
||||
|
||||
FenceGateTile::FenceGateTile(int id)
|
||||
: DirectionalTile(id, Material::wood, false) {}
|
||||
|
|
@ -17,19 +18,29 @@ bool FenceGateTile::mayPlace(Level* level, int x, int y, int z) {
|
|||
return Tile::mayPlace(level, x, y, z);
|
||||
}
|
||||
|
||||
AABB* FenceGateTile::getAABB(Level* level, int x, int y, int z) {
|
||||
std::optional<AABB> FenceGateTile::getAABB(Level* level, int x, int y, int z) {
|
||||
int data = level->getData(x, y, z);
|
||||
if (isOpen(data)) {
|
||||
return NULL;
|
||||
return std::nullopt;
|
||||
}
|
||||
// 4J Brought forward change from 1.2.3 to fix hit box rotation
|
||||
if (data == Direction::NORTH || data == Direction::SOUTH) {
|
||||
return AABB::newTemp(x, y, z + 6.0f / 16.0f, x + 1, y + 1.5f,
|
||||
z + 10.0f / 16.0f);
|
||||
|
||||
switch (data) {
|
||||
case Direction::NORTH:
|
||||
case Direction::SOUTH:
|
||||
return AABB{static_cast<double>(x),
|
||||
static_cast<double>(y),
|
||||
z + 6.0 / 16.0,
|
||||
x + 1.0,
|
||||
y + 1.5,
|
||||
z + 10.0 / 16.0};
|
||||
default:
|
||||
return AABB{x + 6.0 / 16.0,
|
||||
static_cast<double>(y),
|
||||
static_cast<double>(z),
|
||||
x + 10.0 / 16.0,
|
||||
y + 1.5,
|
||||
z + 1.0};
|
||||
}
|
||||
return AABB::newTemp(x + 6.0f / 16.0f, y, z, x + 10.0f / 16.0f, y + 1.5f,
|
||||
z + 1);
|
||||
// return AABB::newTemp(x, y, z, x + 1, y + 1.5f, z + 1);
|
||||
}
|
||||
|
||||
// 4J - Brought forward from 1.2.3 to fix hit box rotation
|
||||
|
|
@ -123,4 +134,4 @@ void FenceGateTile::registerIcons(IconRegister* iconRegister) {
|
|||
bool FenceGateTile::shouldRenderFace(LevelSource* level, int x, int y, int z,
|
||||
int face) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public:
|
|||
FenceGateTile(int id);
|
||||
Icon* getTexture(int face, int data);
|
||||
virtual bool mayPlace(Level* level, int x, int y, int z);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual void updateShape(
|
||||
LevelSource* level, int x, int y, int z, int forceData = -1,
|
||||
std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "../Util/SoundTypes.h"
|
||||
#include "../../Minecraft.Client/MinecraftServer.h"
|
||||
#include "../../Minecraft.Client/Network/PlayerList.h"
|
||||
#include "Util/AABB.h"
|
||||
|
||||
// AP - added for Vita to set Alpha Cut out
|
||||
#include "../IO/Streams/IntBuffer.h"
|
||||
|
|
@ -57,7 +58,7 @@ void FireTile::setFlammable(int id, int flame, int burn) {
|
|||
burnOdds[id] = burn;
|
||||
}
|
||||
|
||||
AABB* FireTile::getAABB(Level* level, int x, int y, int z) { return NULL; }
|
||||
std::optional<AABB> FireTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; }
|
||||
|
||||
bool FireTile::blocksLight() { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ private:
|
|||
void setFlammable(int id, int flame, int burn);
|
||||
|
||||
public:
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual bool blocksLight();
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool isCubeShaped();
|
||||
|
|
@ -69,4 +69,4 @@ public:
|
|||
void registerIcons(IconRegister* iconRegister);
|
||||
Icon* getTextureLayer(int layer);
|
||||
Icon* getTexture(int face, int data);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include "../Headers/net.minecraft.world.level.h"
|
||||
#include "LadderTile.h"
|
||||
#include "Util/AABB.h"
|
||||
|
||||
LadderTile::LadderTile(int id)
|
||||
: Tile(id, Material::decoration, false) {}
|
||||
|
||||
AABB* LadderTile::getAABB(Level* level, int x, int y, int z) {
|
||||
std::optional<AABB> LadderTile::getAABB(Level* level, int x, int y, int z) {
|
||||
updateShape(level, x, y, z);
|
||||
return Tile::getAABB(level, x, y, z);
|
||||
}
|
||||
|
||||
AABB* LadderTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
AABB LadderTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
updateShape(level, x, y, z);
|
||||
return Tile::getTileAABB(level, x, y, z);
|
||||
}
|
||||
|
|
@ -87,4 +88,4 @@ void LadderTile::neighborChanged(Level* level, int x, int y, int z, int type) {
|
|||
Tile::neighborChanged(level, x, y, z, type);
|
||||
}
|
||||
|
||||
int LadderTile::getResourceCount(Random* random) { return 1; }
|
||||
int LadderTile::getResourceCount(Random* random) { return 1; }
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ protected:
|
|||
LadderTile(int id);
|
||||
|
||||
public:
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB* getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual AABB getTileAABB(Level* level, int x, int y, int z);
|
||||
virtual void updateShape(
|
||||
LevelSource* level, int x, int y, int z, int forceData = -1,
|
||||
std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<
|
||||
|
|
@ -29,4 +29,4 @@ public:
|
|||
float clickZ, int itemValue);
|
||||
virtual void neighborChanged(Level* level, int x, int y, int z, int type);
|
||||
virtual int getResourceCount(Random* random);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
#include "../Headers/net.minecraft.world.level.redstone.h"
|
||||
#include "../Headers/net.minecraft.h"
|
||||
#include "LeverTile.h"
|
||||
#include "Util/AABB.h"
|
||||
|
||||
LeverTile::LeverTile(int id)
|
||||
: Tile(id, Material::decoration, false) {}
|
||||
|
||||
AABB* LeverTile::getAABB(Level* level, int x, int y, int z) { return NULL; }
|
||||
std::optional<AABB> LeverTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; }
|
||||
|
||||
bool LeverTile::blocksLight() { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ protected:
|
|||
LeverTile(int id);
|
||||
|
||||
public:
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual bool blocksLight();
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool isCubeShaped();
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@
|
|||
#include "../Headers/net.minecraft.world.level.biome.h"
|
||||
#include "../Headers/net.minecraft.world.h"
|
||||
#include "LiquidTile.h"
|
||||
#include <cstddef>
|
||||
#include "../Util/Facing.h"
|
||||
#include "../Util/SoundTypes.h"
|
||||
#include "Blocks/Material.h"
|
||||
#include "Util/AABB.h"
|
||||
|
||||
const std::wstring LiquidTile::TEXTURE_LAVA_STILL = L"lava";
|
||||
const std::wstring LiquidTile::TEXTURE_WATER_STILL = L"water";
|
||||
|
|
@ -107,7 +109,9 @@ bool LiquidTile::shouldRenderFace(LevelSource* level, int x, int y, int z,
|
|||
return Tile::shouldRenderFace(level, x, y, z, face);
|
||||
}
|
||||
|
||||
AABB* LiquidTile::getAABB(Level* level, int x, int y, int z) { return NULL; }
|
||||
std::optional<AABB> LiquidTile::getAABB(Level* level, int x, int y, int z) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
int LiquidTile::getRenderShape() { return Tile::SHAPE_WATER; }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <optional>
|
||||
#include "Tile.h"
|
||||
#include "../Util/Definitions.h"
|
||||
|
||||
|
|
@ -40,7 +41,7 @@ public:
|
|||
virtual bool isSolidFace(LevelSource* level, int x, int y, int z, int face);
|
||||
virtual bool shouldRenderFace(LevelSource* level, int x, int y, int z,
|
||||
int face);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual int getRenderShape();
|
||||
virtual int getResource(int data, Random* random, int playerBonusLevel);
|
||||
virtual int getResourceCount(Random* random);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include "PistonBaseTile.h"
|
||||
#include "PistonMovingTileEntity.h"
|
||||
#include "TileEntities/PistonPieceTileEntity.h"
|
||||
|
|
@ -12,6 +13,8 @@
|
|||
#include "../Level/LevelChunk.h"
|
||||
#include "../Level/Dimensions/Dimension.h"
|
||||
|
||||
#include "Util/AABB.h"
|
||||
|
||||
const std::wstring PistonBaseTile::EDGE_TEX = L"piston_side";
|
||||
const std::wstring PistonBaseTile::PLATFORM_TEX = L"piston_top";
|
||||
const std::wstring PistonBaseTile::PLATFORM_STICKY_TEX = L"piston_top_sticky";
|
||||
|
|
@ -398,7 +401,7 @@ void PistonBaseTile::addAABBs(Level* level, int x, int y, int z, AABB* box,
|
|||
Tile::addAABBs(level, x, y, z, box, boxes, source);
|
||||
}
|
||||
|
||||
AABB* PistonBaseTile::getAABB(Level* level, int x, int y, int z) {
|
||||
std::optional<AABB> PistonBaseTile::getAABB(Level* level, int x, int y, int z) {
|
||||
updateShape(level, x, y, z);
|
||||
return Tile::getAABB(level, x, y, z);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include "Tile.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
class PistonBaseTile : public Tile {
|
||||
public:
|
||||
|
|
@ -68,7 +69,7 @@ public:
|
|||
virtual void updateDefaultShape();
|
||||
virtual void addAABBs(Level* level, int x, int y, int z, AABB* box,
|
||||
AABBList* boxes, std::shared_ptr<Entity> source);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual bool isCubeShaped();
|
||||
|
||||
static int getFacing(int data);
|
||||
|
|
@ -84,4 +85,4 @@ private:
|
|||
int z); // 4J added
|
||||
|
||||
bool createPush(Level* level, int sx, int sy, int sz, int facing);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include "PistonMovingTileEntity.h"
|
||||
#include <optional>
|
||||
#include "TileEntities/PistonPieceTileEntity.h"
|
||||
#include "../Headers/net.minecraft.world.level.h"
|
||||
#include "../Headers/net.minecraft.world.h"
|
||||
|
|
@ -91,10 +92,11 @@ std::shared_ptr<TileEntity> PistonMovingPiece::newMovingPieceEntity(
|
|||
new PistonPieceEntity(block, data, facing, extending, isSourcePiston));
|
||||
}
|
||||
|
||||
AABB* PistonMovingPiece::getAABB(Level* level, int x, int y, int z) {
|
||||
std::optional<AABB> PistonMovingPiece::getAABB(Level* level, int x, int y,
|
||||
int z) {
|
||||
std::shared_ptr<PistonPieceEntity> entity = getEntity(level, x, y, z);
|
||||
if (entity == NULL) {
|
||||
return NULL;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// move the aabb depending on the animation
|
||||
|
|
@ -136,15 +138,16 @@ void PistonMovingPiece::updateShape(
|
|||
}
|
||||
}
|
||||
|
||||
AABB* PistonMovingPiece::getAABB(Level* level, int x, int y, int z, int tile,
|
||||
float progress, int facing) {
|
||||
std::optional<AABB> PistonMovingPiece::getAABB(Level* level, int x, int y,
|
||||
int z, int tile, float progress,
|
||||
int facing) {
|
||||
if (tile == 0 || tile == id) {
|
||||
return NULL;
|
||||
return std::nullopt;
|
||||
}
|
||||
AABB* aabb = Tile::tiles[tile]->getAABB(level, x, y, z);
|
||||
auto aabb = Tile::tiles[tile]->getAABB(level, x, y, z);
|
||||
|
||||
if (aabb == NULL) {
|
||||
return NULL;
|
||||
if (!aabb.has_value()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// move the aabb depending on the animation
|
||||
|
|
@ -153,16 +156,19 @@ AABB* PistonMovingPiece::getAABB(Level* level, int x, int y, int z, int tile,
|
|||
} else {
|
||||
aabb->x1 -= Facing::STEP_X[facing] * progress;
|
||||
}
|
||||
|
||||
if (Facing::STEP_Y[facing] < 0) {
|
||||
aabb->y0 -= Facing::STEP_Y[facing] * progress;
|
||||
} else {
|
||||
aabb->y1 -= Facing::STEP_Y[facing] * progress;
|
||||
}
|
||||
|
||||
if (Facing::STEP_Z[facing] < 0) {
|
||||
aabb->z0 -= Facing::STEP_Z[facing] * progress;
|
||||
} else {
|
||||
aabb->z1 -= Facing::STEP_Z[facing] * progress;
|
||||
}
|
||||
|
||||
return aabb;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ public:
|
|||
virtual void neighborChanged(Level* level, int x, int y, int z, int type);
|
||||
static std::shared_ptr<TileEntity> newMovingPieceEntity(
|
||||
int block, int data, int facing, bool extending, bool isSourcePiston);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual void updateShape(
|
||||
LevelSource* level, int x, int y, int z, int forceData = -1,
|
||||
std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<
|
||||
TileEntity>()); // 4J added forceData, forceEntity param
|
||||
|
||||
AABB* getAABB(Level* level, int x, int y, int z, int tile, float progress,
|
||||
std::optional<AABB> getAABB(Level* level, int x, int y, int z, int tile, float progress,
|
||||
int facing);
|
||||
|
||||
private:
|
||||
|
|
@ -44,4 +44,4 @@ private:
|
|||
public:
|
||||
virtual int cloneTileId(Level* level, int x, int y, int z);
|
||||
void registerIcons(IconRegister* iconRegister);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "../Headers/net.minecraft.world.level.h"
|
||||
#include "GrassTile.h"
|
||||
#include "PlantTile.h"
|
||||
#include "Util/AABB.h"
|
||||
|
||||
void Bush::_init() {
|
||||
setTicking(true);
|
||||
|
|
@ -52,7 +53,7 @@ bool Bush::canSurvive(Level* level, int x, int y, int z) {
|
|||
mayPlaceOn(level->getTile(x, y - 1, z));
|
||||
}
|
||||
|
||||
AABB* Bush::getAABB(Level* level, int x, int y, int z) { return NULL; }
|
||||
std::optional<AABB> Bush::getAABB(Level* level, int x, int y, int z) { return std::nullopt; }
|
||||
|
||||
bool Bush::blocksLight() { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ protected:
|
|||
|
||||
public:
|
||||
virtual bool canSurvive(Level* level, int x, int y, int z);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual bool blocksLight();
|
||||
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
#include "../Headers/net.minecraft.world.level.dimension.h"
|
||||
#include "../Headers/net.minecraft.world.item.h"
|
||||
#include "PortalTile.h"
|
||||
#include <optional>
|
||||
|
||||
#include "Util/AABB.h"
|
||||
#include "FireTile.h"
|
||||
|
||||
PortalTile::PortalTile(int id)
|
||||
|
|
@ -34,7 +37,7 @@ void PortalTile::tick(Level* level, int x, int y, int z, Random* random) {
|
|||
}
|
||||
}
|
||||
|
||||
AABB* PortalTile::getAABB(Level* level, int x, int y, int z) { return NULL; }
|
||||
std::optional<AABB> PortalTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; }
|
||||
|
||||
void PortalTile::updateShape(
|
||||
LevelSource* level, int x, int y, int z, int forceData,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <optional>
|
||||
#include "HalfTransparentTile.h"
|
||||
#include "../Util/Definitions.h"
|
||||
|
||||
|
|
@ -8,7 +9,7 @@ class PortalTile : public HalfTransparentTile {
|
|||
public:
|
||||
PortalTile(int id);
|
||||
virtual void tick(Level* level, int x, int y, int z, Random* random);
|
||||
virtual AABB* getAABB(Level* level, int x, int y, int z);
|
||||
virtual std::optional<AABB> getAABB(Level* level, int x, int y, int z);
|
||||
virtual void updateShape(
|
||||
LevelSource* level, int x, int y, int z, int forceData = -1,
|
||||
std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "../Headers/net.minecraft.world.level.h"
|
||||
#include "../Headers/net.minecraft.world.level.redstone.h"
|
||||
#include "PressurePlateTile.h"
|
||||
#include "Util/AABB.h"
|
||||
|
||||
PressurePlateTile::PressurePlateTile(int id, const std::wstring& tex,
|
||||
Material* material,
|
||||
|
|
@ -23,15 +24,13 @@ int PressurePlateTile::getSignalForData(int data) {
|
|||
|
||||
int PressurePlateTile::getSignalStrength(Level* level, int x, int y, int z) {
|
||||
std::vector<std::shared_ptr<Entity> >* entities = NULL;
|
||||
|
||||
AABB at_bb = getSensitiveAABB(x, y, z);
|
||||
if (sensitivity == everything)
|
||||
entities = level->getEntities(nullptr, getSensitiveAABB(x, y, z));
|
||||
entities = level->getEntities(nullptr, &at_bb);
|
||||
else if (sensitivity == mobs)
|
||||
entities = level->getEntitiesOfClass(typeid(LivingEntity),
|
||||
getSensitiveAABB(x, y, z));
|
||||
entities = level->getEntitiesOfClass(typeid(LivingEntity), &at_bb);
|
||||
else if (sensitivity == players)
|
||||
entities = level->getEntitiesOfClass(typeid(Player),
|
||||
getSensitiveAABB(x, y, z));
|
||||
entities = level->getEntitiesOfClass(typeid(Player), &at_bb);
|
||||
else
|
||||
__debugbreak(); // 4J-JEV: We're going to delete something at a random
|
||||
// location.
|
||||
|
|
@ -48,4 +47,4 @@ int PressurePlateTile::getSignalStrength(Level* level, int x, int y, int z) {
|
|||
|
||||
if (sensitivity != everything) delete entities;
|
||||
return Redstone::SIGNAL_NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include "../../Minecraft.Client/Minecraft.h"
|
||||
#include "RedStoneDustTile.h"
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include "../Headers/net.minecraft.world.item.h"
|
||||
#include "../Headers/net.minecraft.world.level.h"
|
||||
#include "../Headers/net.minecraft.world.level.redstone.h"
|
||||
|
|
@ -9,6 +11,7 @@
|
|||
#include "../Headers/net.minecraft.h"
|
||||
#include "../Util/Direction.h"
|
||||
#include "DiodeTile.h"
|
||||
#include "Util/AABB.h"
|
||||
|
||||
// AP - added for Vita to set Alpha Cut out
|
||||
#include "../IO/Streams/IntBuffer.h"
|
||||
|
|
@ -36,8 +39,9 @@ void RedStoneDustTile::updateDefaultShape() {
|
|||
setShape(0, 0, 0, 1, 1 / 16.0f, 1);
|
||||
}
|
||||
|
||||
AABB* RedStoneDustTile::getAABB(Level* level, int x, int y, int z) {
|
||||
return NULL;
|
||||
std::optional<AABB> RedStoneDustTile::getAABB(Level* level, int x, int y,
|
||||
int z) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool RedStoneDustTile::isSolidRender(bool isServerLevel) { return false; }
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue