Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically register CT chickens to Roost tweak #367

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}
}
Loading