-
-
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
1 parent
1259840
commit 787835d
Showing
5 changed files
with
92 additions
and
110 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
## 87.0.0 | ||
Update to 1.21 | ||
## 87.0.1 | ||
|
||
## 86.0.1 | ||
### Added | ||
|
||
### Changed | ||
|
||
Buttons can be added by adding the following to the mods config file. You can have up to 2 buttons. Each button can have a label up to 32 characters long. | ||
|
||
If you do not want to have buttons, you can leave the buttons array empty. | ||
|
||
```json | ||
{ | ||
"buttons": [ | ||
{ | ||
"label": "Google", | ||
"url": "https://www.google.com" | ||
}, | ||
{ | ||
"label": "Yahoo", | ||
"url": "https://www.yahoo.com" | ||
} | ||
] | ||
} | ||
``` | ||
- Added KubeJS Support back to the NeoForge version |
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
124 changes: 63 additions & 61 deletions
124
neoforge/src/main/java/com/sunekaer/sdrp/neoforge/kubejs/SDRPKubeJSIntegration.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 |
---|---|---|
@@ -1,61 +1,63 @@ | ||
//package com.sunekaer.sdrp.neoforge.kubejs; | ||
// | ||
//import dev.architectury.event.EventResult; | ||
//import dev.architectury.event.events.common.EntityEvent; | ||
//import dev.latvian.mods.kubejs.KubeJSPlugin; | ||
//import dev.latvian.mods.kubejs.event.EventGroup; | ||
//import dev.latvian.mods.kubejs.event.EventHandler; | ||
//import dev.latvian.mods.kubejs.event.EventJS; | ||
//import dev.latvian.mods.kubejs.script.BindingsEvent; | ||
//import net.minecraft.world.entity.Entity; | ||
//import net.minecraft.world.entity.player.Player; | ||
//import net.minecraft.world.level.Level; | ||
//import net.minecraft.world.level.dimension.DimensionType; | ||
// | ||
//public class SDRPKubeJSIntegration extends KubeJSPlugin { | ||
// static EventGroup GROUP = EventGroup.of("sdrp"); | ||
// static EventHandler DIMENSION_CHANGE = GROUP.client("dimension_change", () -> ClientDimensionChangeEvent.class); | ||
// | ||
// public static void setup() { | ||
// EntityEvent.ADD.register(SDRPKubeJSIntegration::clientJoinEvent); | ||
// } | ||
// | ||
// @Override | ||
// public void registerBindings(BindingsEvent event) { | ||
// event.add("SDRP", SDRPKubeJSWrapper.class); | ||
// } | ||
// | ||
// @Override | ||
// public void registerEvents() { | ||
// GROUP.register(); | ||
// } | ||
// | ||
// private static EventResult clientJoinEvent(Entity entity, Level level) { | ||
// if (!(entity instanceof Player player)) { | ||
// return EventResult.pass(); | ||
// } | ||
// | ||
// if (!level.isClientSide) { | ||
// return EventResult.pass(); | ||
// } | ||
// | ||
// DIMENSION_CHANGE.post(new ClientDimensionChangeEvent(level.dimensionType(), player, level)); | ||
// return EventResult.pass(); | ||
// } | ||
// | ||
// public static class ClientDimensionChangeEvent extends EventJS { | ||
// public DimensionType dimensionType; | ||
// public Player player; | ||
// public Level level; | ||
// | ||
// public ClientDimensionChangeEvent(DimensionType dimensionType, Player player, Level level) { | ||
// this.dimensionType = dimensionType; | ||
// this.player = player; | ||
// this.level = level; | ||
// } | ||
// | ||
// public void updateSDRPState(String message, String imageName, String imageKey) { | ||
// SDRPKubeJSWrapper.setState(message, imageName, imageKey); | ||
// } | ||
// } | ||
//} | ||
package com.sunekaer.sdrp.neoforge.kubejs; | ||
|
||
import dev.architectury.event.EventResult; | ||
import dev.architectury.event.events.common.EntityEvent; | ||
import dev.latvian.mods.kubejs.event.EventGroup; | ||
import dev.latvian.mods.kubejs.event.EventGroupRegistry; | ||
import dev.latvian.mods.kubejs.event.EventHandler; | ||
import dev.latvian.mods.kubejs.event.KubeEvent; | ||
import dev.latvian.mods.kubejs.plugin.KubeJSPlugin; | ||
import dev.latvian.mods.kubejs.script.BindingRegistry; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.dimension.DimensionType; | ||
|
||
public class SDRPKubeJSIntegration implements KubeJSPlugin { | ||
static EventGroup GROUP = EventGroup.of("sdrp"); | ||
static EventHandler DIMENSION_CHANGE = GROUP.client("dimension_change", () -> ClientDimensionChangeEvent.class); | ||
|
||
public static void setup() { | ||
EntityEvent.ADD.register(SDRPKubeJSIntegration::clientJoinEvent); | ||
} | ||
|
||
|
||
@Override | ||
public void registerBindings(BindingRegistry event) { | ||
event.add("SDRP", SDRPKubeJSWrapper.class); | ||
} | ||
|
||
@Override | ||
public void registerEvents(EventGroupRegistry registry) { | ||
registry.register(GROUP); | ||
} | ||
|
||
private static EventResult clientJoinEvent(Entity entity, Level level) { | ||
if (!(entity instanceof Player player)) { | ||
return EventResult.pass(); | ||
} | ||
|
||
if (!level.isClientSide) { | ||
return EventResult.pass(); | ||
} | ||
|
||
DIMENSION_CHANGE.post(new ClientDimensionChangeEvent(level.dimensionType(), player, level)); | ||
return EventResult.pass(); | ||
} | ||
|
||
public static class ClientDimensionChangeEvent implements KubeEvent { | ||
public DimensionType dimensionType; | ||
public Player player; | ||
public Level level; | ||
|
||
public ClientDimensionChangeEvent(DimensionType dimensionType, Player player, Level level) { | ||
this.dimensionType = dimensionType; | ||
this.player = player; | ||
this.level = level; | ||
} | ||
|
||
public void updateSDRPState(String message, String imageName, String imageKey) { | ||
SDRPKubeJSWrapper.setState(message, imageName, imageKey); | ||
} | ||
} | ||
} |
34 changes: 17 additions & 17 deletions
34
neoforge/src/main/java/com/sunekaer/sdrp/neoforge/kubejs/SDRPKubeJSWrapper.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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
//package com.sunekaer.sdrp.neoforge.kubejs; | ||
// | ||
//import com.jagrosh.discordipc.entities.RichPresence; | ||
//import com.sunekaer.sdrp.discord.State; | ||
//import net.minecraft.client.resources.language.I18n; | ||
// | ||
//import static com.sunekaer.sdrp.SDRP.RP_CLIENT; | ||
// | ||
//public class SDRPKubeJSWrapper { | ||
// public static void setState(String message, String imageName, String imageKey) { | ||
// RP_CLIENT.setState(new State(I18n.get(message), I18n.get(imageName), imageKey).createPresence()); | ||
// } | ||
// | ||
// public static RichPresence getCurrentState() { | ||
// return RP_CLIENT.getCurrentState(); | ||
// } | ||
//} | ||
package com.sunekaer.sdrp.neoforge.kubejs; | ||
|
||
import com.jagrosh.discordipc.entities.RichPresence; | ||
import com.sunekaer.sdrp.discord.State; | ||
import net.minecraft.client.resources.language.I18n; | ||
|
||
import static com.sunekaer.sdrp.SDRP.RP_CLIENT; | ||
|
||
public class SDRPKubeJSWrapper { | ||
public static void setState(String message, String imageName, String imageKey) { | ||
RP_CLIENT.setState(new State(I18n.get(message), I18n.get(imageName), imageKey).createPresence()); | ||
} | ||
|
||
public static RichPresence getCurrentState() { | ||
return RP_CLIENT.getCurrentState(); | ||
} | ||
} |