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-10-07 17:48:53 +02:00
parent 78515a3c61
commit ed8f0e243b
3 changed files with 14 additions and 7 deletions

View File

@ -65,6 +65,7 @@
* Fixed radioactive items still being radioactive when disabled
* Fixed #2391
* Fixed #2403
* Fixed #2405
## Release Candidate 16 (07 Sep 2020)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#16

View File

@ -372,8 +372,13 @@ final class CargoUtils {
Config blockData = BlockStorage.getLocationInfo(block.getLocation());
String id = blockData.getString("id");
// Cargo Output nodes have no filter actually
if (id.equals("CARGO_NODE_OUTPUT")) {
if (id == null) {
// This should normally not happen but if it does...
// Don't accept any items.
return false;
}
else if (id.equals("CARGO_NODE_OUTPUT")) {
// Cargo Output nodes have no filter actually
return true;
}

View File

@ -4,6 +4,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Material;
@ -21,9 +24,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* The {@link TableSaw} is an implementation of a {@link MultiBlockMachine} that allows
* you to turn Logs into Wooden Planks.
@ -66,7 +66,7 @@ public class TableSaw extends MultiBlockMachine {
@Override
public void onInteract(@Nonnull Player p, @Nonnull Block b) {
ItemStack item = p.getInventory().getItemInMainHand();
ItemStack output = getItemsToOutput(item.getType());
ItemStack output = getOutputFromMaterial(item.getType());
if (output == null) {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.wrong-item", true);
@ -82,9 +82,10 @@ public class TableSaw extends MultiBlockMachine {
}
@Nullable
private ItemStack getItemsToOutput(@Nonnull Material item) {
private ItemStack getOutputFromMaterial(@Nonnull Material item) {
if (Tag.LOGS.isTagged(item)) {
Optional<Material> planks = MaterialConverter.getPlanksFromLog(item);
if (planks.isPresent()) {
return new ItemStack(planks.get(), 8);
}