-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
fabric/src/main/java/ca/spottedleaf/moonrise/fabric/FabricHooks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ca.spottedleaf.moonrise.fabric; | ||
|
||
import ca.spottedleaf.moonrise.common.PlatformHooks; | ||
|
||
public final class FabricHooks implements PlatformHooks { | ||
@Override | ||
public void doSomePlatformAction() { | ||
|
||
} | ||
} |
1 change: 1 addition & 0 deletions
1
fabric/src/main/resources/META-INF/services/ca.spottedleaf.moonrise.common.PlatformHooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ca.spottedleaf.moonrise.fabric.FabricHooks |
10 changes: 10 additions & 0 deletions
10
neoforge/src/main/java/ca/spottedleaf/moonrise/neoforge/NeoForgeHooks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ca.spottedleaf.moonrise.neoforge; | ||
|
||
import ca.spottedleaf.moonrise.common.PlatformHooks; | ||
|
||
public final class NeoForgeHooks implements PlatformHooks { | ||
@Override | ||
public void doSomePlatformAction() { | ||
|
||
} | ||
} |
1 change: 1 addition & 0 deletions
1
neoforge/src/main/resources/META-INF/services/ca.spottedleaf.moonrise.common.PlatformHooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ca.spottedleaf.moonrise.neoforge.NeoForgeHooks |
24 changes: 24 additions & 0 deletions
24
src/main/java/ca/spottedleaf/moonrise/common/PlatformHooks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ca.spottedleaf.moonrise.common; | ||
|
||
import java.util.ServiceLoader; | ||
|
||
// TODO - placeholder for if we need platform-specific impls for logic that needs to be called from common | ||
public interface PlatformHooks { | ||
static PlatformHooks get() { | ||
return Holder.INSTANCE; | ||
} | ||
|
||
void doSomePlatformAction(); | ||
|
||
final class Holder { | ||
private Holder() { | ||
} | ||
|
||
private static final PlatformHooks INSTANCE; | ||
|
||
static { | ||
INSTANCE = ServiceLoader.load(PlatformHooks.class, PlatformHooks.class.getClassLoader()).findFirst() | ||
.orElseThrow(() -> new RuntimeException("Failed to locate PlatformHooks")); | ||
} | ||
} | ||
} |