diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 5b6a5dd..e9a2de3 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,23 +1,32 @@
-name: Java CI
+# Modified from https://blob.build/docs/upload/github-action/
+name: Publish build
on:
push:
- tags:
- - "*"
- pull_request:
branches:
- master
jobs:
- build:
+ publish:
+ name: Upload build
runs-on: ubuntu-latest
+ if: contains(github.event.head_commit.message, '[ci skip]') == false
steps:
- uses: actions/checkout@v3
+
- name: Set up JDK 17
uses: actions/setup-java@v3.4.1
with:
java-version: "17"
distribution: "adopt"
+
- name: Build with Maven
run: mvn clean package
+
+ - name: Upload to Blob Builds
+ uses: WalshyDev/blob-builds/gh-action@main
+ with:
+ project: Gastronomicon
+ apiToken: ${{ secrets.BLOB_BUILDS_API_TOKEN }}
+ releaseNotes: ${{ github.event.head_commit.message }}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6160b61..0a5c638 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
io.github.schntgaispock.gastronomicon
Gastronomicon
- 1.0.6
+ 1.0.7
17
@@ -95,7 +95,7 @@
com.github.Slimefun
Slimefun4
- RC-35
+ RC-36
provided
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/Gastronomicon.java b/src/main/java/io/github/schntgaispock/gastronomicon/Gastronomicon.java
index 4a1ef31..b7c1eb4 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/Gastronomicon.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/Gastronomicon.java
@@ -1,7 +1,5 @@
package io.github.schntgaispock.gastronomicon;
-import java.util.logging.Level;
-
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -22,6 +20,7 @@
import io.github.schntgaispock.gastronomicon.integration.DynaTechSetup;
import io.github.schntgaispock.gastronomicon.integration.SlimeHUDSetup;
import io.github.schntgaispock.gastronomicon.util.StringUtil;
+import io.github.thebusybiscuit.slimefun4.libraries.dough.updater.BlobBuildUpdater;
import lombok.Getter;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
@@ -40,12 +39,22 @@ public Gastronomicon() {
}
@Override
+ @SuppressWarnings("deprecation")
public void enable() {
instance = this;
- getLogger().info("#======================================#");
- getLogger().info("# Gastronomicon by SchnTgaiSpock #");
- getLogger().info("#======================================#");
+ info("#======================================#");
+ info("# Gastronomicon by SchnTgaiSpock #");
+ info("#======================================#");
+
+ if (getConfig().getBoolean("options.auto-update")) {
+ if (getDescription().getVersion().startsWith("Dev - ")) {
+ new BlobBuildUpdater(this, getFile(), "Gastronomicon", "Dev").start();
+ } else {
+ info("This is an unofficial build of Gastronomicon, so auto updates are disabled!");
+ info("You can download the official build here: https://blob.build/project/Gastronomicon");
+ }
+ }
final Metrics metrics = new Metrics(this, 16941);
@@ -59,12 +68,12 @@ public void enable() {
if (isPluginEnabled("SlimeHUD")) {
try {
- log(Level.INFO, "SlimeHUD was found on this server!");
- log(Level.INFO, "Setting up Gastronomicon for SlimeHUD...");
+ info("SlimeHUD was found on this server!");
+ info("Setting up Gastronomicon for SlimeHUD...");
SlimeHUDSetup.setup();
} catch (NoClassDefFoundError e) {
- log(Level.WARNING, "This server is using an incompatitable version of SlimeHUD");
- log(Level.WARNING, "Please update SlimeHUD to version 1.2.0 or higher!");
+ warn("This server is using an incompatitable version of SlimeHUD");
+ warn("Please update SlimeHUD to version 1.2.0 or higher!");
}
}
@@ -72,18 +81,18 @@ public void enable() {
// If disable-exotic-garden-recipes is false "!" will change it to true and the rest of the code will run checking for ExoticGarden.
if (!getConfig().getBoolean("disable-exotic-garden-recipes") && !isPluginEnabled("ExoticGarden")) {
- log(Level.WARNING, "ExoticGarden was not found on this server!");
- log(Level.WARNING, "Recipes that require ExoticGarden items will be hidden.");
+ warn("ExoticGarden was not found on this server!");
+ warn("Recipes that require ExoticGarden items will be hidden.");
}
if (isPluginEnabled("DynaTech") && !getConfig().getBoolean("disable-dynatech-integration")) {
try {
- log(Level.INFO, "DynaTech was found on this server!");
- log(Level.INFO, "Registering Gastronomicon crops with DynaTech...");
+ info("DynaTech was found on this server!");
+ info("Registering Gastronomicon crops with DynaTech...");
DynaTechSetup.setup();
} catch (NoClassDefFoundError e) {
- log(Level.WARNING, "This server is using an incompatitable version of DynaTech");
- log(Level.WARNING, "Please keep Gastronomicon and DynaTech up to date!");
+ warn("This server is using an incompatitable version of DynaTech");
+ warn("Please keep Gastronomicon and DynaTech up to date!");
}
}
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/core/listeners/FermenterRefillListener.java b/src/main/java/io/github/schntgaispock/gastronomicon/core/listeners/FermenterRefillListener.java
index 6262908..fc4e5db 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/core/listeners/FermenterRefillListener.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/core/listeners/FermenterRefillListener.java
@@ -1,6 +1,7 @@
package io.github.schntgaispock.gastronomicon.core.listeners;
import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
@@ -29,6 +30,10 @@ public void onRefill(PlayerInteractEvent e) {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK || !e.getPlayer().isSneaking())
return;
+ if (e.getItem() == null) {
+ return;
+ }
+
final Block b = e.getClickedBlock();
if (b == null)
return;
@@ -72,7 +77,10 @@ public void onRefill(PlayerInteractEvent e) {
ChunkPDC.set(b, GastroKeys.FERMENTER_WATER, Math.min(water + refill, fermenter.getCapacity()));
b.getWorld().playSound(b.getLocation(), Sound.ITEM_BUCKET_FILL, SoundCategory.PLAYERS, 1f, 1f);
- e.getItem().setType(ret);
+
+ if (e.getPlayer().getGameMode() != GameMode.CREATIVE) {
+ e.getItem().setType(ret);
+ }
}
public static void setup() {
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/core/setup/ItemSetup.java b/src/main/java/io/github/schntgaispock/gastronomicon/core/setup/ItemSetup.java
index d645df0..16e00b5 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/core/setup/ItemSetup.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/core/setup/ItemSetup.java
@@ -1793,9 +1793,7 @@ protected boolean canCatch(Location l) {
.ingredients(BBQ_SAUCE, MUTTON)
.temperature(Temperature.HIGH)
.register(gn);
- }
- if (egAvailable) {
new GastroFoodBuilder()
.type(GastroRecipeType.MULTI_STOVE)
.item(GastroStacks.BUTTER_CHICKEN)
@@ -2234,13 +2232,14 @@ protected boolean canCatch(Location l) {
.tools(GastroStacks.BLENDER)
.register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.CULINARY_WORKBENCH)
- .item(GastroStacks.STRAWBERRY_SHAVED_ICE)
- .ingredients(ICE, STRAWBERRY)
- .container(GastroStacks.STEEL_BOWL)
- .tools(GastroStacks.BLENDER)
- .register(gn);
+ if (egAvailable)
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.CULINARY_WORKBENCH)
+ .item(GastroStacks.STRAWBERRY_SHAVED_ICE)
+ .ingredients(ICE, STRAWBERRY)
+ .container(GastroStacks.STEEL_BOWL)
+ .tools(GastroStacks.BLENDER)
+ .register(gn);
new GastroFoodBuilder()
.type(GastroRecipeType.CULINARY_WORKBENCH)
@@ -2250,13 +2249,14 @@ protected boolean canCatch(Location l) {
.tools(GastroStacks.BLENDER)
.register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.CULINARY_WORKBENCH)
- .item(GastroStacks.LEMON_SHAVED_ICE)
- .ingredients(ICE, LEMON)
- .container(GastroStacks.STEEL_BOWL)
- .tools(GastroStacks.BLENDER)
- .register(gn);
+ if (egAvailable)
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.CULINARY_WORKBENCH)
+ .item(GastroStacks.LEMON_SHAVED_ICE)
+ .ingredients(ICE, LEMON)
+ .container(GastroStacks.STEEL_BOWL)
+ .tools(GastroStacks.BLENDER)
+ .register(gn);
new GastroFoodBuilder()
.type(GastroRecipeType.CULINARY_WORKBENCH)
@@ -2268,53 +2268,56 @@ protected boolean canCatch(Location l) {
null, STICK, null)
.register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.MULTI_STOVE)
- .item(GastroStacks.DONUT)
- .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, PINK_DYE)
- .tools(GastroStacks.BAKING_TRAY)
- .amount(2)
- .register(gn);
+ if (egAvailable) {
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.MULTI_STOVE)
+ .item(GastroStacks.DONUT)
+ .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, PINK_DYE)
+ .tools(GastroStacks.BAKING_TRAY)
+ .amount(2)
+ .register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.MULTI_STOVE)
- .item(GastroStacks.HONEY_DIP_DONUT)
- .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, HONEY_BOTTLE)
- .tools(GastroStacks.BAKING_TRAY)
- .amount(2)
- .register(gn);
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.MULTI_STOVE)
+ .item(GastroStacks.HONEY_DIP_DONUT)
+ .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, HONEY_BOTTLE)
+ .tools(GastroStacks.BAKING_TRAY)
+ .amount(2)
+ .register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.MULTI_STOVE)
- .item(GastroStacks.GOLDEN_CHOCOLATE_DONUT)
- .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, HONEY_BOTTLE, COCOA_BEANS)
- .tools(GastroStacks.BAKING_TRAY)
- .amount(2)
- .register(gn);
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.MULTI_STOVE)
+ .item(GastroStacks.GOLDEN_CHOCOLATE_DONUT)
+ .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, HONEY_BOTTLE,
+ COCOA_BEANS)
+ .tools(GastroStacks.BAKING_TRAY)
+ .amount(2)
+ .register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.MULTI_STOVE)
- .item(GastroStacks.STRAWBERRY_CHEESECAKE)
- .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, SlimefunItems.CHEESE,
- STRAWBERRY)
- .tools(GastroStacks.BAKING_TRAY)
- .register(gn);
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.MULTI_STOVE)
+ .item(GastroStacks.STRAWBERRY_CHEESECAKE)
+ .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, SlimefunItems.CHEESE,
+ STRAWBERRY)
+ .tools(GastroStacks.BAKING_TRAY)
+ .register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.MULTI_STOVE)
- .item(GastroStacks.STRAWBERRY_CUPCAKE)
- .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, STRAWBERRY)
- .tools(GastroStacks.BAKING_TRAY)
- .amount(2)
- .register(gn);
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.MULTI_STOVE)
+ .item(GastroStacks.STRAWBERRY_CUPCAKE)
+ .ingredients(GastroStacks.DOUGH, YEAST, MILK_BUCKET, SlimefunItems.BUTTER, SUGAR, STRAWBERRY)
+ .tools(GastroStacks.BAKING_TRAY)
+ .amount(2)
+ .register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.MULTI_STOVE)
- .item(GastroStacks.LEMON_TART)
- .ingredients(LEMON, SUGAR, EGG)
- .tools(GastroStacks.BAKING_TRAY)
- .amount(3)
- .register(gn);
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.MULTI_STOVE)
+ .item(GastroStacks.LEMON_TART)
+ .ingredients(LEMON, SUGAR, EGG)
+ .tools(GastroStacks.BAKING_TRAY)
+ .amount(3)
+ .register(gn);
+ }
new GastroFoodBuilder()
.type(GastroRecipeType.MULTI_STOVE)
@@ -2344,17 +2347,17 @@ protected boolean canCatch(Location l) {
.ingredients(RecipeUtil.cyclic(SlimefunItems.GOLD_24K_BLOCK, MELON_SLICE))
.register(gn);
- new GastroFoodBuilder()
- .type(GastroRecipeType.CULINARY_WORKBENCH)
- .item(GastroStacks.V7)
- .shape(RecipeShape.SHAPELESS)
- .ingredients(TOMATO, CARROT, GastroStacks.CELERY, BEETROOT, LETTUCE, GastroStacks.PARSLEY,
- GastroStacks.SPINACH)
- .tools(GastroStacks.BLENDER)
- .container(SlimefunItems.TIN_CAN)
- .register(gn);
-
if (egAvailable) {
+ new GastroFoodBuilder()
+ .type(GastroRecipeType.CULINARY_WORKBENCH)
+ .item(GastroStacks.V7)
+ .shape(RecipeShape.SHAPELESS)
+ .ingredients(TOMATO, CARROT, GastroStacks.CELERY, BEETROOT, LETTUCE, GastroStacks.PARSLEY,
+ GastroStacks.SPINACH)
+ .tools(GastroStacks.BLENDER)
+ .container(SlimefunItems.TIN_CAN)
+ .register(gn);
+
new GastroFoodBuilder()
.type(GastroRecipeType.CULINARY_WORKBENCH)
.item(GastroStacks.BUBBLE_MILK_TEA)
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/CulinaryWorkbench.java b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/CulinaryWorkbench.java
index 8ccc2fa..1e54f6d 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/CulinaryWorkbench.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/CulinaryWorkbench.java
@@ -27,7 +27,7 @@ public GastroRecipeType getGastroRecipeType() {
}
@Override
- protected boolean canCraft(BlockMenu menu, Block b, Player p) {
+ protected boolean canCraft(BlockMenu menu, Block b, Player p, boolean sendMessage) {
return true;
}
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/Fermenter.java b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/Fermenter.java
index 63f9047..f2c6738 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/Fermenter.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/Fermenter.java
@@ -6,6 +6,7 @@
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
+import io.github.schntgaispock.gastronomicon.Gastronomicon;
import io.github.schntgaispock.gastronomicon.core.slimefun.recipes.GastroRecipeType;
import io.github.schntgaispock.gastronomicon.util.ChunkPDC;
import io.github.schntgaispock.gastronomicon.util.item.GastroKeys;
@@ -51,13 +52,20 @@ public GastroRecipeType getGastroRecipeType() {
}
@Override
- protected boolean canCraft(BlockMenu menu, Block b, Player p) {
+ protected boolean canCraft(BlockMenu menu, Block b, Player p, boolean sendMessage) {
final int water = ChunkPDC.getOrCreateDefault(b, GastroKeys.FERMENTER_WATER, 0);
- if (water < getMbPerCraft())
+ if (water < getMbPerCraft()) {
+ Gastronomicon.sendMessage(p, "&eNot enough water!");
return false;
+ }
- ChunkPDC.set(b, GastroKeys.FERMENTER_WATER, water - getMbPerCraft());
return true;
}
+ @Override
+ protected void onSuccessfulCraft(Block b) {
+ final int water = ChunkPDC.getOrCreateDefault(b, GastroKeys.FERMENTER_WATER, 0);
+ ChunkPDC.set(b, GastroKeys.FERMENTER_WATER, water - getMbPerCraft());
+ }
+
}
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/GastroWorkstation.java b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/GastroWorkstation.java
index 2d18881..f52a3f0 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/GastroWorkstation.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/GastroWorkstation.java
@@ -96,12 +96,14 @@ protected void onBreak(BlockBreakEvent e, BlockMenu menu) {
menu.dropItems(l, getContainerSlots());
}
+ protected void onSuccessfulCraft(Block b) {}
+
@Override
protected void onNewInstance(BlockMenu menu, Block b) {
super.onNewInstance(menu, b);
menu.addMenuClickHandler(CRAFT_BUTTON_SLOT, (player, slot, item, action) -> {
- if (!canCraft(menu, b, player))
+ if (!canCraft(menu, b, player, true))
return false;
// Check if there is a free slot to craft
@@ -154,6 +156,7 @@ protected void onNewInstance(BlockMenu menu, Block b) {
// Otherwise start search
recipe = findRecipe(ingredients, containers, tools, player, menu);
if (recipe == null) {
+ Gastronomicon.sendMessage(player, "&eUnknown recipe!");
return false;
} else if (lastInputHashAndRecipe.containsKey(menu.getLocation())) {
lastInputHashAndRecipe.get(menu.getLocation()).first(hash);
@@ -172,6 +175,8 @@ protected void onNewInstance(BlockMenu menu, Block b) {
return false;
}
+ onSuccessfulCraft(b);
+
// Calculate the crafting result
final ItemStack output;
final ItemStack[] toReturn;
@@ -243,10 +248,11 @@ protected void onNewInstance(BlockMenu menu, Block b) {
* The workstation block
* @param p
* The player trying to craft
+ * @param sendMessage Whether or not to send a message to the player
* @return Whether or not the player can craft something in this workstation.
* Do not check for recipes here
*/
- protected abstract boolean canCraft(BlockMenu menu, Block b, Player p);
+ protected abstract boolean canCraft(BlockMenu menu, Block b, Player p, boolean sendMessage);
@Nullable
@ParametersAreNonnullByDefault
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/GrainMill.java b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/GrainMill.java
index fe71ab0..f5afe25 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/GrainMill.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/GrainMill.java
@@ -27,7 +27,7 @@ public GastroRecipeType getGastroRecipeType() {
}
@Override
- protected boolean canCraft(BlockMenu menu, Block b, Player p) {
+ protected boolean canCraft(BlockMenu menu, Block b, Player p, boolean sendMessage) {
return true;
}
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/MultiStove.java b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/MultiStove.java
index e539d7a..6fa92da 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/MultiStove.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/MultiStove.java
@@ -10,6 +10,7 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.schntgaispock.gastronomicon.Gastronomicon;
import io.github.schntgaispock.gastronomicon.api.recipes.GastroRecipe;
import io.github.schntgaispock.gastronomicon.api.recipes.MultiStoveRecipe;
import io.github.schntgaispock.gastronomicon.core.slimefun.recipes.GastroRecipeType;
@@ -144,12 +145,20 @@ protected int getOtherHash(Player player, BlockMenu menu) {
}
@Override
- protected boolean canCraft(BlockMenu menu, Block b, Player p) {
+ protected boolean canCraft(BlockMenu menu, Block b, Player p, boolean sendMessage) {
final int charge = getCharge(b.getLocation());
- if (charge < getEnergyPerUse()) return false;
+ if (charge < getEnergyPerUse()) {
+ Gastronomicon.sendMessage(p, "&eNot enough energy!");
+ return false;
+ }
- setCharge(b.getLocation(), charge - getEnergyPerUse());
return true;
}
+ @Override
+ protected void onSuccessfulCraft(Block b) {
+ final int charge = getCharge(b.getLocation());
+ setCharge(b.getLocation(), charge - getEnergyPerUse());
+ }
+
}
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/Refrigerator.java b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/Refrigerator.java
index 3dcbf3e..afe0fad 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/Refrigerator.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/core/slimefun/items/workstations/manual/Refrigerator.java
@@ -4,6 +4,7 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.schntgaispock.gastronomicon.Gastronomicon;
import io.github.schntgaispock.gastronomicon.core.slimefun.recipes.GastroRecipeType;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
@@ -42,12 +43,20 @@ public EnergyNetComponentType getEnergyComponentType() {
}
@Override
- protected boolean canCraft(BlockMenu menu, Block b, Player p) {
+ protected boolean canCraft(BlockMenu menu, Block b, Player p, boolean sendMessage) {
final int charge = getCharge(b.getLocation());
- if (charge < getEnergyPerUse()) return false;
+ if (charge < getEnergyPerUse()) {
+ Gastronomicon.sendMessage(p, "&eNot enough energy!");
+ return false;
+ }
- setCharge(b.getLocation(), charge - getEnergyPerUse());
return true;
}
+
+ @Override
+ protected void onSuccessfulCraft(Block b) {
+ final int charge = getCharge(b.getLocation());
+ setCharge(b.getLocation(), charge - getEnergyPerUse());
+ }
}
diff --git a/src/main/java/io/github/schntgaispock/gastronomicon/integration/SlimeHUDSetup.java b/src/main/java/io/github/schntgaispock/gastronomicon/integration/SlimeHUDSetup.java
index d6de503..6ed9f95 100644
--- a/src/main/java/io/github/schntgaispock/gastronomicon/integration/SlimeHUDSetup.java
+++ b/src/main/java/io/github/schntgaispock/gastronomicon/integration/SlimeHUDSetup.java
@@ -40,7 +40,8 @@ public static void setup() {
// Fermenter
SlimeHUD.getHudController().registerCustomHandler(Fermenter.class, request -> {
- return "&7| &9🪣 &7" + ChunkPDC.getOrCreateDefault(request.getLocation().getBlock(), GastroKeys.FERMENTER_WATER, 0) + " mB";
+ final Fermenter fermenter = (Fermenter) request.getSlimefunItem();
+ return "&7| &9🪣 &7" + ChunkPDC.getOrCreateDefault(request.getLocation().getBlock(), GastroKeys.FERMENTER_WATER, 0) + "/" + fermenter.getCapacity() + " mB";
});
}