diff --git a/common/src/main/java/com/faboslav/friendsandfoes/common/config/FriendsAndFoesConfig.java b/common/src/main/java/com/faboslav/friendsandfoes/common/config/FriendsAndFoesConfig.java index 34dbdf7d..1fe3c326 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/common/config/FriendsAndFoesConfig.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/common/config/FriendsAndFoesConfig.java @@ -78,6 +78,16 @@ public final class FriendsAndFoesConfig @IntSlider(min = 0, max = 100, step = 1) public int copperGolemAncientCityCenterWeight = 10; + @SerialEntry() + @AutoGen(category = MOBS_CATEGORY, group = COPPER_GOLEM_GROUP) + @Boolean(formatter = Boolean.Formatter.YES_NO, colored = true) + public boolean enableCopperGolemsInTrialChambers = true; + + @SerialEntry() + @AutoGen(category = MOBS_CATEGORY, group = COPPER_GOLEM_GROUP) + @IntSlider(min = 0, max = 100, step = 1) + public int copperGolemInTrialChambersWeight = 10; + @SerialEntry() @AutoGen(category = MOBS_CATEGORY, group = CRAB_GROUP) @Boolean(formatter = Boolean.Formatter.YES_NO, colored = true) @@ -198,12 +208,12 @@ public final class FriendsAndFoesConfig @IntSlider(min = 0, max = 180, step = 1) public int illusionerInvisibilityTicks = 60; - @SerialEntry(comment = "Enable") + @SerialEntry() @AutoGen(category = MOBS_CATEGORY, group = MAULER_GROUP) @Boolean(formatter = Boolean.Formatter.YES_NO, colored = true) public boolean enableMauler = true; - @SerialEntry(comment = "Enable spawn") + @SerialEntry() @AutoGen(category = MOBS_CATEGORY, group = MAULER_GROUP) @Boolean(formatter = Boolean.Formatter.YES_NO, colored = true) public boolean enableMaulerSpawn = true; diff --git a/common/src/main/java/com/faboslav/friendsandfoes/common/init/FriendsAndFoesStructurePoolElements.java b/common/src/main/java/com/faboslav/friendsandfoes/common/init/FriendsAndFoesStructurePoolElements.java index 7699626e..093c52ba 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/common/init/FriendsAndFoesStructurePoolElements.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/common/init/FriendsAndFoesStructurePoolElements.java @@ -22,24 +22,31 @@ public static void init(MinecraftServer server) { Identifier savannaPoolLocation = Identifier.of("minecraft:village/savanna/houses"); Identifier taigaPoolLocation = Identifier.of("minecraft:village/taiga/houses"); Identifier ancientCityCenterPoolLocation = Identifier.of("minecraft:ancient_city/city_center"); + Identifier trialChambersCorridorPoolLocation = Identifier.of("minecraft:trial_chambers/corridor"); if (FriendsAndFoes.getConfig().generateBeekeeperAreaStructureInVillages) { - StructurePoolHelper.addElementToPool(templatePoolRegistry, plainsPoolLocation, "village/plains/houses/plains_beekeeper_area", FriendsAndFoes.getConfig().beekeeperAreaStructureWeight); - StructurePoolHelper.addElementToPool(templatePoolRegistry, savannaPoolLocation, "village/savanna/houses/savanna_beekeeper_area", FriendsAndFoes.getConfig().beekeeperAreaStructureWeight); - StructurePoolHelper.addElementToPool(templatePoolRegistry, taigaPoolLocation, "village/taiga/houses/taiga_beekeeper_area", FriendsAndFoes.getConfig().beekeeperAreaStructureWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, plainsPoolLocation, "village/plains/houses/plains_beekeeper_area", FriendsAndFoes.getConfig().beekeeperAreaStructureWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, savannaPoolLocation, "village/savanna/houses/savanna_beekeeper_area", FriendsAndFoes.getConfig().beekeeperAreaStructureWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, taigaPoolLocation, "village/taiga/houses/taiga_beekeeper_area", FriendsAndFoes.getConfig().beekeeperAreaStructureWeight); + } + + if(FriendsAndFoes.getConfig().enableCopperGolemsInTrialChambers) { + StructurePoolHelper.addSingleElementToPool(templatePoolRegistry, trialChambersCorridorPoolLocation, "trial_chambers/corridor/entrance_1_copper_golem", FriendsAndFoes.getConfig().copperGolemInTrialChambersWeight); + StructurePoolHelper.addSingleElementToPool(templatePoolRegistry, trialChambersCorridorPoolLocation, "trial_chambers/corridor/entrance_2_copper_golem", FriendsAndFoes.getConfig().copperGolemInTrialChambersWeight); + StructurePoolHelper.addSingleElementToPool(templatePoolRegistry, trialChambersCorridorPoolLocation, "trial_chambers/corridor/entrance_3_copper_golem", FriendsAndFoes.getConfig().copperGolemInTrialChambersWeight); } if (FriendsAndFoes.getConfig().generateCopperGolemWorkstationStructureInVillages) { - StructurePoolHelper.addElementToPool(templatePoolRegistry, plainsPoolLocation, "village/plains/houses/plains_copper_golem_area", FriendsAndFoes.getConfig().copperGolemWorkstationStructureWeight); - StructurePoolHelper.addElementToPool(templatePoolRegistry, desertPoolLocation, "village/desert/houses/desert_copper_golem_area", FriendsAndFoes.getConfig().copperGolemWorkstationStructureWeight); - StructurePoolHelper.addElementToPool(templatePoolRegistry, savannaPoolLocation, "village/savanna/houses/savanna_copper_golem_area", FriendsAndFoes.getConfig().copperGolemWorkstationStructureWeight); - StructurePoolHelper.addElementToPool(templatePoolRegistry, taigaPoolLocation, "village/taiga/houses/taiga_copper_golem_area", FriendsAndFoes.getConfig().copperGolemWorkstationStructureWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, plainsPoolLocation, "village/plains/houses/plains_copper_golem_area", FriendsAndFoes.getConfig().copperGolemWorkstationStructureWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, desertPoolLocation, "village/desert/houses/desert_copper_golem_area", FriendsAndFoes.getConfig().copperGolemWorkstationStructureWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, savannaPoolLocation, "village/savanna/houses/savanna_copper_golem_area", FriendsAndFoes.getConfig().copperGolemWorkstationStructureWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, taigaPoolLocation, "village/taiga/houses/taiga_copper_golem_area", FriendsAndFoes.getConfig().copperGolemWorkstationStructureWeight); } if (FriendsAndFoes.getConfig().generateCopperGolemInAncientCity) { - StructurePoolHelper.addElementToPool(templatePoolRegistry, ancientCityCenterPoolLocation, "ancient_city/city_center/city_center_1", FriendsAndFoes.getConfig().copperGolemAncientCityCenterWeight); - StructurePoolHelper.addElementToPool(templatePoolRegistry, ancientCityCenterPoolLocation, "ancient_city/city_center/city_center_2", FriendsAndFoes.getConfig().copperGolemAncientCityCenterWeight); - StructurePoolHelper.addElementToPool(templatePoolRegistry, ancientCityCenterPoolLocation, "ancient_city/city_center/city_center_3", FriendsAndFoes.getConfig().copperGolemAncientCityCenterWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, ancientCityCenterPoolLocation, "ancient_city/city_center/city_center_1", FriendsAndFoes.getConfig().copperGolemAncientCityCenterWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, ancientCityCenterPoolLocation, "ancient_city/city_center/city_center_2", FriendsAndFoes.getConfig().copperGolemAncientCityCenterWeight); + StructurePoolHelper.addLegacyElementToPool(templatePoolRegistry, ancientCityCenterPoolLocation, "ancient_city/city_center/city_center_3", FriendsAndFoes.getConfig().copperGolemAncientCityCenterWeight); } } diff --git a/common/src/main/java/com/faboslav/friendsandfoes/common/util/StructurePoolHelper.java b/common/src/main/java/com/faboslav/friendsandfoes/common/util/StructurePoolHelper.java index a344a249..e11bb79c 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/common/util/StructurePoolHelper.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/common/util/StructurePoolHelper.java @@ -14,7 +14,7 @@ public class StructurePoolHelper { - public static void addElementToPool( + public static void addLegacyElementToPool( Registry templatePoolRegistry, Identifier poolRL, String name, @@ -35,4 +35,26 @@ public static void addElementToPool( listOfPieceEntries.add(new Pair<>(piece, weight)); ((StructurePoolAccessor) pool).setElementCounts(listOfPieceEntries); } + + public static void addSingleElementToPool( + Registry templatePoolRegistry, + Identifier poolRL, + String name, + int weight + ) { + StructurePool pool = templatePoolRegistry.get(poolRL); + if (pool == null) { + return; + } + + SinglePoolElement piece = SinglePoolElement.ofSingle(FriendsAndFoes.makeStringID(name)).apply(StructurePool.Projection.RIGID); + + for (int i = 0; i < weight; i++) { + ((StructurePoolAccessor) pool).getElements().add(piece); + } + + List> listOfPieceEntries = new ArrayList<>(((StructurePoolAccessor) pool).getElementCounts()); + listOfPieceEntries.add(new Pair<>(piece, weight)); + ((StructurePoolAccessor) pool).setElementCounts(listOfPieceEntries); + } } \ No newline at end of file diff --git a/common/src/main/resources/assets/friendsandfoes/lang/en_us.json b/common/src/main/resources/assets/friendsandfoes/lang/en_us.json index 6fa7a86d..21d60be9 100644 --- a/common/src/main/resources/assets/friendsandfoes/lang/en_us.json +++ b/common/src/main/resources/assets/friendsandfoes/lang/en_us.json @@ -167,6 +167,8 @@ "yacl3.config.friendsandfoes:friendsandfoes.copperGolemWorkstationStructureWeight": "Workstation structure spawn weight", "yacl3.config.friendsandfoes:friendsandfoes.generateCopperGolemInAncientCity": "Generate in the center piece in the ancient cities", "yacl3.config.friendsandfoes:friendsandfoes.copperGolemAncientCityCenterWeight": "Center piece spawn weight", + "yacl3.config.friendsandfoes:friendsandfoes.enableCopperGolemsInTrialChambers": "Enable copper golems in trial chambers", + "yacl3.config.friendsandfoes:friendsandfoes.copperGolemInTrialChambersWeight": "Copper golems in trial chambers spawn weight", "yacl3.config.friendsandfoes:friendsandfoes.enableCrab": "Enable", "yacl3.config.friendsandfoes:friendsandfoes.enableCrabSpawn": "Enable spawn", "yacl3.config.friendsandfoes:friendsandfoes.crabSpawnWeight": "Spawn weight", diff --git a/common/src/main/resources/data/friendsandfoes/structure/ancient_city/city_center/city_center_2.nbt b/common/src/main/resources/data/friendsandfoes/structure/ancient_city/city_center/city_center_2.nbt index f665e97c..3693354f 100644 Binary files a/common/src/main/resources/data/friendsandfoes/structure/ancient_city/city_center/city_center_2.nbt and b/common/src/main/resources/data/friendsandfoes/structure/ancient_city/city_center/city_center_2.nbt differ diff --git a/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_1_copper_golem.nbt b/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_1_copper_golem.nbt new file mode 100644 index 00000000..2c53879f Binary files /dev/null and b/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_1_copper_golem.nbt differ diff --git a/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_2_copper_golem.nbt b/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_2_copper_golem.nbt new file mode 100644 index 00000000..8537d90e Binary files /dev/null and b/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_2_copper_golem.nbt differ diff --git a/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_3_copper_golem.nbt b/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_3_copper_golem.nbt new file mode 100644 index 00000000..1b8add65 Binary files /dev/null and b/common/src/main/resources/data/friendsandfoes/structure/trial_chambers/corridor/entrance_3_copper_golem.nbt differ