[SPIGOT-6781] Expose net.minecraft.world.level.block.state.BlockBase.BlockData#canPlace Created: 02/Nov/21 Updated: 23/Nov/21 Resolved: 23/Nov/21 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | Priority: | Minor |
Reporter: | JishunaMatata | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | API |
Version: | 3271-Spigot-3892929-cef1fda |
Guidelines Read: | Yes |
Description |
It would be nice to have net.minecraft.world.level.block.state.BlockBase.BlockData#canPlace exposed in spigot's BlockData interface, this method is overriden by various blocks to determine if they can be placed at a certain location. This would be a replacement for the following method that makes use of NMS to call canPlace. public static boolean canPlace(BlockData data, Location location) { return ((CraftBlockData) data).getState().canPlace(((CraftWorld) location.getWorld()).getHandle(), new BlockPosition(location.getX(), location.getY(), location.getZ())); } |
Comments |
Comment by md_5 [ 23/Nov/21 ] |
From discord: |
Comment by JishunaMatata [ 02/Nov/21 ] |
In this case I am using it to see if the default state of a material can be placed at a given location so I can allow dispensers to place blocks without them being placed in invalid locations (floating saplings, etc). |
Comment by md_5 [ 02/Nov/21 ] |
Be more specific about your use case please |