mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
1.16 support part 5
This commit is contained in:
@ -144,6 +144,29 @@ public final class Misc {
|
||||
return location.getWorld().dropItem(location, itemStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop an item at a given location.
|
||||
*
|
||||
* @param location The location to drop the item at
|
||||
* @param itemStack The item to drop
|
||||
* @return Dropped Item entity or null if invalid or cancelled
|
||||
*/
|
||||
public static Item dropItem(Location location, ItemStack itemStack, int count) {
|
||||
if (itemStack.getType() == Material.AIR) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
||||
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return location.getWorld().dropItem(location, itemStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop items at a given location.
|
||||
*
|
||||
|
@ -298,6 +298,11 @@ public class SkillUtils {
|
||||
public static int getRepairAndSalvageQuantities(Material itemMaterial, Material recipeMaterial) {
|
||||
int quantity = 0;
|
||||
|
||||
if(mcMMO.getMaterialMapStore().isNetherriteTool(itemMaterial) || mcMMO.getMaterialMapStore().isNetherriteArmor(itemMaterial)) {
|
||||
//One netherrite bar requires 4 netherrite scraps
|
||||
return 4;
|
||||
}
|
||||
|
||||
for(Iterator<? extends Recipe> recipeIterator = Bukkit.getServer().recipeIterator(); recipeIterator.hasNext();) {
|
||||
Recipe bukkitRecipe = recipeIterator.next();
|
||||
|
||||
|
Reference in New Issue
Block a user