-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
76 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 24 additions & 4 deletions
28
src/main/java/io/github/sefiraat/networks/network/stackcaches/BlueprintInstance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
package io.github.sefiraat.networks.network.stackcaches; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.World; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.inventory.Recipe; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
public class BlueprintInstance extends ItemStackCache { | ||
|
||
private final ItemStack[] recipe; | ||
private final ItemStack[] recipeItems; | ||
@Nullable | ||
private Recipe recipe = null; | ||
|
||
public BlueprintInstance(@Nonnull ItemStack[] recipe, @Nonnull ItemStack expectedOutput) { | ||
public BlueprintInstance(@Nonnull ItemStack[] recipeItems, @Nonnull ItemStack expectedOutput) { | ||
super(expectedOutput); | ||
this.recipe = recipe; | ||
this.recipeItems = recipeItems; | ||
} | ||
|
||
public ItemStack[] getRecipeItems() { | ||
return recipeItems; | ||
} | ||
|
||
public ItemStack[] getRecipe() { | ||
@Nullable | ||
public Recipe getRecipe() { | ||
return recipe; | ||
} | ||
|
||
public void setRecipe(@Nullable Recipe recipe) { | ||
this.recipe = recipe; | ||
} | ||
|
||
public void generateVanillaRecipe(World world) { | ||
if (this.recipe == null) { | ||
this.recipe = Bukkit.getCraftingRecipe(this.recipeItems, world); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters