mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixed #3085
This commit is contained in:
parent
76dda9a439
commit
477cad5487
@ -48,6 +48,7 @@
|
||||
* Fixed #3075
|
||||
* Fixed recipe types showing missing string message
|
||||
* Fixed #3084
|
||||
* Fixed #3085
|
||||
|
||||
## Release Candidate 23 (19 May 2021)
|
||||
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#23
|
||||
|
@ -55,8 +55,7 @@ public class MachineProcessor<T extends MachineOperation> {
|
||||
*
|
||||
* @return The owner / holder
|
||||
*/
|
||||
@Nonnull
|
||||
public MachineProcessHolder<T> getOwner() {
|
||||
public @Nonnull MachineProcessHolder<T> getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@ -66,8 +65,7 @@ public class MachineProcessor<T extends MachineOperation> {
|
||||
*
|
||||
* @return The progress bar icon or null
|
||||
*/
|
||||
@Nullable
|
||||
public ItemStack getProgressBar() {
|
||||
public @Nullable ItemStack getProgressBar() {
|
||||
return progressBar;
|
||||
}
|
||||
|
||||
@ -144,8 +142,7 @@ public class MachineProcessor<T extends MachineOperation> {
|
||||
*
|
||||
* @return The current {@link MachineOperation} or null.
|
||||
*/
|
||||
@Nullable
|
||||
public T getOperation(@Nonnull Location loc) {
|
||||
public @Nullable T getOperation(@Nonnull Location loc) {
|
||||
Validate.notNull(loc, "The location cannot be null");
|
||||
|
||||
return getOperation(new BlockPosition(loc));
|
||||
@ -159,8 +156,7 @@ public class MachineProcessor<T extends MachineOperation> {
|
||||
*
|
||||
* @return The current {@link MachineOperation} or null.
|
||||
*/
|
||||
@Nullable
|
||||
public T getOperation(@Nonnull Block b) {
|
||||
public @Nullable T getOperation(@Nonnull Block b) {
|
||||
Validate.notNull(b, "The Block cannot be null");
|
||||
|
||||
return getOperation(new BlockPosition(b));
|
||||
@ -176,8 +172,7 @@ public class MachineProcessor<T extends MachineOperation> {
|
||||
*
|
||||
* @return The current {@link MachineOperation} or null.
|
||||
*/
|
||||
@Nullable
|
||||
public T getOperation(@Nonnull BlockPosition pos) {
|
||||
public @Nullable T getOperation(@Nonnull BlockPosition pos) {
|
||||
Validate.notNull(pos, "The BlockPosition must not be null");
|
||||
|
||||
return machines.get(pos);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -14,24 +16,26 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecip
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
|
||||
/**
|
||||
* The {@link ElectricDustWasher} serves as an electrical {@link OreWasher}.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see OreWasher
|
||||
*
|
||||
*/
|
||||
public class ElectricDustWasher extends AContainer {
|
||||
|
||||
private OreWasher oreWasher;
|
||||
private final OreWasher oreWasher = SlimefunItems.ORE_WASHER.getItem(OreWasher.class);
|
||||
private final boolean legacyMode;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public ElectricDustWasher(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
legacyMode = SlimefunPlugin.getCfg().getBoolean("options.legacy-dust-washer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRegister() {
|
||||
super.preRegister();
|
||||
|
||||
oreWasher = (OreWasher) SlimefunItems.ORE_WASHER.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getProgressBar() {
|
||||
return new ItemStack(Material.GOLDEN_SHOVEL);
|
||||
@ -46,14 +50,14 @@ public class ElectricDustWasher extends AContainer {
|
||||
}
|
||||
|
||||
ItemStack dust = oreWasher.getRandomDust();
|
||||
MachineRecipe recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] { dust });
|
||||
MachineRecipe recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { SlimefunItems.SIFTED_ORE }, new ItemStack[] { dust });
|
||||
|
||||
if (!legacyMode || menu.fits(recipe.getOutput()[0], getOutputSlots())) {
|
||||
menu.consumeItem(slot);
|
||||
return recipe;
|
||||
}
|
||||
} else if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.PULVERIZED_ORE, true)) {
|
||||
MachineRecipe recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] { SlimefunItems.PURE_ORE_CLUSTER });
|
||||
MachineRecipe recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { SlimefunItems.PULVERIZED_ORE }, new ItemStack[] { SlimefunItems.PURE_ORE_CLUSTER });
|
||||
|
||||
if (menu.fits(recipe.getOutput()[0], getOutputSlots())) {
|
||||
menu.consumeItem(slot);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -12,6 +14,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||
|
||||
public class ElectricOreGrinder extends AContainer implements RecipeDisplayItem, NotHopperable {
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public ElectricOreGrinder(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class CraftingOperation implements MachineOperation {
|
||||
public CraftingOperation(@Nonnull ItemStack[] ingredients, @Nonnull ItemStack[] results, int totalTicks) {
|
||||
Validate.notEmpty(ingredients, "The Ingredients array cannot be empty or null");
|
||||
Validate.notEmpty(results, "The results array cannot be empty or null");
|
||||
Validate.isTrue(totalTicks > 0, "The amount of total ticks must be a positive integer");
|
||||
Validate.isTrue(totalTicks >= 0, "The amount of total ticks must be a positive integer or zero, received: " + totalTicks);
|
||||
|
||||
this.ingredients = ingredients;
|
||||
this.results = results;
|
||||
@ -42,13 +42,11 @@ public class CraftingOperation implements MachineOperation {
|
||||
currentTicks += num;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack[] getIngredients() {
|
||||
public @Nonnull ItemStack[] getIngredients() {
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack[] getResults() {
|
||||
public @Nonnull ItemStack[] getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class MiningOperation implements MachineOperation {
|
||||
|
||||
public MiningOperation(@Nonnull ItemStack result, int totalTicks) {
|
||||
Validate.notNull(result, "The result cannot be null");
|
||||
Validate.isTrue(totalTicks > 0, "The amount of total ticks must be a positive integer");
|
||||
Validate.isTrue(totalTicks >= 0, "The amount of total ticks must be a positive integer or zero, received: " + totalTicks);
|
||||
|
||||
this.result = result;
|
||||
this.totalTicks = totalTicks;
|
||||
|
Loading…
Reference in New Issue
Block a user