Add RAILS flag.

This commit is contained in:
asofold 2013-03-20 06:11:57 +01:00
parent 5e5076a7b7
commit 33be1ca501

View File

@ -287,7 +287,10 @@ public class BlockProperties {
public static final long F_XZ100 = 0x800;
/** This flag indicates that even though a passable workaround, everything above passable height is still ground. */
public static final long F_GROUND_HEIGHT = 0x1000;
public static final long F_GROUND_HEIGHT = 0x1000;
/** All rail types a minecart can move on. */
public static final long F_RAILS = 0x2000;
/**
* The height is assumed to decrease from 1.0 with increasing data value from 0 to 0x7, with 0x7 being the lowest.
@ -440,6 +443,13 @@ public class BlockProperties {
blockFlags[mat.getId()] |= F_STAIRS | F_HEIGHT100 | F_XZ100 | F_GROUND; // Set ground too, to be sure.
}
// Rails
for (final Material mat : new Material[] {
Material.RAILS, Material.DETECTOR_RAIL, Material.POWERED_RAIL,
}) {
blockFlags[mat.getId()] |= F_RAILS;
}
// WATER.
for (final Material mat : new Material[]{
Material.STATIONARY_WATER, Material.WATER,
@ -1196,6 +1206,15 @@ public class BlockProperties {
else return (flags & F_SOLID) == 0;
}
/**
* All rail types a minecart can move on.
* @param id
* @return
*/
public static final boolean isRails(final int id){
return (blockFlags[id] & F_RAILS) != 0;
}
/**
* Test if a position can be passed through (collidesBlock + passable test, no fences yet).<br>
* NOTE: This is experimental.