mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-03 14:26:28 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -16,128 +16,106 @@ import net.minecraft.world.level.*;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;*/
|
||||
|
||||
HalfSlabTile::HalfSlabTile(int id, bool fullSize, Material* material)
|
||||
: Tile(id, material, fullSize) {
|
||||
this->fullSize = fullSize;
|
||||
|
||||
|
||||
HalfSlabTile::HalfSlabTile(int id, bool fullSize, Material *material) : Tile(id, material, fullSize)
|
||||
{
|
||||
this->fullSize = fullSize;
|
||||
|
||||
if (fullSize)
|
||||
{
|
||||
solid[id] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(0, 0, 0, 1, 0.5f, 1);
|
||||
}
|
||||
setLightBlock(255);
|
||||
if (fullSize) {
|
||||
solid[id] = true;
|
||||
} else {
|
||||
setShape(0, 0, 0, 1, 0.5f, 1);
|
||||
}
|
||||
setLightBlock(255);
|
||||
}
|
||||
|
||||
void HalfSlabTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
|
||||
void HalfSlabTile::updateShape(
|
||||
LevelSource* level, int x, int y, int z, int forceData,
|
||||
std::shared_ptr<TileEntity>
|
||||
forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
if (fullSize)
|
||||
{
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool upper = (level->getData(x, y, z) & TOP_SLOT_BIT) != 0;
|
||||
if (upper)
|
||||
{
|
||||
setShape(0, 0.5f, 0, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(0, 0, 0, 1, 0.5f, 1);
|
||||
}
|
||||
}
|
||||
if (fullSize) {
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
} else {
|
||||
bool upper = (level->getData(x, y, z) & TOP_SLOT_BIT) != 0;
|
||||
if (upper) {
|
||||
setShape(0, 0.5f, 0, 1, 1, 1);
|
||||
} else {
|
||||
setShape(0, 0, 0, 1, 0.5f, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HalfSlabTile::updateDefaultShape()
|
||||
{
|
||||
if (fullSize)
|
||||
{
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(0, 0, 0, 1, 0.5f, 1);
|
||||
}
|
||||
void HalfSlabTile::updateDefaultShape() {
|
||||
if (fullSize) {
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
} else {
|
||||
setShape(0, 0, 0, 1, 0.5f, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void HalfSlabTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr<Entity> source)
|
||||
{
|
||||
updateShape(level, x, y, z);
|
||||
Tile::addAABBs(level, x, y, z, box, boxes, source);
|
||||
void HalfSlabTile::addAABBs(Level* level, int x, int y, int z, AABB* box,
|
||||
AABBList* boxes, std::shared_ptr<Entity> source) {
|
||||
updateShape(level, x, y, z);
|
||||
Tile::addAABBs(level, x, y, z, box, boxes, source);
|
||||
}
|
||||
|
||||
bool HalfSlabTile::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return fullSize;
|
||||
bool HalfSlabTile::isSolidRender(bool isServerLevel) { return fullSize; }
|
||||
|
||||
int HalfSlabTile::getPlacedOnFaceDataValue(Level* level, int x, int y, int z,
|
||||
int face, float clickX, float clickY,
|
||||
float clickZ, int itemValue) {
|
||||
if (fullSize) return itemValue;
|
||||
|
||||
if (face == Facing::DOWN || (face != Facing::UP && clickY > 0.5)) {
|
||||
return itemValue | TOP_SLOT_BIT;
|
||||
}
|
||||
return itemValue;
|
||||
}
|
||||
|
||||
int HalfSlabTile::getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue)
|
||||
{
|
||||
if (fullSize) return itemValue;
|
||||
|
||||
if (face == Facing::DOWN || (face != Facing::UP && clickY > 0.5))
|
||||
{
|
||||
return itemValue | TOP_SLOT_BIT;
|
||||
}
|
||||
return itemValue;
|
||||
int HalfSlabTile::getResourceCount(Random* random) {
|
||||
if (fullSize) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int HalfSlabTile::getResourceCount(Random *random)
|
||||
{
|
||||
if (fullSize)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
int HalfSlabTile::getSpawnResourcesAuxValue(int data) {
|
||||
return data & TYPE_MASK;
|
||||
}
|
||||
|
||||
int HalfSlabTile::getSpawnResourcesAuxValue(int data)
|
||||
{
|
||||
return data & TYPE_MASK;
|
||||
bool HalfSlabTile::isCubeShaped() { return fullSize; }
|
||||
|
||||
bool HalfSlabTile::shouldRenderFace(LevelSource* level, int x, int y, int z,
|
||||
int face) {
|
||||
if (fullSize) return Tile::shouldRenderFace(level, x, y, z, face);
|
||||
|
||||
if (face != Facing::UP && face != Facing::DOWN &&
|
||||
!Tile::shouldRenderFace(level, x, y, z, face)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int ox = x, oy = y, oz = z;
|
||||
ox += Facing::STEP_X[Facing::OPPOSITE_FACING[face]];
|
||||
oy += Facing::STEP_Y[Facing::OPPOSITE_FACING[face]];
|
||||
oz += Facing::STEP_Z[Facing::OPPOSITE_FACING[face]];
|
||||
|
||||
boolean isUpper = (level->getData(ox, oy, oz) & TOP_SLOT_BIT) != 0;
|
||||
if (isUpper) {
|
||||
if (face == Facing::DOWN) return true;
|
||||
if (face == Facing::UP && Tile::shouldRenderFace(level, x, y, z, face))
|
||||
return true;
|
||||
return !(isHalfSlab(level->getTile(x, y, z)) &&
|
||||
(level->getData(x, y, z) & TOP_SLOT_BIT) != 0);
|
||||
} else {
|
||||
if (face == Facing::UP) return true;
|
||||
if (face == Facing::DOWN &&
|
||||
Tile::shouldRenderFace(level, x, y, z, face))
|
||||
return true;
|
||||
return !(isHalfSlab(level->getTile(x, y, z)) &&
|
||||
(level->getData(x, y, z) & TOP_SLOT_BIT) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool HalfSlabTile::isCubeShaped()
|
||||
{
|
||||
return fullSize;
|
||||
bool HalfSlabTile::isHalfSlab(int tileId) {
|
||||
return tileId == Tile::stoneSlabHalf_Id || tileId == Tile::woodSlabHalf_Id;
|
||||
}
|
||||
|
||||
bool HalfSlabTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face)
|
||||
{
|
||||
if (fullSize) return Tile::shouldRenderFace(level, x, y, z, face);
|
||||
|
||||
if (face != Facing::UP && face != Facing::DOWN && !Tile::shouldRenderFace(level, x, y, z, face))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int ox = x, oy = y, oz = z;
|
||||
ox += Facing::STEP_X[Facing::OPPOSITE_FACING[face]];
|
||||
oy += Facing::STEP_Y[Facing::OPPOSITE_FACING[face]];
|
||||
oz += Facing::STEP_Z[Facing::OPPOSITE_FACING[face]];
|
||||
|
||||
boolean isUpper = (level->getData(ox, oy, oz) & TOP_SLOT_BIT) != 0;
|
||||
if (isUpper)
|
||||
{
|
||||
if (face == Facing::DOWN) return true;
|
||||
if (face == Facing::UP && Tile::shouldRenderFace(level, x, y, z, face)) return true;
|
||||
return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (face == Facing::UP) return true;
|
||||
if (face == Facing::DOWN && Tile::shouldRenderFace(level, x, y, z, face)) return true;
|
||||
return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool HalfSlabTile::isHalfSlab(int tileId)
|
||||
{
|
||||
return tileId == Tile::stoneSlabHalf_Id || tileId == Tile::woodSlabHalf_Id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user