mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45:51 +00:00
fix PR
This commit is contained in:
parent
00d376e213
commit
8c8996368b
@ -11,7 +11,7 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Container;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -21,8 +21,7 @@ public class SlimefunMachine extends SlimefunItem {
|
|||||||
private List<ItemStack> shownRecipes;
|
private List<ItemStack> shownRecipes;
|
||||||
private Material trigger;
|
private Material trigger;
|
||||||
//Adjacent blockfaces for iterative output chest checks
|
//Adjacent blockfaces for iterative output chest checks
|
||||||
private static final BlockFace[] faces = {
|
private static final BlockFace[] outputFaces = {
|
||||||
BlockFace.DOWN,
|
|
||||||
BlockFace.UP,
|
BlockFace.UP,
|
||||||
BlockFace.NORTH,
|
BlockFace.NORTH,
|
||||||
BlockFace.EAST,
|
BlockFace.EAST,
|
||||||
@ -62,8 +61,8 @@ public class SlimefunMachine extends SlimefunItem {
|
|||||||
return this.shownRecipes;
|
return this.shownRecipes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockFace[] getFaces() {
|
public static BlockFace[] getOutputFaces() {
|
||||||
return faces;
|
return outputFaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecipe(ItemStack[] input, ItemStack output) {
|
public void addRecipe(ItemStack[] input, ItemStack output) {
|
||||||
@ -109,14 +108,15 @@ public class SlimefunMachine extends SlimefunItem {
|
|||||||
|
|
||||||
public static Inventory findValidOutputInv(ItemStack product, Block dispBlock, Inventory dispInv, Inventory placeCheckerInv) {
|
public static Inventory findValidOutputInv(ItemStack product, Block dispBlock, Inventory dispInv, Inventory placeCheckerInv) {
|
||||||
Inventory outputInv = null;
|
Inventory outputInv = null;
|
||||||
for (BlockFace face : faces) {
|
for (BlockFace face : outputFaces) {
|
||||||
Block potentialOutput = dispBlock.getRelative(face);
|
Block potentialOutput = dispBlock.getRelative(face);
|
||||||
if (BlockStorage.hasBlockInfo(potentialOutput) && BlockStorage.checkID(potentialOutput).equals("OUTPUT_CHEST")) {
|
String id = BlockStorage.checkID(potentialOutput);
|
||||||
// Found the output chest! Now, let's check if we can fit the adding in it.
|
if (id != null && id.equals("OUTPUT_CHEST")) {
|
||||||
Inventory chestInv = ((Chest) potentialOutput.getState()).getInventory();
|
// Found the output chest! Now, let's check if we can fit the product in it.
|
||||||
if (InvUtils.fits(chestInv, product)) {
|
Inventory inv = ((Container) potentialOutput.getState()).getInventory();
|
||||||
|
if (InvUtils.fits(inv, product)) {
|
||||||
// It fits! Let's set the inventory to that now.
|
// It fits! Let's set the inventory to that now.
|
||||||
outputInv = chestInv;
|
outputInv = inv;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user