added block references for checking valid blocks for excavator/hammer
This commit is contained in:
parent
1d855f1aea
commit
ce0afb8bb5
3 changed files with 86 additions and 12 deletions
|
@ -1,21 +1,21 @@
|
||||||
package lightling.gibsoniacraft.crafting;
|
package lightling.gibsoniacraft.crafting;
|
||||||
|
|
||||||
// Collections
|
// Collections
|
||||||
import java.util.List; // Needed for recipe choices and lore
|
import java.util.List; // Needed for recipe choices and lore
|
||||||
import java.util.ArrayList; // Needed for recipe choices and lore
|
import java.util.ArrayList; // Needed for recipe choices and lore
|
||||||
|
|
||||||
// Excavator-specific
|
// Excavator-specific
|
||||||
import org.bukkit.NamespacedKey; // Needed for defining excavator's item key
|
import org.bukkit.NamespacedKey; // Needed for defining excavator's item key
|
||||||
import org.bukkit.inventory.meta.ItemMeta; // Needed for defining excavator's item meta information
|
import org.bukkit.inventory.meta.ItemMeta; // Needed for defining excavator's item meta information
|
||||||
import org.bukkit.Material; // Needed for defining pre-existing items
|
import org.bukkit.Material; // Needed for defining pre-existing items
|
||||||
import org.bukkit.inventory.ShapedRecipe; // Needed for defining crafting recipes
|
import org.bukkit.inventory.ShapedRecipe; // Needed for defining crafting recipes
|
||||||
import org.bukkit.inventory.RecipeChoice; // Needed for wood-excavator's wood choices
|
import org.bukkit.inventory.RecipeChoice; // Needed for wood-excavator's wood choices
|
||||||
import org.bukkit.inventory.ItemStack; // Excavator is a type of item, which uses ItemStack
|
import org.bukkit.inventory.ItemStack; // Excavator is a type of item, which uses ItemStack
|
||||||
|
|
||||||
// Plugin-specific
|
// Plugin-specific
|
||||||
import org.bukkit.plugin.java.JavaPlugin; // For registering the excavator within the plugin
|
import org.bukkit.plugin.java.JavaPlugin; // For registering the excavator within the plugin
|
||||||
import org.bukkit.plugin.Plugin; // Involved in setting up namespaced-key
|
import org.bukkit.plugin.Plugin; // Involved in setting up namespaced-key
|
||||||
import org.bukkit.Server; // For registering recipes on the server
|
import org.bukkit.Server; // For registering recipes on the server
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An excavator is a shovel-based item that digs in a 3x3 radius as opposed to a singular block
|
* An excavator is a shovel-based item that digs in a 3x3 radius as opposed to a singular block
|
||||||
|
@ -90,7 +90,7 @@ public class Excavator
|
||||||
ItemMeta diamondExcMeta = diamondExcavator.getItemMeta();
|
ItemMeta diamondExcMeta = diamondExcavator.getItemMeta();
|
||||||
|
|
||||||
// Define lore
|
// Define lore
|
||||||
String loreString = "Based off of item from Tinkers' Construct";
|
String loreString = "Based off of item from PowerMining/Tinkers' Construct";
|
||||||
List<String> lore = new ArrayList<String>() {{ add(loreString); }};
|
List<String> lore = new ArrayList<String>() {{ add(loreString); }};
|
||||||
woodExcMeta.setLore(lore);
|
woodExcMeta.setLore(lore);
|
||||||
stoneExcMeta.setLore(lore);
|
stoneExcMeta.setLore(lore);
|
||||||
|
|
58
plugin/src/lightling/gibsoniacraft/util/BlockRef.java
Normal file
58
plugin/src/lightling/gibsoniacraft/util/BlockRef.java
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
package lightling.gibsoniacraft.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
public class BlockRef
|
||||||
|
{
|
||||||
|
public static ArrayList<Material> ValidHammerBlocks = new ArrayList<Material>()
|
||||||
|
{{
|
||||||
|
add(Material.COAL_ORE);
|
||||||
|
add(Material.IRON_ORE);
|
||||||
|
add(Material.GOLD_ORE);
|
||||||
|
add(Material.DIAMOND_ORE);
|
||||||
|
add(Material.EMERALD_ORE);
|
||||||
|
add(Material.LAPIS_ORE);
|
||||||
|
add(Material.REDSTONE_ORE);
|
||||||
|
|
||||||
|
add(Material.COAL_BLOCK);
|
||||||
|
add(Material.IRON_BLOCK);
|
||||||
|
add(Material.GOLD_BLOCK);
|
||||||
|
add(Material.DIAMOND_BLOCK);
|
||||||
|
add(Material.EMERALD_BLOCK);
|
||||||
|
add(Material.LAPIS_BLOCK);
|
||||||
|
add(Material.REDSTONE_BLOCK);
|
||||||
|
|
||||||
|
add(Material.COBBLESTONE);
|
||||||
|
add(Material.STONE);
|
||||||
|
add(Material.SANDSTONE);
|
||||||
|
add(Material.RED_SANDSTONE);
|
||||||
|
add(Material.DIORITE);
|
||||||
|
add(Material.ANDESITE);
|
||||||
|
add(Material.GRANITE);
|
||||||
|
|
||||||
|
add(Material.END_STONE);
|
||||||
|
add(Material.NETHERRACK);
|
||||||
|
add(Material.NETHER_QUARTZ_ORE);
|
||||||
|
}};
|
||||||
|
|
||||||
|
public static ArrayList<Material> ValidExcavatorBlocks = new ArrayList<Material>()
|
||||||
|
{{
|
||||||
|
add(Material.DIRT);
|
||||||
|
add(Material.COARSE_DIRT);
|
||||||
|
add(Material.PODZOL);
|
||||||
|
add(Material.GRASS_BLOCK);
|
||||||
|
add(Material.GRASS_PATH);
|
||||||
|
|
||||||
|
add(Material.SAND);
|
||||||
|
add(Material.RED_SAND);
|
||||||
|
add(Material.GRAVEL);
|
||||||
|
add(Material.CLAY);
|
||||||
|
|
||||||
|
add(Material.SNOW);
|
||||||
|
add(Material.SNOW_BLOCK);
|
||||||
|
|
||||||
|
add(Material.SOUL_SAND);
|
||||||
|
}};
|
||||||
|
}
|
16
plugin/src/lightling/gibsoniacraft/util/ToolUtil.java
Normal file
16
plugin/src/lightling/gibsoniacraft/util/ToolUtil.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package lightling.gibsoniacraft.util;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
public class ToolUtil
|
||||||
|
{
|
||||||
|
public boolean IsMineable(Material mat)
|
||||||
|
{
|
||||||
|
return BlockRef.ValidHammerBlocks.contains(mat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean IsDiggable(Material mat)
|
||||||
|
{
|
||||||
|
return BlockRef.ValidExcavatorBlocks.contains(mat);
|
||||||
|
}
|
||||||
|
}
|
Reference in a new issue