Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: BlockFace #11

Open
KingColton1 opened this issue Jan 11, 2024 · 5 comments
Open

Request: BlockFace #11

KingColton1 opened this issue Jan 11, 2024 · 5 comments
Labels
enhancement New feature or request FoxLoader 2.0 This post is linked to FoxLoader 2.0

Comments

@KingColton1
Copy link

KingColton1 commented Jan 11, 2024

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?

@Fox2Code
Copy link
Owner

@KingColton1 can you be more precise on what you want.

For example the specific API you would want to be added.

@Fox2Code Fox2Code added enhancement New feature or request invalid This doesn't seem right labels Jan 13, 2024
@KingColton1
Copy link
Author

KingColton1 commented Jan 17, 2024

@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.

@Fox2Code
Copy link
Owner

Fox2Code commented Jan 22, 2024

@KingColton1 this is not Bukkit, are you oki?

What you proposed doesn't make any sense.

@Fox2Code
Copy link
Owner

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);

@Fox2Code
Copy link
Owner

I'll try to do something for FoxLoader for ReIndev 2.9, probably something on Vec3i/BlockPos

@Fox2Code Fox2Code removed the invalid This doesn't seem right label Apr 1, 2024
@Fox2Code Fox2Code added the FoxLoader 2.0 This post is linked to FoxLoader 2.0 label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request FoxLoader 2.0 This post is linked to FoxLoader 2.0
Projects
None yet
Development

No branches or pull requests

2 participants