forked from BRNSystems/Server_storage
Edit drive sizes
Rename items
This commit is contained in:
@@ -24,8 +24,9 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ServerStorage implements ModInitializer {
|
||||
public static final List<String> moduleList = Arrays.asList("bus", "configuration", "container", "display", "drive", "filtering", "inventory", "pagination", "pcb", "transport");
|
||||
public static final List<String> moduleList = Arrays.asList("bus", "configuration", "container", "display", "drive", "filtering", "inventory", "pagination", "pcb", "transport", "netherite_upgrade");
|
||||
public static final List<String> tiers = Arrays.asList("iron", "golden", "diamond", "netherite");
|
||||
public static final List<String> materialList = Arrays.asList("pcb", "pcb_substrate", "cpu", "cpu_substrate", "drive_controller", "drive_casing");
|
||||
|
||||
public static final String MOD_ID = "serverstorage";
|
||||
|
||||
@@ -45,21 +46,16 @@ public class ServerStorage implements ModInitializer {
|
||||
public static BlockEntityType<InventoryInterfaceBlockEntity> INVENTORY_INTERFACE_BLOCK_ENTITY;
|
||||
|
||||
public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Crafting_Enable =
|
||||
GameRuleRegistry.register("serverstoragecraftingmodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
|
||||
GameRuleRegistry.register("serverstorage_crafting_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
|
||||
|
||||
public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Terminal_Enable =
|
||||
GameRuleRegistry.register("serverstorageterminalmodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
|
||||
GameRuleRegistry.register("serverstorage_terminal_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
|
||||
|
||||
public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Interface_Enable =
|
||||
GameRuleRegistry.register("serverstorageinterfacemodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
|
||||
GameRuleRegistry.register("serverstorage_interface_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
|
||||
|
||||
|
||||
public static Item DRIVE_CASING;
|
||||
public static Item CPU;
|
||||
public static Item CPU_SUBSTRATE;
|
||||
public static Item DRIVE_CONTROLLER;
|
||||
public static Item PCB;
|
||||
public static Item PCB_SUBSTRATE;
|
||||
public static List<Item> MATERIALS;
|
||||
public static List<Item> MODULES;
|
||||
public static List<Item> PLATTERS;
|
||||
public static List<Item> DRIVES;
|
||||
@@ -71,8 +67,7 @@ public class ServerStorage implements ModInitializer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitialize()
|
||||
{
|
||||
public void onInitialize() {
|
||||
StorageInterfaceBlock.register();
|
||||
SimpleBlockItem.register(STORAGE_INTERFACE_BLOCK);
|
||||
|
||||
@@ -85,13 +80,7 @@ public class ServerStorage implements ModInitializer {
|
||||
InventoryInterfaceBlock.register();
|
||||
SimpleBlockItem.register(INVENTORY_INTERFACE_BLOCK);
|
||||
|
||||
PCB = SimpleItem.register("pcb", ItemGroups.INGREDIENTS);
|
||||
PCB_SUBSTRATE = SimpleItem.register("pcb_substrate", ItemGroups.INGREDIENTS);
|
||||
CPU = SimpleItem.register("cpu", ItemGroups.INGREDIENTS);
|
||||
CPU_SUBSTRATE = SimpleItem.register("cpu_substrate", ItemGroups.INGREDIENTS);
|
||||
DRIVE_CONTROLLER = SimpleItem.register("drive_controller", ItemGroups.INGREDIENTS);
|
||||
DRIVE_CASING = SimpleItem.register("drive_casing", ItemGroups.INGREDIENTS);
|
||||
|
||||
MATERIALS = SimpleItem.register("material", materialList, false, ItemGroups.INGREDIENTS);
|
||||
MODULES = SimpleItem.register("module", moduleList, false, ItemGroups.INGREDIENTS);
|
||||
|
||||
HEADS = SimpleItem.register("head", tiers, ItemGroups.INGREDIENTS);
|
||||
@@ -99,8 +88,7 @@ public class ServerStorage implements ModInitializer {
|
||||
|
||||
DRIVES = HardDriveItem.register(tiers);
|
||||
|
||||
|
||||
|
||||
systems.brn.serverstorage.lib.ItemGroups.register();
|
||||
PolymerResourcePackUtils.addModAssets(MOD_ID);
|
||||
PolymerResourcePackUtils.markAsRequired();
|
||||
|
||||
|
@@ -34,29 +34,29 @@ public class HardDrive {
|
||||
|
||||
public void setMaxItems() {
|
||||
String itemName = driveStack.getItem().getRegistryEntry().registryKey().getValue().getPath();
|
||||
|
||||
switch (itemName) {
|
||||
case "iron_drive":
|
||||
tier = 0;
|
||||
maxItems = 4096;
|
||||
break;
|
||||
case "golden_drive":
|
||||
tier = 1;
|
||||
maxItems = 8192;
|
||||
break;
|
||||
case "diamond_drive":
|
||||
tier = 2;
|
||||
maxItems = 32768;
|
||||
break;
|
||||
case "netherite_drive":
|
||||
tier = 3;
|
||||
maxItems = 131072;
|
||||
break;
|
||||
default:
|
||||
tier = -1;
|
||||
maxItems = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
maxItems = 0;
|
||||
|
||||
if (tier >= 0) {
|
||||
maxItems = (int) Math.pow(2, tier + 8);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateData() {
|
||||
|
57
src/main/java/systems/brn/serverstorage/lib/ItemGroups.java
Normal file
57
src/main/java/systems/brn/serverstorage/lib/ItemGroups.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package systems.brn.serverstorage.lib;
|
||||
import eu.pb4.polymer.core.api.item.PolymerItemGroupUtils;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import static systems.brn.serverstorage.ServerStorage.*;
|
||||
|
||||
public class ItemGroups {
|
||||
public static final ItemGroup BLOCKS_GROUP = PolymerItemGroupUtils.builder()
|
||||
.icon(() -> new ItemStack(STORAGE_INTERFACE_BLOCK))
|
||||
.displayName(Text.translatable("serverstorage.groups.blocks"))
|
||||
.entries(((context, entries) -> {
|
||||
entries.add(STORAGE_INTERFACE_BLOCK);
|
||||
entries.add(HARD_DRIVE_CONTAINER_BLOCK);
|
||||
entries.add(BUS_CONNECTOR_BLOCK);
|
||||
entries.add(INVENTORY_INTERFACE_BLOCK);
|
||||
}))
|
||||
.build();
|
||||
|
||||
public static final ItemGroup MATERIALS_GROUP = PolymerItemGroupUtils.builder()
|
||||
.icon(() -> new ItemStack(MODULES.getFirst()))
|
||||
.displayName(Text.translatable("serverstorage.groups.materials"))
|
||||
.entries(((context, entries) -> {
|
||||
for (Item module : MODULES) {
|
||||
entries.add(module);
|
||||
}
|
||||
for (Item material : MATERIALS) {
|
||||
entries.add(material);
|
||||
}
|
||||
int partLength = HEADS.size();
|
||||
if (partLength == PLATTERS.size()) {
|
||||
for (int i = 0; i < PLATTERS.size(); i++) {
|
||||
entries.add(PLATTERS.get(i));
|
||||
entries.add(HEADS.get(i));
|
||||
}
|
||||
}
|
||||
}))
|
||||
.build();
|
||||
|
||||
public static final ItemGroup DRIVES_GROUP = PolymerItemGroupUtils.builder()
|
||||
.icon(() -> new ItemStack(DRIVES.getFirst()))
|
||||
.displayName(Text.translatable("serverstorage.groups.drives"))
|
||||
.entries(((context, entries) -> {
|
||||
for (Item drive : DRIVES) {
|
||||
entries.add(drive);
|
||||
}
|
||||
}))
|
||||
.build();
|
||||
|
||||
public static void register() {
|
||||
PolymerItemGroupUtils.registerPolymerItemGroup(id("blocks"), BLOCKS_GROUP);
|
||||
PolymerItemGroupUtils.registerPolymerItemGroup(id("drives"), DRIVES_GROUP);
|
||||
PolymerItemGroupUtils.registerPolymerItemGroup(id("materials"), MATERIALS_GROUP);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user