BlockPlacementHelper.java
package com.hypixel.hytale.server.npc.util;
import com.hypixel.hytale.math.shape.Box;
import com.hypixel.hytale.math.util.ChunkUtil;
import com.hypixel.hytale.protocol.BlockMaterial;
import com.hypixel.hytale.server.core.asset.type.blockhitbox.BlockBoundingBoxes;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
import javax.annotation.Nonnull;
public class BlockPlacementHelper {
public BlockPlacementHelper() {
}
public static boolean canPlaceUnitBlock(@Nonnull World world, BlockType placedBlockType, boolean allowEmptyMaterials, int x, int y, int z) {
WorldChunk chunk = world.getChunkIfInMemory(ChunkUtil.indexChunkFromBlock(x, z));
if (chunk == null) {
return false;
} else {
int target = chunk.getBlock(x, y, z);
(BlockType)BlockType.getAssetMap().getAsset(target);
(!testBlock(placedBlockType, targetBlockType, allowEmptyMaterials)) {
;
} {
target = chunk.getBlock(x, y - , z);
targetBlockType = (BlockType)BlockType.getAssetMap().getAsset(target);
chunk.getFiller(x, y - , z);
chunk.getRotationIndex(x, y - , z);
testSupportingBlock(targetBlockType, rotation, filler);
}
}
}
{
world.testBlockTypes(x, y, z, placedBlockType, rotationIndex, (blockX, blockY, blockZ, blockType, rotation, filler) -> testBlock(placedBlockType, blockType, allowEmptyMaterials));
}
{
(blockType == BlockType.EMPTY) {
;
} {
allowEmptyMaterials && blockType.getMaterial() == BlockMaterial.Empty ? : ;
}
}
{
((BlockBoundingBoxes)BlockBoundingBoxes.getAssetMap().getAsset(blockType.getHitboxTypeIndex())).get(rotation).getBoundingBox();
blockType != BlockType.EMPTY && blockType != BlockType.UNKNOWN && blockType.getMaterial() == BlockMaterial.Solid && filler == && targetHitbox.isUnitBox();
}
}