1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Merge pull request #3191 from guizhanss/chore/chest-menu-utils

Use chest menu preset in GUI
This commit is contained in:
TheBusyBiscuit 2021-08-03 21:12:07 +02:00 committed by GitHub
commit 077bbf774f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 11 deletions

View File

@ -381,8 +381,8 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
int pages = (scripts.size() / 45) + 1;
for (int i = 45; i < 54; i++) {
menu.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "));
menu.addMenuClickHandler(i, (pl, slot, item, action) -> false);
menu.addItem(i, ChestMenuUtils.getBackground());
menu.addMenuClickHandler(i, ChestMenuUtils.getEmptyClickHandler());
}
menu.addItem(46, ChestMenuUtils.getPreviousButton(p, page, pages));

View File

@ -111,15 +111,15 @@ public class ElectricSmeltery extends AContainer implements NotHopperable {
@Override
protected void constructMenu(BlockMenuPreset preset) {
for (int i : border) {
preset.addItem(i, new CustomItem(Material.GRAY_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : inputBorder) {
preset.addItem(i, new CustomItem(Material.CYAN_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(i, ChestMenuUtils.getInputSlotTexture(), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : outputBorder) {
preset.addItem(i, new CustomItem(Material.ORANGE_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(i, ChestMenuUtils.getOutputSlotTexture(), ChestMenuUtils.getEmptyClickHandler());
}
preset.addItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());

View File

@ -185,7 +185,7 @@ public abstract class Reactor extends AbstractEnergyProvider implements Hologram
private void constructMenu(@Nonnull BlockMenuPreset preset) {
for (int i : border) {
preset.addItem(i, new CustomItem(Material.GRAY_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : border_1) {
@ -407,8 +407,8 @@ public abstract class Reactor extends AbstractEnergyProvider implements Hologram
* The {@link Inventory} of this {@link Reactor}
* @param accessPort
* The {@link ReactorAccessPort}, if available
* @param timeleft
* The time left
* @param operation
* The {@link FuelOperation} of this {@link Reactor}
*
* @return Whether the {@link Reactor} was successfully cooled, if not it should explode
*/

View File

@ -31,6 +31,7 @@ import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponen
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler;
import io.github.thebusybiscuit.slimefun4.implementation.operations.MiningOperation;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
@ -253,14 +254,14 @@ public class GEOMiner extends SlimefunItem implements RecipeDisplayItem, EnergyN
protected void constructMenu(@Nonnull BlockMenuPreset preset) {
for (int i : BORDER) {
preset.addItem(i, new CustomItem(Material.GRAY_STAINED_GLASS_PANE, " "), (p, slot, item, action) -> false);
preset.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : OUTPUT_BORDER) {
preset.addItem(i, new CustomItem(Material.ORANGE_STAINED_GLASS_PANE, " "), (p, slot, item, action) -> false);
preset.addItem(i, ChestMenuUtils.getOutputSlotTexture(), ChestMenuUtils.getEmptyClickHandler());
}
preset.addItem(4, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "), (p, slot, item, action) -> false);
preset.addItem(4, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
for (int i : OUTPUT_SLOTS) {
preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {