Skip to content

Commit c496845

Browse files
committed
server-side resource loading is busted right now....
1 parent 10591d2 commit c496845

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/main/java/gay/debuggy/architecture_extensions/mixin/ReloadableResourceManagerMixin.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ public class ReloadableResourceManagerMixin {
5151
var temp = new MultiPackResourceManager(type, packs);
5252
// TODO: figure out exactly what to reload in here when someone reloads resources.
5353
// also figure out whether or not generating twice can work on a (headless) server
54-
DataGeneration.generate(type);
54+
55+
ArchitectureExtensions.LOGGER.info("our multipack manager: " + temp.toString());
56+
//ArchitectureExtensions.RESOURCE_PACK.clear(ResourceType.CLIENT_RESOURCES);
57+
DataGeneration.generate(ResourceType.CLIENT_RESOURCES);
58+
ArchitectureExtensions.LOGGER.info("pack type: " + type.toString());
5559

5660
// might not be needed since we're not giving "temp" to any datageneration method
5761
temp.close();

src/main/java/gay/debuggy/architecture_extensions/resource/DataGeneration.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,26 +109,30 @@ private static void generateMineableByPickaxeTag() {
109109
var tag = TagTemplate.DEFAULT.get();
110110

111111
BLOCKS.forEach(block -> { if (!IsLog.isLog(block.id())) tag.addValue(block.id().toString()); });
112-
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.parse("tags/blocks/mineable/pickaxe.json"), tag.serialize().toString());
112+
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.parse("tags/block/mineable/pickaxe.json"), tag.serialize().toString());
113+
//ArchitectureExtensions.LOGGER.info("our pickaxe mineable tag: {}", tag.serialize());
113114
}
114115

115116
private static void generateMineableByAxeTag() {
116117
var tag = TagTemplate.DEFAULT.get();
117118
BLOCKS.forEach(block -> { if (IsLog.isLog(block.id())) tag.addValue(block.id().toString()); });
118-
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.parse("tags/blocks/mineable/axe.json"), tag.serialize().toString());
119+
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.parse("tags/block/mineable/axe.json"), tag.serialize().toString());
120+
//ArchitectureExtensions.LOGGER.info("our axe mineable tag: {}", tag.serialize());
119121
}
120122

121123
private static void generateNeedsStoneToolTag() {
122124
var tag = TagTemplate.DEFAULT.get();
123125
BLOCKS.forEach(block -> tag.addValue(block.id().toString()));
124-
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.parse("tags/blocks/needs_stone_tool.json"), tag.serialize().toString());
126+
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.parse("tags/block/needs_stone_tool.json"), tag.serialize().toString());
127+
//ArchitectureExtensions.LOGGER.info("our stone tool tag: {}", tag.serialize());
125128
}
126129

127130
private static void generateLootTables() {
128131
for (TypedGroupedBlock block : BLOCKS) {
129132
var lootTable = LootTableTemplate.BLOCK_BREAK.get();
130133
lootTable.addPool(JPool.ofItems(block.id()).addCondition(JCondition.SURVIVES_EXPLOSION.get()));
131-
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.of(block.id().getNamespace(), "loot_tables/blocks/" + block.id().getPath() + ".json"), lootTable.serialize().toString());
134+
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.of(block.id().getNamespace(), "loot_table/blocks/" + block.id().getPath() + ".json"), lootTable.serialize().toString());
135+
//ArchitectureExtensions.LOGGER.info("loot table: {}", lootTable.serialize());
132136
}
133137
}
134138

@@ -145,21 +149,23 @@ private static void generateRecipes() {
145149
recipe.addConstant(BASE_PLACEHOLDER, Registries.BLOCK.getId(block.groupedBlock().baseBlock().get()).toString());
146150
recipe.addConstant(RESULT_PLACEHOLDER, block.id().toString());
147151

148-
final var path = template.tablesaw() ? "custom_recipes/tablesaw/" : "recipes/";
152+
final var path = template.tablesaw() ? "custom_recipes/tablesaw/" : "recipe/";
149153
final var prefix = template.simple() ? "" : block.id().getPath() + "_";
150154
ArchitectureExtensions.RESOURCE_PACK.put(ResourceType.SERVER_DATA, Identifier.of(block.id().getNamespace(), path + prefix + template.id() + ".json"), recipe.serialize().toString());
155+
//ArchitectureExtensions.LOGGER.info("{} recipe path: {}", template.id(), Identifier.of(block.id().getNamespace(), path + prefix + template.id() + ".json"));
156+
//ArchitectureExtensions.LOGGER.info("{} recipe contents: {}", template.id(), recipe.serialize());
151157
}
152158
templates.clear();
153159
}
154160
}
155161

156162
public static void generate(ResourceType resourceType) {
157163
if (resourceType == ResourceType.SERVER_DATA) {
158-
// needs to be a count since for some reason server data tries to get generated 4 TIMES??!??!!?!
164+
//needs to be a count since for some reason server data tries to get generated 4 TIMES??!??!!?!
159165
++serverLoadCount;
160166
if (serverLoadCount % 4 == 1) return;
161167
if (serverLoadCount > 4) ResourceUtils.refreshCaches(ResourceType.SERVER_DATA);
162-
168+
163169
generateMineableByPickaxeTag();
164170
generateMineableByAxeTag();
165171
generateNeedsStoneToolTag();

0 commit comments

Comments
 (0)