-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #227
- Loading branch information
Showing
7 changed files
with
60 additions
and
36 deletions.
There are no files selected for viewing
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
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
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
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
10 changes: 10 additions & 0 deletions
10
src/main/java/io/redspace/ironsspellbooks/util/IMinecraftInstanceHelper.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 io.redspace.ironsspellbooks.util; | ||
|
||
import net.minecraft.world.entity.player.Player; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public interface IMinecraftInstanceHelper { | ||
@Nullable | ||
Player player(); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/io/redspace/ironsspellbooks/util/MinecraftInstanceHelper.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,19 @@ | ||
package io.redspace.ironsspellbooks.util; | ||
|
||
import net.minecraft.world.entity.player.Player; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class MinecraftInstanceHelper implements IMinecraftInstanceHelper { | ||
/** | ||
* If we are on the client, this is replaced with an implementation that returns the client host player | ||
*/ | ||
public static IMinecraftInstanceHelper instance = () -> null; | ||
|
||
@Nullable | ||
@Override | ||
public Player player() { | ||
return instance.player(); | ||
} | ||
|
||
public static Player getPlayer(){return instance.player();} | ||
} |
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