mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Merge pull request #3096 from martinbrom/fix/auto-brewer
AutoBrewer fixes
This commit is contained in:
commit
0224f94edf
@ -4,6 +4,8 @@ import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -52,12 +54,13 @@ public class AutoBrewer extends AContainer implements NotHopperable {
|
||||
fermentations.put(PotionType.NIGHT_VISION, PotionType.INVISIBILITY);
|
||||
}
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public AutoBrewer(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MachineRecipe findNextRecipe(BlockMenu menu) {
|
||||
protected @Nullable MachineRecipe findNextRecipe(BlockMenu menu) {
|
||||
ItemStack input1 = menu.getItemInSlot(getInputSlots()[0]);
|
||||
ItemStack input2 = menu.getItemInSlot(getInputSlots()[1]);
|
||||
|
||||
@ -98,10 +101,12 @@ public class AutoBrewer extends AContainer implements NotHopperable {
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack brew(Material input, Material potionType, PotionMeta potion) {
|
||||
@ParametersAreNonnullByDefault
|
||||
private @Nullable ItemStack brew(Material input, Material potionType, PotionMeta potion) {
|
||||
PotionData data = potion.getBasePotionData();
|
||||
|
||||
if (data.getType() == PotionType.WATER) {
|
||||
PotionType type = data.getType();
|
||||
if (type == PotionType.WATER) {
|
||||
if (input == Material.FERMENTED_SPIDER_EYE) {
|
||||
potion.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false));
|
||||
return new ItemStack(potionType);
|
||||
@ -114,19 +119,19 @@ public class AutoBrewer extends AContainer implements NotHopperable {
|
||||
return new ItemStack(Material.LINGERING_POTION);
|
||||
}
|
||||
} else if (input == Material.FERMENTED_SPIDER_EYE) {
|
||||
PotionType fermented = fermentations.get(data.getType());
|
||||
PotionType fermented = fermentations.get(type);
|
||||
|
||||
if (fermented != null) {
|
||||
potion.setBasePotionData(new PotionData(fermented, false, false));
|
||||
potion.setBasePotionData(new PotionData(fermented, data.isExtended(), data.isUpgraded()));
|
||||
return new ItemStack(potionType);
|
||||
}
|
||||
} else if (input == Material.REDSTONE) {
|
||||
potion.setBasePotionData(new PotionData(data.getType(), true, data.isUpgraded()));
|
||||
} else if (input == Material.REDSTONE && type.isExtendable()) {
|
||||
potion.setBasePotionData(new PotionData(type, true, data.isUpgraded()));
|
||||
return new ItemStack(potionType);
|
||||
} else if (input == Material.GLOWSTONE_DUST) {
|
||||
potion.setBasePotionData(new PotionData(data.getType(), data.isExtended(), true));
|
||||
} else if (input == Material.GLOWSTONE_DUST && type.isUpgradeable()) {
|
||||
potion.setBasePotionData(new PotionData(type, data.isExtended(), true));
|
||||
return new ItemStack(potionType);
|
||||
} else if (data.getType() == PotionType.AWKWARD) {
|
||||
} else if (type == PotionType.AWKWARD) {
|
||||
PotionType potionRecipe = potionRecipes.get(input);
|
||||
|
||||
if (potionRecipe != null) {
|
||||
@ -151,12 +156,12 @@ public class AutoBrewer extends AContainer implements NotHopperable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getProgressBar() {
|
||||
public @Nonnull ItemStack getProgressBar() {
|
||||
return new ItemStack(Material.FISHING_ROD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineIdentifier() {
|
||||
public @Nonnull String getMachineIdentifier() {
|
||||
return "AUTO_BREWER";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user