mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-11 02:24:13 +00:00
TU19: merge Minecraft.World/Level
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include "../Platform/stdafx.h"
|
||||
|
||||
#include "../Headers/net.minecraft.world.level.tile.h"
|
||||
#include "TickNextTickData.h"
|
||||
|
||||
__int64 TickNextTickData::C = 0;
|
||||
int64_t TickNextTickData::C = 0;
|
||||
|
||||
TickNextTickData::TickNextTickData(int x, int y, int z, int tileId) {
|
||||
m_delay = 0;
|
||||
@@ -12,38 +12,47 @@ TickNextTickData::TickNextTickData(int x, int y, int z, int tileId) {
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
this->tileId = tileId;
|
||||
priorityTilt = 0;
|
||||
}
|
||||
|
||||
bool TickNextTickData::equals(const void* o) const {
|
||||
bool TickNextTickData::equals(const TickNextTickData* o) const {
|
||||
// TODO 4J Is this safe to cast it before we do a dynamic_cast? Will the
|
||||
// dynamic_cast still fail? We cannot dynamic_cast a void*
|
||||
if (dynamic_cast<TickNextTickData*>((TickNextTickData*)o) != NULL) {
|
||||
if (o != NULL) {
|
||||
TickNextTickData* t = (TickNextTickData*)o;
|
||||
return x == t->x && y == t->y && z == t->z && tileId == t->tileId;
|
||||
return x == t->x && y == t->y && z == t->z &&
|
||||
Tile::isMatching(tileId, t->tileId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int TickNextTickData::hashCode() const {
|
||||
// 4jcraft added cast to unsigned
|
||||
return ((((unsigned)x * 1024 * 1024) + ((unsigned)z * 1024) + (unsigned)y) *
|
||||
256) +
|
||||
tileId;
|
||||
return (((x * 1024 * 1024) + (z * 1024) + y) * 256);
|
||||
}
|
||||
|
||||
TickNextTickData* TickNextTickData::delay(__int64 l) {
|
||||
this->m_delay = l;
|
||||
TickNextTickData* TickNextTickData::delay(int64_t l) {
|
||||
m_delay = l;
|
||||
return this;
|
||||
}
|
||||
|
||||
void TickNextTickData::setPriorityTilt(int priorityTilt) {
|
||||
this->priorityTilt = priorityTilt;
|
||||
}
|
||||
|
||||
int TickNextTickData::compareTo(const TickNextTickData* tnd) const {
|
||||
if (m_delay < tnd->m_delay) return -1;
|
||||
if (m_delay > tnd->m_delay) return 1;
|
||||
if (priorityTilt != tnd->priorityTilt)
|
||||
return priorityTilt - tnd->priorityTilt;
|
||||
if (c < tnd->c) return -1;
|
||||
if (c > tnd->c) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TickNextTickData::operator==(const TickNextTickData& k) {
|
||||
return equals(&k);
|
||||
}
|
||||
|
||||
// A class that takes two arguments of the same type as the container elements
|
||||
// and returns a bool. The expression comp(a,b), where comp is an object of this
|
||||
// comparison class and a and b are elements of the container, shall return true
|
||||
@@ -62,6 +71,5 @@ int TickNextTickData::hash_fnct(const TickNextTickData& k) {
|
||||
|
||||
bool TickNextTickData::eq_test(const TickNextTickData& x,
|
||||
const TickNextTickData& y) {
|
||||
return (x.x == y.x) && (x.y == y.y) && (x.z == y.z) &&
|
||||
(x.tileId == y.tileId);
|
||||
}
|
||||
return x.equals(&y);
|
||||
}
|
||||
Reference in New Issue
Block a user