Request: BlockFace
Currently I’m trying to figure out a way to get a face of a block but ended up being a little complex. Would that be possible to add a new method to find and get a face of a block?
@KingColton1 can you be more precise on what you want.
For example the specific API you would want to be added.
@Fox2Code Essentially it is similar to Bukkit and pretty much all of other mod libraries that have BlockFace and getRelative(BlockFace or coordinate) APIs. It would be used to get a side of a block based on a chosen block using getRelative(BlockFace.UP).
For a simple enum variable something like this;
final BlockFace face;
face.UP;
face.DOWN;
face.NORTH;
face.SOUTH;
face.EAST;
face.WEST;
or
BlockFace.UP
// and so go on..
To get a block from a side of a specific block can be done via `Block block = world.getBlockId(x, y, z).getRelative(BlockFace). I don't want to use too much for loops to find, for example, a sign attached onto a block. So that way I can use something like this;
// Find a sign using BlockFaces, assuming a assigned block with a given coordinate is already found
Block block = world.getBlockId(x, y, z).getRelative(BlockFace.NORTH);
Block sign = Block.SIGN_WALL;
if (block == sign) {
return true; // A block with a sign is found
} else {
return false; // A block is found but doesn't have a sign on a block's north face
}
Note that the getRelative() returns a block next to another block with a given BlockFace and coordinate.
@KingColton1 this is not Bukkit, are you oki?
What you proposed doesn't make any sense.
Your code:
Block block = world.getBlockId(x, y, z).getRelative(BlockFace.NORTH);
What your code means:
int blockId = world.getBlockId(x, y, z);
Block block = blockId.getRelative(BlockFace.NORTH);
I'll try to do something for FoxLoader for ReIndev 2.9, probably something on Vec3i/BlockPos