Skip to content

Commit

Permalink
add helper and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Ecdcaeb authored Dec 25, 2024
1 parent e15695c commit 8c13f8a
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ public void modConstruction(FMLConstructionEvent evt)
}

List<String> all = Lists.newArrayList();
for (ASMData asm : evt.getASMHarvestedData().getAll(ICrashReportDetail.class.getName().replace('.', '/')))
for (ASMData asm : evt.getASMHarvestedData().getAll(ICrashReportDetail.class))
all.add(asm.getClassName());
for (ASMData asm : evt.getASMHarvestedData().getAll(ICrashCallable.class.getName().replace('.', '/')))
for (ASMData asm : evt.getASMHarvestedData().getAll(ICrashCallable.class))
all.add(asm.getClassName());
// Add table classes for mod list tabulation
all.add("net/minecraftforge/common/util/TextTable");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/minecraftforge/common/MinecraftForge.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public static void preloadCrashClasses(ASMDataTable table, String modID, Set<Str
{
//Find all ICrashReportDetail's handlers and preload them.
List<String> all = Lists.newArrayList();
for (ASMData asm : table.getAll(ICrashReportDetail.class.getName().replace('.', '/')))
for (ASMData asm : table.getAll(ICrashReportDetail.class))
all.add(asm.getClassName());
for (ASMData asm : table.getAll(ICrashCallable.class.getName().replace('.', '/')))
for (ASMData asm : table.getAll(ICrashCallable.class))
all.add(asm.getClassName());

all.retainAll(classes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public <T> void register(Class<T> type, Capability.IStorage<T> storage, Callable
private IdentityHashMap<String, List<Function<Capability<?>, Object>>> callbacks = Maps.newIdentityHashMap();
public void injectCapabilities(ASMDataTable data)
{
for (ASMDataTable.ASMData entry : data.getAll(CapabilityInject.class.getName()))
for (ASMDataTable.ASMData entry : data.getAll(CapabilityInject.class))
{
final String targetClass = entry.getClassName();
final String targetName = entry.getObjectName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static void register(Class<?> cls, ITypeAdapter adpt)
public static void loadData(ASMDataTable data)
{
FMLLog.log.debug("Loading @Config anotation data");
for (ASMData target : data.getAll(Config.class.getName()))
for (ASMData target : data.getAll(Config.class))
{
String modid = (String)target.getAnnotationInfo().get("modid");
Multimap<Config.Type, ASMData> map = asm_data.computeIfAbsent(modid, k -> ArrayListMultimap.create());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public static void inject(ModContainer mod, ASMDataTable data, Side side)
{
FMLLog.log.debug("Attempting to inject @EventBusSubscriber classes into the eventbus for {}", mod.getModId());
SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod);
Set<ASMDataTable.ASMData> mods = modData.get(Mod.class.getName());
Set<ASMDataTable.ASMData> targets = modData.get(Mod.EventBusSubscriber.class.getName());
Set<ASMDataTable.ASMData> mods = modData.get(Mod.class);
Set<ASMDataTable.ASMData> targets = modData.get(Mod.EventBusSubscriber.class);
ClassLoader mcl = Loader.instance().getModClassLoader();

for (ASMDataTable.ASMData targ : targets)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void distributeStateMessage(LoaderState state, Object... eventData)

MixinBooterPlugin.LOGGER.info("Instantiating all ILateMixinLoader implemented classes...");

for (ASMDataTable.ASMData asmData : asmDataTable.getAll(ILateMixinLoader.class.getName().replace('.', '/'))) {
for (ASMDataTable.ASMData asmData : asmDataTable.getAll(ILateMixinLoader.class)) {
if (!log) {
MixinBooterPlugin.LOGGER.info("Instantiating all ILateMixinLoader implemented classes...");
log = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public static void inject(ModContainer mod, ASMDataTable data, Side side, ILangu
{
FMLLog.log.debug("Attempting to inject @SidedProxy classes into {}", mod.getModId());
SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod);
Set<ASMData> mods = modData.get(Mod.class.getName());
Set<ASMData> targets = modData.get(SidedProxy.class.getName());
Set<ASMData> mods = modData.get(Mod.class);
Set<ASMData> targets = modData.get(SidedProxy.class);
ClassLoader mcl = Loader.instance().getModClassLoader();

for (ASMData targ : targets)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void inject() {

public void findHolders(ASMDataTable table) {
FMLLog.log.info("Identifying ItemStackHolder annotations");
Set<ASMData> allItemStackHolders = table.getAll(GameRegistry.ItemStackHolder.class.getName());
Set<ASMData> allItemStackHolders = table.getAll(GameRegistry.ItemStackHolder.class);
Map<String, Class<?>> classCache = Maps.newHashMap();
for (ASMData data : allItemStackHolders)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public enum ObjectHolderRegistry
public void findObjectHolders(ASMDataTable table)
{
FMLLog.log.info("Processing ObjectHolder annotations");
Set<ASMData> allObjectHolders = table.getAll(GameRegistry.ObjectHolder.class.getName());
Set<ASMData> allObjectHolders = table.getAll(GameRegistry.ObjectHolder.class);
Map<String, String> classModIds = Maps.newHashMap();
Map<String, Class<?>> classCache = Maps.newHashMap();
for (ASMData data : table.getAll(Mod.class.getName()))
for (ASMData data : table.getAll(Mod.class))
{
String modid = (String)data.getAnnotationInfo().get("modid");
classModIds.put(data.getClassName(), modid);
Expand Down

0 comments on commit 8c13f8a

Please sign in to comment.