Skip to content

Commit

Permalink
Added copper golems to trial chambers
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Nov 21, 2024
1 parent 0720422 commit dd337a7
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class StructurePoolHelper
{
public static void addElementToPool(
public static void addLegacyElementToPool(
Registry<StructurePool> templatePoolRegistry,
Identifier poolRL,
String name,
Expand All @@ -35,4 +35,26 @@ public static void addElementToPool(
listOfPieceEntries.add(new Pair<>(piece, weight));
((StructurePoolAccessor) pool).setElementCounts(listOfPieceEntries);
}

public static void addSingleElementToPool(
Registry<StructurePool> 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<Pair<StructurePoolElement, Integer>> listOfPieceEntries = new ArrayList<>(((StructurePoolAccessor) pool).getElementCounts());
listOfPieceEntries.add(new Pair<>(piece, weight));
((StructurePoolAccessor) pool).setElementCounts(listOfPieceEntries);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit dd337a7

Please sign in to comment.