Search in sources :

Example 1 with ServerRecipeBook

use of net.minecraft.stats.ServerRecipeBook in project Denizen-For-Bukkit by DenizenScript.

the class EntityHelperImpl method getDiscoveredRecipes.

public List<String> getDiscoveredRecipes(Player player) {
    try {
        ServerRecipeBook book = ((CraftPlayer) player).getHandle().getRecipeBook();
        Set<ResourceLocation> set = (Set<ResourceLocation>) RECIPE_BOOK_DISCOVERED_SET.get(book);
        List<String> output = new ArrayList<>();
        for (ResourceLocation key : set) {
            output.add(key.toString());
        }
        return output;
    } catch (Throwable ex) {
        Debug.echoError(ex);
    }
    return null;
}
Also used : ServerRecipeBook(net.minecraft.stats.ServerRecipeBook) ResourceLocation(net.minecraft.resources.ResourceLocation)

Example 2 with ServerRecipeBook

use of net.minecraft.stats.ServerRecipeBook in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelperImpl method resendDiscoveredRecipes.

@Override
public void resendDiscoveredRecipes(Player player) {
    ServerRecipeBook recipeBook = ((CraftPlayer) player).getHandle().getRecipeBook();
    recipeBook.sendInitialRecipeBook(((CraftPlayer) player).getHandle());
}
Also used : ServerRecipeBook(net.minecraft.stats.ServerRecipeBook)

Example 3 with ServerRecipeBook

use of net.minecraft.stats.ServerRecipeBook in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelperImpl method quietlyAddRecipe.

@Override
public void quietlyAddRecipe(Player player, NamespacedKey key) {
    ServerRecipeBook recipeBook = ((CraftPlayer) player).getHandle().getRecipeBook();
    Recipe<?> recipe = ItemHelperImpl.getNMSRecipe(key);
    if (recipe == null) {
        Debug.echoError("Cannot add recipe '" + key + "': it does not exist.");
        return;
    }
    recipeBook.add(recipe);
    recipeBook.addHighlight(recipe);
}
Also used : ServerRecipeBook(net.minecraft.stats.ServerRecipeBook)

Example 4 with ServerRecipeBook

use of net.minecraft.stats.ServerRecipeBook in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelperImpl method resendDiscoveredRecipes.

@Override
public void resendDiscoveredRecipes(Player player) {
    ServerRecipeBook recipeBook = ((CraftPlayer) player).getHandle().getRecipeBook();
    recipeBook.sendInitialRecipeBook(((CraftPlayer) player).getHandle());
}
Also used : ServerRecipeBook(net.minecraft.stats.ServerRecipeBook)

Example 5 with ServerRecipeBook

use of net.minecraft.stats.ServerRecipeBook in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelperImpl method quietlyAddRecipe.

@Override
public void quietlyAddRecipe(Player player, NamespacedKey key) {
    ServerRecipeBook recipeBook = ((CraftPlayer) player).getHandle().getRecipeBook();
    Recipe<?> recipe = ItemHelperImpl.getNMSRecipe(key);
    if (recipe == null) {
        Debug.echoError("Cannot add recipe '" + key + "': it does not exist.");
        return;
    }
    recipeBook.add(recipe);
    recipeBook.addHighlight(recipe);
}
Also used : ServerRecipeBook(net.minecraft.stats.ServerRecipeBook)

Aggregations

ServerRecipeBook (net.minecraft.stats.ServerRecipeBook)6 ResourceLocation (net.minecraft.resources.ResourceLocation)2