the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 81 lines 2.2 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.tile.h" 3#include "TickNextTickData.h" 4 5int64_t TickNextTickData::C = 0; 6 7TickNextTickData::TickNextTickData(int x, int y, int z, int tileId) 8{ 9 m_delay = 0; 10 c = C++; 11 12 this->x = x; 13 this->y = y; 14 this->z = z; 15 this->tileId = tileId; 16 priorityTilt = 0; 17} 18 19 20bool TickNextTickData::equals(const TickNextTickData *o) const 21{ 22 // TODO 4J Is this safe to cast it before we do a dynamic_cast? Will the dynamic_cast still fail? 23 // We cannot dynamic_cast a void* 24 if ( o != NULL) 25 { 26 TickNextTickData *t = (TickNextTickData *) o; 27 return x == t->x && y == t->y && z == t->z && Tile::isMatching(tileId, t->tileId); 28 } 29 return false; 30} 31 32int TickNextTickData::hashCode() const 33{ 34 return (((x * 1024 * 1024) + (z * 1024) + y) * 256); 35} 36 37TickNextTickData *TickNextTickData::delay(int64_t l) 38{ 39 m_delay = l; 40 return this; 41} 42 43void TickNextTickData::setPriorityTilt(int priorityTilt) 44{ 45 this->priorityTilt = priorityTilt; 46} 47 48int TickNextTickData::compareTo(const TickNextTickData *tnd) const 49{ 50 if (m_delay < tnd->m_delay) return -1; 51 if (m_delay > tnd->m_delay) return 1; 52 if (priorityTilt != tnd->priorityTilt) return priorityTilt - tnd->priorityTilt; 53 if (c < tnd->c) return -1; 54 if (c > tnd->c) return 1; 55 return 0; 56} 57 58bool TickNextTickData::operator==(const TickNextTickData &k) 59{ 60 return equals( &k ); 61} 62 63//A class that takes two arguments of the same type as the container elements and returns a bool. 64//The expression comp(a,b), where comp is an object of this comparison class and a and b are elements of the container, 65//shall return true if a is to be placed at an earlier position than b in a strict weak ordering operation. 66//This can either be a class implementing a function call operator or a pointer to a function (see constructor for an example). 67//This defaults to less<Key>, which returns the same as applying the less-than operator (a<b). 68bool TickNextTickData::compare_fnct(const TickNextTickData &x, const TickNextTickData &y) 69{ 70 return x.compareTo( &y ) < 0; 71} 72 73int TickNextTickData::hash_fnct(const TickNextTickData &k) 74{ 75 return k.hashCode(); 76} 77 78bool TickNextTickData::eq_test(const TickNextTickData &x, const TickNextTickData &y) 79{ 80 return x.equals(&y); 81}