Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes Networks compatible with Slimefun's 1.21 update #228

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<dependency>
<groupId>com.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>0a7fea8</version>
<version>walshy~mc-1.21-RC-7-g47092df-5828</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,47 @@ public final class NetworksItemGroups {

public static final MainFlexGroup MAIN = new MainFlexGroup(
Keys.newKey("main"),
new CustomItemStack(
CustomItemStack.create(
new ItemStack(Material.BLACK_STAINED_GLASS),
Theme.MAIN.getColor() + "Networks"
)
);

public static final DummyItemGroup MATERIALS = new DummyItemGroup(
Keys.newKey("materials"),
new CustomItemStack(
CustomItemStack.create(
new ItemStack(Material.WHITE_STAINED_GLASS),
Theme.MAIN.getColor() + "Crafting Materials"
)
);

public static final DummyItemGroup TOOLS = new DummyItemGroup(
Keys.newKey("tools"),
new CustomItemStack(
CustomItemStack.create(
new ItemStack(Material.PAINTING),
Theme.MAIN.getColor() + "Network Management Tools"
)
);

public static final DummyItemGroup NETWORK_ITEMS = new DummyItemGroup(
Keys.newKey("network_items"),
new CustomItemStack(
CustomItemStack.create(
new ItemStack(Material.BLACK_STAINED_GLASS),
Theme.MAIN.getColor() + "Network Items"
)
);

public static final DummyItemGroup NETWORK_QUANTUMS = new DummyItemGroup(
Keys.newKey("network_quantums"),
new CustomItemStack(
CustomItemStack.create(
new ItemStack(Material.WHITE_TERRACOTTA),
Theme.MAIN.getColor() + "Network Quantum Storage Devices"
)
);

public static final ItemGroup DISABLED_ITEMS = new HiddenItemGroup(
Keys.newKey("disabled_items"),
new CustomItemStack(
CustomItemStack.create(
new ItemStack(Material.BARRIER),
Theme.MAIN.getColor() + "Disabled/Removed Items"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public class NetworkAutoCrafter extends NetworkObject {
private static final int BLUEPRINT_SLOT = 10;
private static final int OUTPUT_SLOT = 16;

public static final CustomItemStack BLUEPRINT_BACKGROUND_STACK = new CustomItemStack(
public static final ItemStack BLUEPRINT_BACKGROUND_STACK = CustomItemStack.create(
Material.BLUE_STAINED_GLASS_PANE, Theme.PASSIVE + "Crafting Blueprint"
);

public static final CustomItemStack OUTPUT_BACKGROUND_STACK = new CustomItemStack(
public static final ItemStack OUTPUT_BACKGROUND_STACK = CustomItemStack.create(
Material.GREEN_STAINED_GLASS_PANE, Theme.PASSIVE + "Output"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class NetworkControlV extends NetworkDirectional {

private final Set<BlockPosition> blockCache = new HashSet<>();

public static final CustomItemStack TEMPLATE_BACKGROUND_STACK = new CustomItemStack(
public static final ItemStack TEMPLATE_BACKGROUND_STACK = CustomItemStack.create(
Material.BLUE_STAINED_GLASS_PANE, Theme.PASSIVE + "Paste items matching template"
);

Expand Down Expand Up @@ -166,7 +166,7 @@ protected int[] getOtherBackgroundSlots() {

@Nullable
@Override
protected CustomItemStack getOtherBackgroundStack() {
protected ItemStack getOtherBackgroundStack() {
return TEMPLATE_BACKGROUND_STACK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class NetworkControlX extends NetworkDirectional {

private final Set<BlockPosition> blockCache = new HashSet<>();

public static final CustomItemStack TEMPLATE_BACKGROUND_STACK = new CustomItemStack(
public static final ItemStack TEMPLATE_BACKGROUND_STACK = CustomItemStack.create(
Material.BLUE_STAINED_GLASS_PANE,
Theme.PASSIVE + "Cut items matching template.",
Theme.PASSIVE + "Leaving blank will cut anything"
Expand Down Expand Up @@ -167,7 +167,7 @@ protected int[] getOtherBackgroundSlots() {

@Nullable
@Override
protected CustomItemStack getOtherBackgroundStack() {
protected ItemStack getOtherBackgroundStack() {
return TEMPLATE_BACKGROUND_STACK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ protected int[] getOtherBackgroundSlots() {
}

@Nullable
protected CustomItemStack getOtherBackgroundStack() {
protected ItemStack getOtherBackgroundStack() {
return null;
}

Expand Down Expand Up @@ -314,7 +314,7 @@ public int[] getItemSlots() {

@Nonnull
public static ItemStack getDirectionalSlotPane(@Nonnull BlockFace blockFace, @Nonnull SlimefunItem slimefunItem, boolean active) {
final ItemStack displayStack = new CustomItemStack(
final ItemStack displayStack = CustomItemStack.create(
slimefunItem.getItem(),
Theme.PASSIVE + "Direction " + blockFace.name() + " (" + ChatColor.stripColor(slimefunItem.getItemName()) + ")"
);
Expand All @@ -334,7 +334,7 @@ public static ItemStack getDirectionalSlotPane(@Nonnull BlockFace blockFace, @No
@Nonnull
public static ItemStack getDirectionalSlotPane(@Nonnull BlockFace blockFace, @Nonnull Material blockMaterial, boolean active) {
if (blockMaterial.isItem() && !blockMaterial.isAir()) {
final ItemStack displayStack = new CustomItemStack(
final ItemStack displayStack = CustomItemStack.create(
blockMaterial,
Theme.PASSIVE + "Direction " + blockFace.name() + " (" + blockMaterial.name() + ")"
);
Expand All @@ -351,7 +351,7 @@ public static ItemStack getDirectionalSlotPane(@Nonnull BlockFace blockFace, @No
return displayStack;
} else {
Material material = active ? Material.GREEN_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE;
return new CustomItemStack(
return CustomItemStack.create(
material,
ChatColor.GRAY + "Set direction: " + blockFace.name()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public class NetworkEncoder extends NetworkObject {

private static final int CHARGE_COST = 20000;

public static final CustomItemStack BLUEPRINT_BACK_STACK = new CustomItemStack(
public static final ItemStack BLUEPRINT_BACK_STACK = CustomItemStack.create(
Material.BLUE_STAINED_GLASS_PANE, Theme.PASSIVE + "Blank Blueprint"
);

public static final CustomItemStack ENCODE_STACK = new CustomItemStack(
public static final ItemStack ENCODE_STACK = CustomItemStack.create(
Material.BLUE_STAINED_GLASS_PANE, Theme.PASSIVE + "Click to encode when valid"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public class NetworkExport extends NetworkObject {
private static final int OUTPUT_ITEM_SLOT = 24;
private static final int[] OUTPUT_ITEM_BACKDROP = {14, 15, 16, 23, 25, 32, 33, 34};

private static final CustomItemStack TEST_BACKDROP_STACK = new CustomItemStack(
private static final ItemStack TEST_BACKDROP_STACK = CustomItemStack.create(
Material.GREEN_STAINED_GLASS_PANE,
Theme.SUCCESS + "Export Item Matching"
);

private static final CustomItemStack OUTPUT_BACKDROP_STACK = new CustomItemStack(
private static final ItemStack OUTPUT_BACKDROP_STACK = CustomItemStack.create(
Material.ORANGE_STAINED_GLASS_PANE,
Theme.SUCCESS + "Output Slot"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public class NetworkGreedyBlock extends NetworkObject {
6,7,8,15,17,24,25,26
};

private static final CustomItemStack TEMPLATE_BACKGROUND_STACK = new CustomItemStack(
private static final ItemStack TEMPLATE_BACKGROUND_STACK = CustomItemStack.create(
Material.GREEN_STAINED_GLASS_PANE,
Theme.SUCCESS + "Store items matching"
);

private static final CustomItemStack STORAGE_BACKGROUND_STACK = new CustomItemStack(
private static final ItemStack STORAGE_BACKGROUND_STACK = CustomItemStack.create(
Material.ORANGE_STAINED_GLASS_PANE,
Theme.SUCCESS + "Storage"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class NetworkPowerDisplay extends NetworkObject {
};
private static final int DISPLAY_SLOT = 4;

private static final CustomItemStack EMPTY = new CustomItemStack(
private static final ItemStack EMPTY = CustomItemStack.create(
Material.RED_STAINED_GLASS_PANE,
Theme.CLICK_INFO + "Status",
Theme.PASSIVE + "Disconnected"
Expand Down Expand Up @@ -98,8 +98,8 @@ public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
};
}

private static CustomItemStack getChargeStack(long charge) {
return new CustomItemStack(
private static ItemStack getChargeStack(long charge) {
return CustomItemStack.create(
Material.GREEN_STAINED_GLASS_PANE,
Theme.CLICK_INFO + "Status",
Theme.PASSIVE + "Current Network Charge: " + charge + "j"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class NetworkPurger extends NetworkObject {
private static final int TEST_ITEM_SLOT = 13;
private static final int[] TEST_ITEM_BACKDROP = {3, 4, 5, 12, 14, 21, 22, 23};

private static final CustomItemStack TEST_BACKDROP_STACK = new CustomItemStack(
private static final ItemStack TEST_BACKDROP_STACK = CustomItemStack.create(
Material.GREEN_STAINED_GLASS_PANE,
Theme.SUCCESS + "Purge Item Matching"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class NetworkPusher extends NetworkDirectional {
private static final int UP_SLOT = 14;
private static final int DOWN_SLOT = 32;

public static final CustomItemStack TEMPLATE_BACKGROUND_STACK = new CustomItemStack(
public static final ItemStack TEMPLATE_BACKGROUND_STACK = CustomItemStack.create(
Material.BLUE_STAINED_GLASS_PANE, Theme.PASSIVE + "Push items matching template"
);

Expand Down Expand Up @@ -121,7 +121,7 @@ protected int[] getOtherBackgroundSlots() {

@Nullable
@Override
protected CustomItemStack getOtherBackgroundStack() {
protected ItemStack getOtherBackgroundStack() {
return TEMPLATE_BACKGROUND_STACK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,31 @@ public class NetworkQuantumStorage extends SlimefunItem implements DistinctiveIt
public static final int ITEM_SET_SLOT = 13;
public static final int OUTPUT_SLOT = 7;

private static final ItemStack BACK_INPUT = new CustomItemStack(
private static final ItemStack BACK_INPUT = CustomItemStack.create(
Material.GREEN_STAINED_GLASS_PANE,
Theme.PASSIVE + "Input"
);

private static final ItemStack BACK_ITEM = new CustomItemStack(
private static final ItemStack BACK_ITEM = CustomItemStack.create(
Material.BLUE_STAINED_GLASS_PANE,
Theme.PASSIVE + "Item Stored"
);

private static final ItemStack NO_ITEM = new CustomItemStack(
private static final ItemStack NO_ITEM = CustomItemStack.create(
Material.RED_STAINED_GLASS_PANE,
Theme.ERROR + "No Registered Item",
Theme.PASSIVE + "Click the icon below while",
Theme.PASSIVE + "holding an item to register it."
);

private static final ItemStack SET_ITEM = new CustomItemStack(
private static final ItemStack SET_ITEM = CustomItemStack.create(
Material.LIME_STAINED_GLASS_PANE,
Theme.SUCCESS + "Set Item",
Theme.PASSIVE + "Drag an item on top of this pane to register it.",
Theme.PASSIVE + "Shift Click to change voiding"
);

private static final ItemStack BACK_OUTPUT = new CustomItemStack(
private static final ItemStack BACK_OUTPUT = CustomItemStack.create(
Material.ORANGE_STAINED_GLASS_PANE,
Theme.PASSIVE + "Output"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class NetworkQuantumWorkbench extends SlimefunItem {
private static final int CRAFT_SLOT = 23;
private static final int OUTPUT_SLOT = 25;

private static final CustomItemStack CRAFT_BUTTON_STACK = new CustomItemStack(
private static final ItemStack CRAFT_BUTTON_STACK = CustomItemStack.create(
Material.CRAFTING_TABLE,
Theme.CLICK_INFO + "Click to entangle"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class NetworkWirelessReceiver extends NetworkObject {
3, 4, 5, 12, 14, 21, 22, 23
};

private static final CustomItemStack RECEIVED_BACKGROUND_STACK = new CustomItemStack(
private static final ItemStack RECEIVED_BACKGROUND_STACK = CustomItemStack.create(
Material.GREEN_STAINED_GLASS_PANE,
Theme.SUCCESS + "Received items"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class NetworkWirelessTransmitter extends NetworkObject {
3, 4, 5, 12, 14, 21, 22, 23
};

private static final CustomItemStack TEMPLATE_BACKGROUND_STACK = new CustomItemStack(
private static final ItemStack TEMPLATE_BACKGROUND_STACK = CustomItemStack.create(
Material.GREEN_STAINED_GLASS_PANE,
Theme.SUCCESS + "Transmit items matching"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,27 @@

public abstract class AbstractGrid extends NetworkObject {

private static final CustomItemStack BLANK_SLOT_STACK = new CustomItemStack(
private static final ItemStack BLANK_SLOT_STACK = CustomItemStack.create(
Material.LIGHT_GRAY_STAINED_GLASS_PANE,
" "
);

private static final CustomItemStack PAGE_PREVIOUS_STACK = new CustomItemStack(
private static final ItemStack PAGE_PREVIOUS_STACK = CustomItemStack.create(
Material.RED_STAINED_GLASS_PANE,
Theme.CLICK_INFO.getColor() + "Previous Page"
);

private static final CustomItemStack PAGE_NEXT_STACK = new CustomItemStack(
private static final ItemStack PAGE_NEXT_STACK = CustomItemStack.create(
Material.RED_STAINED_GLASS_PANE,
Theme.CLICK_INFO.getColor() + "Next Page"
);

private static final CustomItemStack CHANGE_SORT_STACK = new CustomItemStack(
private static final ItemStack CHANGE_SORT_STACK = CustomItemStack.create(
Material.BLUE_STAINED_GLASS_PANE,
Theme.CLICK_INFO.getColor() + "Change Sort Order"
);

private static final CustomItemStack FILTER_STACK = new CustomItemStack(
private static final ItemStack FILTER_STACK = CustomItemStack.create(
Material.NAME_TAG,
Theme.CLICK_INFO.getColor() + "Set Filter (Right Click to Clear)"
);
Expand Down Expand Up @@ -350,23 +350,23 @@ public void postRegister() {

protected abstract int getFilterSlot();

protected CustomItemStack getBlankSlotStack() {
protected ItemStack getBlankSlotStack() {
return BLANK_SLOT_STACK;
}

protected CustomItemStack getPagePreviousStack() {
protected ItemStack getPagePreviousStack() {
return PAGE_PREVIOUS_STACK;
}

protected CustomItemStack getPageNextStack() {
protected ItemStack getPageNextStack() {
return PAGE_NEXT_STACK;
}

protected CustomItemStack getChangeSortStack() {
protected ItemStack getChangeSortStack() {
return CHANGE_SORT_STACK;
}

protected CustomItemStack getFilterStack() {
protected ItemStack getFilterStack() {
return FILTER_STACK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class NetworkCraftingGrid extends AbstractGrid {
private static final int CRAFT_BUTTON_SLOT = 34;
private static final int CRAFT_OUTPUT_SLOT = 43;

private static final CustomItemStack CRAFT_BUTTON_STACK = new CustomItemStack(
private static final ItemStack CRAFT_BUTTON_STACK = CustomItemStack.create(
Material.CRAFTING_TABLE,
Theme.CLICK_INFO.getColor() + "Craft",
Theme.CLICK_INFO + "Left Click: " + Theme.PASSIVE + "Try to Craft",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import de.jeff_media.morepersistentdatatypes.DataType;
import io.github.sefiraat.networks.slimefun.network.NetworkDirectional;
import io.github.sefiraat.networks.slimefun.network.NetworkPusher;
import io.github.sefiraat.networks.utils.Keys;
import io.github.sefiraat.networks.utils.NetworkUtils;
import io.github.sefiraat.networks.utils.StackUtils;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/sefiraat/networks/utils/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static ItemStack themedItemStack(Material material, Theme themeType, Stri
}
finalLore.add("");
finalLore.add(applyThemeToString(Theme.CLICK_INFO, themeType.getLoreLine()));
return new CustomItemStack(
return CustomItemStack.create(
material,
Theme.applyThemeToString(themeType, name),
finalLore.toArray(new String[finalLore.size() - 1])
Expand Down