Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit fc55fa0

Browse files
committed
Dispatch ForgeEventFactory.gatherCapabilities to CapabilityEvents
1 parent ec41bda commit fc55fa0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

patchwork-god-classes/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ version = getSubprojectVersion(project, "0.1.0")
33

44
dependencies {
55
compile project(path: ':patchwork-fml', configuration: 'dev')
6+
compile project(path: ':patchwork-capabilities', configuration: 'dev')
67
}

patchwork-god-classes/src/main/java/net/minecraftforge/event/ForgeEventFactory.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,27 @@
1919

2020
package net.minecraftforge.event;
2121

22+
import javax.annotation.Nullable;
23+
24+
import net.minecraftforge.common.capabilities.CapabilityDispatcher;
25+
import net.minecraftforge.common.capabilities.ICapabilityProvider;
26+
27+
import net.patchworkmc.impl.capability.CapabilityEvents;
28+
2229
/*
2330
* Note: this class is intended for mod use only, to dispatch to the implementations kept in their own modules.
2431
* Do not keep implementation details here, methods should be thin wrappers around methods in other modules.
2532
*/
2633
public class ForgeEventFactory {
34+
// TODO: these keeps the forge restriction of T extends ICapabilityProvider, which patchwork otherwise does not enforce
35+
// should it be removed?
36+
@Nullable
37+
public static <T extends ICapabilityProvider> CapabilityDispatcher gatherCapabilities(Class<? extends T> type, T provider) {
38+
return gatherCapabilities(type, provider, null);
39+
}
40+
41+
@Nullable
42+
public static <T extends ICapabilityProvider> CapabilityDispatcher gatherCapabilities(Class<? extends T> type, T provider, @Nullable ICapabilityProvider parent) {
43+
return CapabilityEvents.gatherCapabilities(type, provider, parent);
44+
}
2745
}

0 commit comments

Comments
 (0)