Skip to content

Commit

Permalink
Merge pull request #367 from jchung01/roost-simplify-config
Browse files Browse the repository at this point in the history
Automatically register CT chickens to Roost tweak
  • Loading branch information
ACGaming authored Feb 3, 2024
2 parents 6c870b2 + 161dcbe commit 3ccdfbc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,22 +520,11 @@ public static class RoostCategory
@Config.Comment
({
"Improves load time by registering CT chickens early for Roost to detect them",
"Note: All CT chickens must be specified in \"Custom Chickens\" for this tweak to work!",
"Note: In your .zs files, to use ContentTweaker's MaterialSystem Parts, you must:",
"Note: If you would like to use ContentTweaker's MaterialSystem Parts for the layed item, in your script you must:",
"1) Use '#loader finalize_contenttweaker', not '#loader contenttweaker'",
"2) Use the Material Part Bracket Handler to reference the item"
})
public boolean utRoostEarlyRegisterCTChickens = false;

@Config.RequiresMcRestart
@Config.Name("Custom Chickens")
@Config.Comment
({
"Adds custom chickens from mods (e.g. ContentTweaker) to Roost's stock texture check",
"Syntax: name",
"name Chicken name",
})
public String[] utRoostChickenMods = new String[] {};
public boolean utRoostEarlyRegisterCTChickens = true;
}

public static class SimpleDifficultyCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
case "mixins.mods.crafttweaker.json":
return Loader.isModLoaded("crafttweaker");
case "mixins.mods.roost.json":
return Loader.isModLoaded("roost");
return Loader.isModLoaded("roost") && Loader.isModLoaded("contenttweaker");
case "mixins.mods.storagedrawers.client.json":
return Loader.isModLoaded("storagedrawers");
case "mixins.mods.thaumcraft.entities.client.json":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package mod.acgaming.universaltweaks.mods.roost.mixin;

import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.google.common.collect.ImmutableSet;
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;

import com.teamacronymcoders.contenttweaker.modules.chickens.ChickenFactory;
import com.teamacronymcoders.contenttweaker.modules.chickens.ChickenRepresentation;
import com.timwoodcreates.roost.RoostTextures;
import com.timwoodcreates.roost.proxy.ProxyClient;
import mod.acgaming.universaltweaks.UniversalTweaks;
Expand All @@ -24,11 +25,11 @@ public class UTProxyClientMixin
@Inject(method = "loadComplete", at = @At("HEAD"))
public void utRoostLoadComplete(FMLLoadCompleteEvent e, CallbackInfo ci)
{
if (UTConfigMods.ROOST.utRoostChickenMods.length == 0) return;
if (!UTConfigMods.ROOST.utRoostEarlyRegisterCTChickens) return;
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTProxyClientMixin ::: Rebuild roost stock textures");
// stockTextures is immutable set, use stream to rebuild
RoostTextures.stockTextures = Stream.concat(RoostTextures.stockTextures.stream(),
Arrays.stream(UTConfigMods.ROOST.utRoostChickenMods))
ChickenFactory.CHICKEN_REPRESENTATIONS.stream().map(ChickenRepresentation::getName))
.collect(Collectors.collectingAndThen(Collectors.toSet(), ImmutableSet::copyOf));
}
}

0 comments on commit 3ccdfbc

Please sign in to comment.