-
-
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.
feat: added kubejs support back in for Neoforge
- Loading branch information
1 parent
2284fff
commit e203d51
Showing
10 changed files
with
81 additions
and
83 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,5 +1,5 @@ | ||
## 6.0.0 | ||
## 6.0.1 | ||
|
||
### Changed | ||
### Added | ||
|
||
- Updated to 1.20.4 | ||
- Added kubejs support back in for NeoForge as KubeJS no longer supports Forge or Fabric |
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
62 changes: 0 additions & 62 deletions
62
common/src/main/java/com/sunekaer/sdrp/integration/kubejs/SDRPKubeJSIntegration.java
This file was deleted.
Oops, something went wrong.
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
63 changes: 63 additions & 0 deletions
63
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.sunekaer.sdrp.integration.kubejs; | ||
|
||
|
||
import com.sunekaer.sdrp.neoforge.kubejs.SDRPKubeJSWrapper; | ||
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); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...integration/kubejs/SDRPKubeJSWrapper.java → ...rp/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