mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #2899
This commit is contained in:
parent
f6d4d20090
commit
e277732608
@ -38,6 +38,7 @@
|
|||||||
* Fixed items getting deleted when breaking enhanced furnaces
|
* Fixed items getting deleted when breaking enhanced furnaces
|
||||||
* Fixed #2895
|
* Fixed #2895
|
||||||
* Fixed #2896
|
* Fixed #2896
|
||||||
|
* Fixed #2899
|
||||||
|
|
||||||
## Release Candidate 21 (14 Mar 2021)
|
## Release Candidate 21 (14 Mar 2021)
|
||||||
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21
|
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21
|
||||||
|
@ -37,6 +37,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.AutoCrafterLi
|
|||||||
import io.github.thebusybiscuit.slimefun4.implementation.tasks.AsyncRecipeChoiceTask;
|
import io.github.thebusybiscuit.slimefun4.implementation.tasks.AsyncRecipeChoiceTask;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
import io.papermc.lib.features.blockstatesnapshot.BlockStateSnapshotResult;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
@ -218,7 +219,9 @@ public abstract class AbstractAutoCrafter extends SlimefunItem implements Energy
|
|||||||
*/
|
*/
|
||||||
protected void setSelectedRecipe(@Nonnull Block b, @Nullable AbstractRecipe recipe) {
|
protected void setSelectedRecipe(@Nonnull Block b, @Nullable AbstractRecipe recipe) {
|
||||||
Validate.notNull(b, "The Block cannot be null!");
|
Validate.notNull(b, "The Block cannot be null!");
|
||||||
BlockState state = PaperLib.getBlockState(b, false).getState();
|
|
||||||
|
BlockStateSnapshotResult result = PaperLib.getBlockState(b, false);
|
||||||
|
BlockState state = result.getState();
|
||||||
|
|
||||||
if (state instanceof Skull) {
|
if (state instanceof Skull) {
|
||||||
if (recipe == null) {
|
if (recipe == null) {
|
||||||
@ -228,6 +231,11 @@ public abstract class AbstractAutoCrafter extends SlimefunItem implements Energy
|
|||||||
// Store the value to persistent data storage
|
// Store the value to persistent data storage
|
||||||
PersistentDataAPI.setString((Skull) state, recipeStorageKey, recipe.toString());
|
PersistentDataAPI.setString((Skull) state, recipeStorageKey, recipe.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fixes #2899 - Update the BlockState if necessary
|
||||||
|
if (result.isSnapshot()) {
|
||||||
|
state.update(true, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,12 +271,14 @@ public abstract class AbstractAutoCrafter extends SlimefunItem implements Energy
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This makes the slots cycle through different ingredients
|
||||||
AsyncRecipeChoiceTask task = new AsyncRecipeChoiceTask();
|
AsyncRecipeChoiceTask task = new AsyncRecipeChoiceTask();
|
||||||
recipe.show(menu, task);
|
recipe.show(menu, task);
|
||||||
menu.open(p);
|
menu.open(p);
|
||||||
|
|
||||||
p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1, 1);
|
p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1, 1);
|
||||||
|
|
||||||
|
// Only schedule the task if necessary
|
||||||
if (!task.isEmpty()) {
|
if (!task.isEmpty()) {
|
||||||
task.start(menu.toInventory());
|
task.start(menu.toInventory());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user