Skip to content

Commit

Permalink
campfire_items mech: workaround Spigot method instacooking
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 31, 2022
1 parent bac7e18 commit af90377
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
import org.bukkit.block.structure.UsageMode;
import org.bukkit.entity.*;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.*;
import org.bukkit.loot.LootTable;
import org.bukkit.loot.Lootable;
import org.bukkit.material.Attachable;
Expand Down Expand Up @@ -5274,7 +5272,20 @@ else if (state instanceof Dropper) {
mechanism.echoError("Cannot add item for index " + (i + 1) + " as the campfire can only hold " + fire.getSize() + " items.");
break;
}
fire.setItem(i, list.get(i).getItemStack());
ItemStack item = list.get(i).getItemStack();
fire.setCookTime(i, 0);
fire.setCookTimeTotal(i, 0);
Iterator<Recipe> recipeIterator = Bukkit.recipeIterator();
while (recipeIterator.hasNext()) {
Recipe recipe = recipeIterator.next();
if (recipe instanceof CampfireRecipe) {
if (((CampfireRecipe) recipe).getInputChoice().test(item)) {
fire.setCookTimeTotal(i, ((CampfireRecipe) recipe).getCookingTime());
break;
}
}
}
fire.setItem(i, item);
}
fire.update();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,5 +394,4 @@ public void setVanillaTags(Material material, Set<String> tags) {
PacketHelperImpl.send(player, tagsPacket);
}
}

}

0 comments on commit af90377

Please sign in to comment.