mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
No more extra logic in TrapDoorTile..
Going full Java parity. Ngl, having a different collision box was a cool idea but probably best for implementing new tiles.
This commit is contained in:
parent
464d6c7ec8
commit
d9ef6ab57b
|
|
@ -27,7 +27,7 @@ void LadderTile::updateShape(LevelSource *level, int x, int y, int z, int forceD
|
|||
void LadderTile::setShape(int data)
|
||||
{
|
||||
int dir = data;
|
||||
float r = 2 / 16.0f;
|
||||
float r = 3 / 16.0f;
|
||||
|
||||
if (dir == 2) setShape(0, 0, 1 - r, 1, 1, 1);
|
||||
if (dir == 3) setShape(0, 0, 0, 1, 1, r);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "net.minecraft.world.level.tile.h"
|
||||
#include "net.minecraft.h"
|
||||
#include "TrapDoorTile.h"
|
||||
#include "AABB.h"
|
||||
|
||||
TrapDoorTile::TrapDoorTile(int id, Material *material) : Tile(id, material,isSolidRender())
|
||||
{
|
||||
|
|
@ -51,31 +50,6 @@ AABB *TrapDoorTile::getTileAABB(Level *level, int x, int y, int z)
|
|||
AABB *TrapDoorTile::getAABB(Level *level, int x, int y, int z)
|
||||
{
|
||||
updateShape(level, x, y, z);
|
||||
int data = level->getData(x, y, z);
|
||||
if (isOpen(data))
|
||||
{
|
||||
int xt = x, zt = z;
|
||||
int dir = data & 3;
|
||||
|
||||
if (dir == 0) zt++;
|
||||
if (dir == 1) zt--;
|
||||
if (dir == 2) xt++;
|
||||
if (dir == 3) xt--;
|
||||
|
||||
if (level->getTile(x, y - 1, z) == Tile::ladder_Id && attachesTo(level->getTile(xt, y, zt)))
|
||||
{
|
||||
float r = 2 / 16.0f;
|
||||
|
||||
// Using only newTemp from AABB to just manipulate collision to our liking
|
||||
// I tried looking at AABB.cpp more but couldn't find any helper methods to make this more readable.
|
||||
// Though, I can just make new helpers but kinda scared because its not within the contributing scope.
|
||||
// SO IF ITS NOT ALLOWED, GOODLUCK UNDERSTANDING.
|
||||
if (dir == 0) return AABB::newTemp(x, y, z + 1 - r, x + 1, y + 1, z + 1);
|
||||
if (dir == 1) return AABB::newTemp(x, y, z, x + 1, y + 1, z + r);
|
||||
if (dir == 2) return AABB::newTemp(x + 1 - r, y, z, x + 1, y + 1, z + 1);
|
||||
if (dir == 3) return AABB::newTemp(x, y, z, x + r, y + 1, z + 1);
|
||||
}
|
||||
}
|
||||
return Tile::getAABB(level, x, y, z);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue