Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into endgame

This commit is contained in:
nossr50
2023-12-17 16:07:52 -08:00
140 changed files with 1356 additions and 546 deletions

View File

@@ -21,6 +21,9 @@ import java.util.HashSet;
public final class BlockUtils {
public static final String SHORT_GRASS = "SHORT_GRASS";
public static final String GRASS = "GRASS";
private BlockUtils() {
}
@@ -37,6 +40,21 @@ public final class BlockUtils {
blockState.setMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, new BonusDropMeta(1, mcMMO.p));
}
/**
* Util method for compatibility across Minecraft versions, grabs the {@link Material} enum for short_grass
*
* @return the {@link Material} enum for short_grass
*/
public static Material getShortGrass() {
if (Material.getMaterial(SHORT_GRASS) != null) {
return Material.getMaterial(SHORT_GRASS);
} else if (Material.getMaterial(GRASS) != null) {
return Material.getMaterial(GRASS);
} else {
throw new UnsupportedOperationException("Unable to find short grass material");
}
}
/**
* Set up the state for a block to be seen as unnatural and cleanup any unwanted metadata from the block
* @param block target block