Java Code Examples for org.bukkit.material.MaterialData#getItemType()
The following examples show how to use
org.bukkit.material.MaterialData#getItemType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Craft.java From UhcCore with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("deprecation") private void register(){ ShapedRecipe craftRecipe = VersionUtils.getVersionUtils().createShapedRecipe(craft, UUID.randomUUID().toString()); craftRecipe.shape("abc","def","ghi"); List<Character> symbols = Arrays.asList('a','b','c','d','e','f','g','h','i'); for(int i=0 ; i<9 ; i++){ if(!recipe.get(i).getType().equals(Material.AIR)){ Material material = recipe.get(i).getType(); MaterialData data = recipe.get(i).getData(); if (data != null && data.getItemType() == material) { craftRecipe.setIngredient(symbols.get(i), data); }else { craftRecipe.setIngredient(symbols.get(i), material); } } } Bukkit.getLogger().info("[UhcCore] "+name+" custom craft registered"); Bukkit.getServer().addRecipe(craftRecipe); }
Example 2
Source File: CraftsManager.java From UhcCore with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("deprecation") public static void registerGoldenHeadCraft(){ ItemStack goldenHead = UhcItems.createGoldenHead(); ShapedRecipe headRecipe = VersionUtils.getVersionUtils().createShapedRecipe(goldenHead, "golden_head"); headRecipe.shape("GGG", "GHG", "GGG"); Material material = UniversalMaterial.PLAYER_HEAD.getType(); MaterialData data = UniversalMaterial.PLAYER_HEAD.getStack().getData(); headRecipe.setIngredient('G', Material.GOLD_INGOT); if (data != null && data.getItemType() == material) { headRecipe.setIngredient('H', data); }else { headRecipe.setIngredient('H', material); } Bukkit.getServer().addRecipe(headRecipe); }
Example 3
Source File: FlagVote.java From HeavySpleef with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { SpleefPlayer player = heavySpleef.getSpleefPlayer(event.getPlayer()); GameManager manager = heavySpleef.getGameManager(); Game game = manager.getGame(player); if (game == null) { return; } if (!game.isFlagPresent(FlagVote.class)) { return; } DefaultConfig config = heavySpleef.getConfiguration(ConfigType.DEFAULT_CONFIG); FlagSection section = config.getFlagSection(); MaterialData readyBlock = section.getReadyBlock(); Block clickedBlock = event.getClickedBlock(); if (clickedBlock == null || clickedBlock.getType() != readyBlock.getItemType() || clickedBlock.getData() != readyBlock.getData()) { return; } if (game.getGameState() != GameState.LOBBY) { player.sendMessage(i18n.getString(Messages.Command.FUNCTION_ONLY_IN_LOBBY)); return; } FlagVote flag = game.getFlag(FlagVote.class); boolean success = flag.vote(player, game); player.sendMessage(i18n.getString(success ? Messages.Command.SUCCESSFULLY_VOTED : Messages.Command.ALREADY_VOTED)); }
Example 4
Source File: SingleMaterialMatcher.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
public SingleMaterialMatcher(MaterialData materialData) { this.material = materialData.getItemType(); this.data = materialData.getData(); this.dataMatters = true; }
Example 5
Source File: SingleMaterialMatcher.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@Override public boolean matches(MaterialData materialData) { return materialData.getItemType() == this.material && (!this.dataMatters || materialData.getData() == this.data); }
Example 6
Source File: MaterialPattern.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
public MaterialPattern(MaterialData materialData) { this.material = materialData.getItemType(); this.data = Optional.of(materialData.getData()); }
Example 7
Source File: MaterialPattern.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@Override public boolean matches(MaterialData materialData) { return materialData.getItemType() == this.material && (!data.isPresent() || data.get() == materialData.getData()); }
Example 8
Source File: FurnaceRecipe.java From Kettle with GNU General Public License v3.0 | 2 votes |
/** * Create a furnace recipe to craft the specified ItemStack. * * @param result The item you want the recipe to create. * @param source The input material. */ public FurnaceRecipe(ItemStack result, MaterialData source) { this(result, source.getItemType(), source.getData(), 0); }
Example 9
Source File: FurnaceRecipe.java From Kettle with GNU General Public License v3.0 | 2 votes |
/** * Create a furnace recipe to craft the specified ItemStack. * * @param result The item you want the recipe to create. * @param source The input material. * @param experience The experience given by this recipe */ public FurnaceRecipe(ItemStack result, MaterialData source, float experience) { this(result, source.getItemType(), source.getData(), experience); }