Skip to content

Commit

Permalink
fix: 材料生成器的信息栏可以被拿下来
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinhong11 committed Jun 19, 2024
1 parent a79ea24 commit 6a09258
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
import net.guizhanss.guizhanlibplugin.updater.GuizhanUpdater;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.lins.mmmjjkx.rykenslimefuncustomizer.bulit_in.JavaScriptCreator;
import org.lins.mmmjjkx.rykenslimefuncustomizer.commands.MainCommand;
import org.lins.mmmjjkx.rykenslimefuncustomizer.listeners.BlockListener;
import org.lins.mmmjjkx.rykenslimefuncustomizer.listeners.SingleItemRecipeGuideListener;
import org.lins.mmmjjkx.rykenslimefuncustomizer.objects.global.ScriptCreators;
import org.lins.mmmjjkx.rykenslimefuncustomizer.utils.CommonUtils;
import org.lins.mmmjjkx.rykenslimefuncustomizer.utils.ExceptionHandler;

Expand All @@ -23,11 +21,6 @@ public final class RykenSlimefunCustomizer extends JavaPlugin implements Slimefu
public static RykenSlimefunCustomizer INSTANCE;
public static ProjectAddonManager addonManager;

@Override
public void onLoad() {
ScriptCreators.pushScriptCreator(new JavaScriptCreator());
}

@Override
public void onEnable() {
// Plugin startup logic
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.io.IOException;
import java.util.logging.FileHandler;
import javax.script.ScriptException;

import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.PolyglotAccess;
import org.graalvm.polyglot.io.IOAccess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void open(Player... players) {
super.open(players);

if (!recipeTask.isEmpty()) {
recipeTask.start(getInventory());
recipeTask.start(toInventory());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

@SuppressWarnings("deprecation")
public class CustomMenu {
@Getter
private final Map<Integer, ItemStack> slotMap;

@Getter
private final JavaScriptEval eval;

Expand All @@ -52,11 +49,12 @@ public class CustomMenu {
@Setter
private ChestMenu.MenuCloseHandler menuCloseHandler = p -> {};

@Getter
private final Map<Integer, ItemStack> items;

private final Map<Integer, ChestMenu.MenuClickHandler> clickHandlers;

public CustomMenu(String id, String title, CustomMenu menu) {
this.slotMap = menu.slotMap;
this.eval = menu.eval;
this.title = CMIChatColor.translate(title);
this.id = id;
Expand Down Expand Up @@ -109,21 +107,20 @@ public CustomMenu(

this.id = id;
this.title = CMIChatColor.translate(title);
this.slotMap = mi;
this.eval = eval;
this.progress = progressBar != null ? progressBar.clone() : mi.get(progress);
this.progressSlot = progress;
this.playerInvClickable = playerInvClickable;

this.items = new HashMap<>();
this.items = mi;
this.clickHandlers = new HashMap<>();

if (eval != null) {
eval.doInit();
}

for (int i = 0; i < 54; i++) {
ItemStack item = slotMap.get(i);
ItemStack item = items.get(i);
if (item != null) {
addItem(i, item, (RSCClickHandler) (p, slot, is, ca) -> {
if (eval != null) {
Expand All @@ -139,12 +136,12 @@ public CustomMenu(
}
}

private void addItem(int i, ItemStack item, ChestMenu.MenuClickHandler onClick) {
public void addItem(int i, ItemStack item, ChestMenu.MenuClickHandler onClick) {
items.put(i, item);
clickHandlers.put(i, onClick);
}

private void addItem(int i, ItemStack item) {
public void addItem(int i, ItemStack item) {
items.put(i, item);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public int getGeneratedOutput(@NotNull Location l, @NotNull SlimefunBlockData da
if (menu == null) {
progress = ChestMenuUtils.getBackground();
} else {
progress = menu.getSlotMap().getOrDefault(progressSlot, ChestMenuUtils.getBackground());
progress = menu.getItems().getOrDefault(progressSlot, ChestMenuUtils.getBackground());
}

inv.replaceExistingItem(progressSlot, progress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ public void onBlockBreak(@NotNull Block block) {
}
});

menu.getSlotMap().put(statusSlot, ChestMenuUtils.getBackground());
menu.addMenuClickHandler(statusSlot, (player, slot, i, clickType) -> false);
menu.addItem(statusSlot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());

createPreset(this, menu::apply);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ protected void tick(Block b) {
if (this.menu == null) {
progress = ChestMenuUtils.getBackground();
} else {
progress =
this.menu.getSlotMap().getOrDefault(progressSlot, ChestMenuUtils.getBackground());
progress = this.menu.getItems().getOrDefault(progressSlot, ChestMenuUtils.getBackground());
}
inv.replaceExistingItem(progressSlot, progress);

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import io.github.thebusybiscuit.slimefun4.libraries.dough.collections.Pair;
import java.util.ArrayList;
import java.util.List;

import lombok.SneakyThrows;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import org.bukkit.configuration.ConfigurationSection;
Expand Down

0 comments on commit 6a09258

Please sign in to comment.