Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

72 changed files with 22 additions and 836 deletions

@ -3,19 +3,19 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.2
loader_version=0.16.9
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.8
# Fabric API
fabric_version=0.111.0+1.21.4
fabric_version=0.107.0+1.21.3
# Mod Properties
mod_version=3.3.3
mod_version=3.3.0
maven_group=systems.brn
archives_base_name=Serverstorage
# Dependencies
polymer_version=0.11.1+1.21.4
polymer_version=0.10.1+1.21.3
server_translations_api_version=2.4.0+1.21.2-rc1
servergui_version=1.8.1+1.21.4
servergui_version=1.7.2+1.21.2

@ -56,7 +56,7 @@ 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("serverstorage_crafting_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
GameRuleRegistry.register("serverstorage_crafting_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(false));
public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Terminal_Enable =
GameRuleRegistry.register("serverstorage_terminal_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));

@ -2,6 +2,7 @@ package systems.brn.serverstorage.items;
import eu.pb4.polymer.core.api.item.PolymerBlockItem;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
@ -22,7 +23,7 @@ public class SimpleBlockItem extends PolymerBlockItem implements PolymerItem {
public SimpleBlockItem(Item.Settings settings, Block block, Identifier identifier) {
super(block, settings, Items.BARRIER);
this.polymerModel = identifier;
this.polymerModel = PolymerResourcePackUtils.getBridgedModelId(identifier.withPath("item/" + identifier.getPath()));
}
@Override

@ -2,6 +2,7 @@ package systems.brn.serverstorage.items;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.core.api.item.SimplePolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
@ -24,7 +25,7 @@ public class SimpleItem extends SimplePolymerItem implements PolymerItem {
public SimpleItem(Settings settings, Identifier identifier) {
super(settings, Items.STICK);
this.polymerModel = identifier;
this.polymerModel = PolymerResourcePackUtils.getBridgedModelId(identifier.withPath("item/" + identifier.getPath()));
}
@Override

@ -152,7 +152,7 @@ public class Util {
// Count the occurrences of each ingredient in the recipe
for (Ingredient ingredient : recipe.value().getIngredientPlacement().getIngredients()) {
for (RegistryEntry<Item> item : ingredient.getMatchingItems().toList()) {
for (RegistryEntry<Item> item : ingredient.getMatchingItems()) {
ingredientCounts.put(item.value(), ingredientCounts.getOrDefault(item.value(), 0) + 1);
}
}
@ -163,7 +163,7 @@ public class Util {
int totalAvailable = 0;
HashMap<ItemStack, Integer> inputsTemp = new HashMap<>();
for (RegistryEntry<Item> item : ingredient.getMatchingItems().toList()) {
for (RegistryEntry<Item> item : ingredient.getMatchingItems()) {
for (Map.Entry<ItemStack, Integer> entry : itemStackMap.entrySet()) {
ItemStack inventoryStack = entry.getKey();
int inventoryCount = entry.getValue();
@ -180,13 +180,12 @@ public class Util {
canMake = false;
break;
}
// int occurrences = ingredientCounts.getOrDefault(ingredient.getMatchingItems().getFirst(),0);
// if (occurrences == 0) {
// canMake = false;
// break;
// }
// maxAmount = Math.min(maxAmount, totalAvailable / occurrences);
maxAmount = Math.min(maxAmount, totalAvailable);
int occurrences = ingredientCounts.getOrDefault(ingredient.getMatchingItems().getFirst(),0);
if (occurrences == 0) {
canMake = false;
break;
}
maxAmount = Math.min(maxAmount, totalAvailable / occurrences);
for (Map.Entry<ItemStack, Integer> entry : inputsTemp.entrySet()) {
ItemStack stackIn = entry.getKey();

@ -167,7 +167,7 @@ public class CraftingScreen extends PagedGui implements Searchable {
ItemStack playerStack = playerInventory.getStack(i);
if (ingredient.test(playerStack)) {
ItemStack stackToRemove = playerStack.copy();
for (RegistryEntry<Item> matchingItemx : ingredient.getMatchingItems().toList()) {
for (RegistryEntry<Item> matchingItemx : ingredient.getMatchingItems()) {
Item matchingItem = matchingItemx.value();
if (matchingItem == stackToRemove.getItem()) {
stackToRemove.setCount(1); // Set count to ingredient requirement
@ -179,7 +179,7 @@ public class CraftingScreen extends PagedGui implements Searchable {
}
// Check storage network
for (RegistryEntry<Item> itemx : ingredient.getMatchingItems().toList()) {
for (RegistryEntry<Item> itemx : ingredient.getMatchingItems()) {
Item item = itemx.value();
if (this.storageScreen.getNetwork().canRemove(item.getDefaultStack())) {
ItemStack stackToRemove = item.getDefaultStack();

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:block/bus_connector"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/diamond_antenna"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/diamond_drive"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/diamond_head"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/diamond_platter"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:block/drive_container"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/golden_antenna"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/golden_drive"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/golden_head"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/golden_platter"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:block/inventory_interface"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/iron_antenna"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/iron_drive"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/iron_head"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/iron_platter"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/material_cpu"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/material_cpu_substrate"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/material_drive_casing"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/material_drive_controller"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/material_pcb"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/material_pcb_substrate"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_antenna"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_antenna_connector"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_bus"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_configuration"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_container"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_display"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_drive"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_filtering"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_inventory"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_modem"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_netherite_upgrade"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_pagination"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_pcb"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_radio"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/module_transport"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/netherite_antenna"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/netherite_drive"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/netherite_head"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/netherite_platter"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:block/radio_interface"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:block/storage"
}
}

@ -1,6 +0,0 @@
{
"model": {
"type": "minecraft:model",
"model": "serverstorage:item/wireless_terminal"
}
}

@ -1,18 +1,13 @@
{
"block.serverstorage.storage": "Networked Storage Interface",
"item.serverstorage.storage": "Networked Storage Interface",
"block.serverstorage.inventory_interface": "Networked Inventory Interface",
"item.serverstorage.inventory_interface": "Networked Inventory Interface",
"block.serverstorage.drive_container": "Hard Drive Container",
"item.serverstorage.drive_container": "Hard Drive Container",
"block.serverstorage.bus_connector": "Storage Network Connector",
"item.serverstorage.bus_connector": "Storage Network Connector",
"block.serverstorage.radio_interface": "Networked Radio Interface",
"item.serverstorage.radio_interface": "Networked Radio Interface",
"item.serverstorage.iron_drive": "Iron Hard Drive",
"item.serverstorage.iron_head": "Iron Hard Drive Head",

@ -1,26 +0,0 @@
{
"criteria": {
"has_cpu": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:material_cpu"
}
]
}
}
},
"requirements": [
[
"has_cpu"
]
],
"rewards": {
"recipes": [
"serverstorage:bus_connector"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_substrate": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:material_cpu_substrate"
}
]
}
}
},
"requirements": [
[
"has_substrate"
]
],
"rewards": {
"recipes": [
"serverstorage:cpu"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_amethyst_shard": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:amethyst_shard"
}
]
}
}
},
"requirements": [
[
"has_amethyst_shard"
]
],
"rewards": {
"recipes": [
"serverstorage:cpu_substrate"
]
}
}

@ -1,29 +0,0 @@
{
"criteria": {
"has_cpu": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:material_cpu"
}
]
}
}
},
"requirements": [
[
"has_cpu"
]
],
"rewards": {
"recipes": [
"serverstorage:material_drive_controller",
"serverstorage:storage",
"serverstorage:inventory_interface",
"serverstorage:radio_interface",
"serverstorage:wireless_terminal",
"serverstorage:drive_container"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_diamond": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:diamond"
}
]
}
}
},
"requirements": [
[
"has_diamond"
]
],
"rewards": {
"recipes": [
"serverstorage:diamond_antenna"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_diamond_platter": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:diamond_platter"
}
]
}
}
},
"requirements": [
[
"has_diamond_platter"
]
],
"rewards": {
"recipes": [
"serverstorage:diamond_drive"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_diamond": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:diamond"
}
]
}
}
},
"requirements": [
[
"has_diamond"
]
],
"rewards": {
"recipes": [
"serverstorage:diamond_head"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_diamond": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:diamond"
}
]
}
}
},
"requirements": [
[
"has_diamond"
]
],
"rewards": {
"recipes": [
"serverstorage:diamond_platter"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_iron_ingot": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:iron_ingot"
}
]
}
}
},
"requirements": [
[
"has_iron_ingot"
]
],
"rewards": {
"recipes": [
"serverstorage:drive_casing"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_gold_ingot": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:gold_ingot"
}
]
}
}
},
"requirements": [
[
"has_gold_ingot"
]
],
"rewards": {
"recipes": [
"serverstorage:golden_antenna"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_golden_platter": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:golden_platter"
}
]
}
}
},
"requirements": [
[
"has_golden_platter"
]
],
"rewards": {
"recipes": [
"serverstorage:golden_drive"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_gold_ingot": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:gold_ingot"
}
]
}
}
},
"requirements": [
[
"has_gold_ingot"
]
],
"rewards": {
"recipes": [
"serverstorage:golden_head"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_gold_ingot": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:gold_ingot"
}
]
}
}
},
"requirements": [
[
"has_gold_ingot"
]
],
"rewards": {
"recipes": [
"serverstorage:golden_platter"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_iron_ingot": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:iron_ingot"
}
]
}
}
},
"requirements": [
[
"has_iron_ingot"
]
],
"rewards": {
"recipes": [
"serverstorage:iron_antenna"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_iron_platter": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:iron_platter"
}
]
}
}
},
"requirements": [
[
"has_iron_platter"
]
],
"rewards": {
"recipes": [
"serverstorage:iron_drive"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_iron_ingot": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:iron_ingot"
}
]
}
}
},
"requirements": [
[
"has_iron_ingot"
]
],
"rewards": {
"recipes": [
"serverstorage:iron_head"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_iron_ingot": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:iron_ingot"
}
]
}
}
},
"requirements": [
[
"has_iron_ingot"
]
],
"rewards": {
"recipes": [
"serverstorage:iron_platter"
]
}
}

@ -1,37 +0,0 @@
{
"criteria": {
"has_pcb_substrate": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:material_pcb_substrate"
}
]
}
}
},
"requirements": [
[
"has_pcb_substrate"
]
],
"rewards": {
"recipes": [
"serverstorage:module_radio",
"serverstorage:module_pcb",
"serverstorage:module_antenna_connector",
"serverstorage:module_bus",
"serverstorage:module_configuration",
"serverstorage:module_container",
"serverstorage:module_display",
"serverstorage:module_drive",
"serverstorage:module_antenna",
"serverstorage:module_filtering",
"serverstorage:module_inventory",
"serverstorage:module_modem",
"serverstorage:module_pagination",
"serverstorage:module_transport"
]
}
}

@ -1,24 +0,0 @@
{
"criteria": {
"has_netherite_platter": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:netherite_platter"
}
]
}
}
},
"requirements": [
[
"has_netherite_platter"
]
],
"rewards": {
"recipes": [
"serverstorage:netherite_drive"
]
}
}

@ -1,26 +0,0 @@
{
"criteria": {
"has_netherite_ingot": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:netherite_ingot"
}
]
}
}
},
"requirements": [
[
"has_netherite_ingot"
]
],
"rewards": {
"recipes": [
"serverstorage:netherite_upgrade"
]
}
}

@ -1,25 +0,0 @@
{
"criteria": {
"has_substrate": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "serverstorage:material_pcb_substrate"
}
]
}
}
},
"requirements": [
[
"has_substrate"
]
],
"rewards": {
"recipes": [
"serverstorage:pcb"
]
}
}

@ -1,25 +0,0 @@
{
"criteria": {
"has_amethyst_shard": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": "minecraft:amethyst_shard"
}
]
}
}
},
"requirements": [
[
"has_amethyst_shard"
]
],
"rewards": {
"recipes": [
"serverstorage:pcb_substrate"
]
}
}