mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-02-11 01:01:58 +01:00
Fix block-flag-setup for bukkit-api-only.
Allow all blocks that get the IGN_PASSABLE flag set but which the player can stand on to be ground from height 0 on (GROUND_HEIGHT, takes effect unless for blocks with an explicit workaround). Set IGN_PASSABLE and GROUND_HEIGHT for ENDER_PORTAL_FRAME explicitly.
This commit is contained in:
parent
ae0cdff5f2
commit
3f2780fe7d
@ -168,13 +168,27 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
|||||||
}){
|
}){
|
||||||
fullBlocks.add(mat.getId());
|
fullBlocks.add(mat.getId());
|
||||||
}
|
}
|
||||||
for (Material mat : Material.values()){
|
for (final Material mat : Material.values()){
|
||||||
if (!mat.isBlock()) continue;
|
if (!mat.isBlock()) continue;
|
||||||
int id = mat.getId();
|
final int id = mat.getId();
|
||||||
if (id < 0 || id >= 4096 || fullBlocks.contains(id)) continue;
|
if (id < 0 || id >= 4096 || fullBlocks.contains(id)) continue;
|
||||||
if (!mat.isOccluding() || !mat.isSolid() || mat.isTransparent()){
|
if (!mat.isOccluding() || !mat.isSolid() || mat.isTransparent()){
|
||||||
BlockProperties.setBlockFlags(id, BlockProperties.getBlockFlags(id) | BlockProperties.F_IGN_PASSABLE);
|
// Uncertain bounding-box, allow passing through.
|
||||||
|
long flags = BlockProperties.F_IGN_PASSABLE;
|
||||||
|
if ((BlockProperties.isSolid(id) || BlockProperties.isGround(id)) && !BlockProperties.isLiquid(id)){
|
||||||
|
// Block can be ground, so allow standing on any height.
|
||||||
|
flags |= BlockProperties.F_GROUND_HEIGHT;
|
||||||
}
|
}
|
||||||
|
BlockProperties.setBlockFlags(id, BlockProperties.getBlockFlags(id) | flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Blocks that are reported to be full and solid, but which are not.
|
||||||
|
for (final Material mat : new Material[]{
|
||||||
|
Material.ENDER_PORTAL_FRAME,
|
||||||
|
}){
|
||||||
|
final int id = mat.getId();
|
||||||
|
final long flags = BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND_HEIGHT;
|
||||||
|
BlockProperties.setBlockFlags(id, BlockProperties.getBlockFlags(id) | flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user