1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-06-18 21:15:47 +02:00
parent 9b0326bbd8
commit 3c3dd48e9b
6 changed files with 52 additions and 5 deletions

View File

@ -2,6 +2,7 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of contents**
- [Release Candidate 14 (TBD)](#release-candidate-14-tbd)
- [Release Candidate 13 (16 Jun 2020)](#release-candidate-13-16-jun-2020)
- [Release Candidate 12 (27 May 2020)](#release-candidate-12-27-may-2020)
- [Release Candidate 11 (25 Apr 2020)](#release-candidate-11-25-apr-2020)
@ -23,6 +24,9 @@
#### Changes
* Coolant Cells now last twice as long
#### Fixes
* Fixed #2005
## Release Candidate 13 (16 Jun 2020)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#13

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.logging.Level;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.inventory.BrewerInventory;
@ -254,8 +255,12 @@ final class CargoUtils {
if (inv instanceof FurnaceInventory) {
// Check if it is fuel or not
if (stack.getType().isFuel()) {
minSlot = 1;
maxSlot = 2;
// Any non-smeltable items should not land in the upper slot
if (!isSmeltable(stack, true)) {
minSlot = 1;
}
}
else {
maxSlot = 1;
@ -313,6 +318,28 @@ final class CargoUtils {
return stack;
}
/**
* This method checks if a given {@link ItemStack} is smeltable or not.
* The lazy-option is a performance-saver since actually calculating this can be quite expensive.
* For the current applicational purposes a quick check for any wooden logs is sufficient.
* Otherwise the "lazyness" can be turned off in the future.
*
* @param stack
* The {@link ItemStack} to test
* @param lazy
* Whether or not to perform a "lazy" but performance-saving check
*
* @return Whether the given {@link ItemStack} can be smelted or not
*/
private static boolean isSmeltable(ItemStack stack, boolean lazy) {
if (lazy) {
return stack != null && Tag.LOGS.isTagged(stack.getType());
}
else {
return SlimefunPlugin.getMinecraftRecipes().isSmeltable(stack);
}
}
static DirtyChestMenu getChestMenu(Block block) {
if (BlockStorage.hasInventory(block)) {
return BlockStorage.getInventory(block);

View File

@ -90,6 +90,18 @@ public class MinecraftRecipeService {
return snapshot.getRecipeOutput(MinecraftRecipe.FURNACE, input);
}
/**
* This returns whether a given {@link ItemStack} can be smelted in a {@link FurnaceRecipe}.
*
* @param input
* The {@link ItemStack} to test
*
* @return Whether this item can be smelted
*/
public boolean isSmeltable(ItemStack input) {
return getFurnaceOutput(input).isPresent();
}
/**
* This returns the shape of a given {@link Recipe}.
* For any shapeless {@link Recipe} the result will be equivalent to

View File

@ -83,10 +83,12 @@ public final class Script {
/**
* This method checks whether a given {@link Player} is able to leave a rating for this {@link Script}.
*
* A {@link Player} is unable to rate his own {@link Script} or a {@link Script} he already rated before.
*
* @param p
* @return
* The {@link Player} to check for
*
* @return Whether the given {@link Player} is able to rate this {@link Script}
*/
public boolean canRate(Player p) {
if (isAuthor(p)) {

View File

@ -48,7 +48,9 @@ public class RepairedSpawner extends SimpleSlimefunItem<BlockPlaceHandler> {
* The provided {@link ItemStack} must be a {@link RepairedSpawner} item.
*
* @param item
* @return
* The {@link ItemStack} to extract the {@link EntityType} from
*
* @return An {@link Optional} describing the result
*/
public Optional<EntityType> getEntityType(ItemStack item) {
for (String line : item.getItemMeta().getLore()) {

View File

@ -1,5 +1,5 @@
/**
* This package contains all the different implementations of
* {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine}
* {@link io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine}
*/
package io.github.thebusybiscuit.slimefun4.implementation.items.multiblocks;