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

Commit 5bfeb76

Browse files
committed
Dispatch ForgeEventFactory.gatherCapabilities to CapabilityEvents
1 parent d2562fe commit 5bfeb76

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

patchwork-god-classes/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ 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
compile project(path: ':patchwork-events-lifecycle', configuration: 'dev')
78
}

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
}

patchwork-god-classes/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"depends": {
1818
"fabricloader": ">=0.8.4",
1919
"patchwork-fml": "*",
20+
"patchwork-capabilities": "*",
2021
"patchwork-events-lifecycle": "*"
2122
},
2223
"custom": {

0 commit comments

Comments
 (0)