-
Notifications
You must be signed in to change notification settings - Fork 4
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
11 changed files
with
178 additions
and
2 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
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/pancake/surviving_the_aftermath/compat/kubejs/ModKubeJSPlugin.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,12 @@ | ||
package com.pancake.surviving_the_aftermath.compat.kubejs; | ||
|
||
import com.pancake.surviving_the_aftermath.compat.kubejs.event.AftermathEvents; | ||
import dev.latvian.mods.kubejs.KubeJSPlugin; | ||
|
||
public class ModKubeJSPlugin extends KubeJSPlugin { | ||
|
||
@Override | ||
public void registerEvents() { | ||
AftermathEvents.register(); | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
src/main/java/com/pancake/surviving_the_aftermath/compat/kubejs/event/AftermathEventJS.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,86 @@ | ||
package com.pancake.surviving_the_aftermath.compat.kubejs.event; | ||
|
||
import com.pancake.surviving_the_aftermath.api.base.BaseAftermath; | ||
import com.pancake.surviving_the_aftermath.api.base.BaseAftermathModule; | ||
import dev.latvian.mods.kubejs.event.EventJS; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.util.random.SimpleWeightedRandomList; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraftforge.eventbus.api.Cancelable; | ||
|
||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
public class AftermathEventJS extends EventJS { | ||
private final BaseAftermath<BaseAftermathModule> aftermath; | ||
private final Set<UUID> players; | ||
private final ServerLevel level; | ||
|
||
public Set<UUID> getPlayers() { | ||
return players; | ||
} | ||
|
||
public ServerLevel getLevel() { | ||
return level; | ||
} | ||
|
||
public AftermathEventJS(BaseAftermath<BaseAftermathModule> aftermath, Set<UUID> players, ServerLevel level) { | ||
this.aftermath = aftermath; | ||
this.players = players; | ||
this.level = level; | ||
} | ||
|
||
public static class StartJS extends AftermathEventJS { | ||
public StartJS(BaseAftermath<BaseAftermathModule> aftermath,Set<UUID> players, ServerLevel level) { | ||
super(aftermath,players, level); | ||
} | ||
} | ||
public static class EndJS extends AftermathEventJS { | ||
|
||
public EndJS(BaseAftermath<BaseAftermathModule> aftermath, Set<UUID> players, ServerLevel level) { | ||
super(aftermath, players, level); | ||
} | ||
} | ||
public static class ReadyJS extends AftermathEventJS { | ||
|
||
public ReadyJS(BaseAftermath<BaseAftermathModule> aftermath, Set<UUID> players, ServerLevel level) { | ||
super(aftermath, players, level); | ||
} | ||
} | ||
|
||
public static class OngoingJS extends AftermathEventJS { | ||
|
||
public OngoingJS(BaseAftermath<BaseAftermathModule> aftermath, Set<UUID> players, ServerLevel level) { | ||
super(aftermath, players, level); | ||
} | ||
} | ||
public static class VictoryJS extends AftermathEventJS { | ||
|
||
public VictoryJS(BaseAftermath<BaseAftermathModule> aftermath, Set<UUID> players, ServerLevel level) { | ||
super(aftermath, players, level); | ||
} | ||
} | ||
public static class LoseJS extends AftermathEventJS { | ||
|
||
public LoseJS(BaseAftermath<BaseAftermathModule> aftermath, Set<UUID> players, ServerLevel level) { | ||
super(aftermath, players, level); | ||
} | ||
} | ||
@Cancelable | ||
public static class CelebratingJS extends AftermathEventJS { | ||
private SimpleWeightedRandomList<Item> rewardList; | ||
|
||
public CelebratingJS(BaseAftermath<BaseAftermathModule> aftermath, Set<UUID> players, ServerLevel level,SimpleWeightedRandomList<Item> rewardList) { | ||
super(aftermath, players, level); | ||
this.rewardList = rewardList; | ||
} | ||
public SimpleWeightedRandomList<Item> getRewardList() { | ||
return rewardList; | ||
} | ||
|
||
public void setRewardList(SimpleWeightedRandomList<Item> rewardList) { | ||
this.rewardList = rewardList; | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/pancake/surviving_the_aftermath/compat/kubejs/event/AftermathEvents.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,34 @@ | ||
package com.pancake.surviving_the_aftermath.compat.kubejs.event; | ||
|
||
import dev.latvian.mods.kubejs.event.EventGroup; | ||
import dev.latvian.mods.kubejs.event.EventHandler; | ||
|
||
public interface AftermathEvents { | ||
EventGroup GROUP = EventGroup.of("AftermathEvents"); | ||
|
||
//Start | ||
EventHandler START = GROUP.server("start", () -> AftermathEventJS.StartJS.class); | ||
|
||
//End | ||
EventHandler END = GROUP.server("end", () -> AftermathEventJS.EndJS.class); | ||
|
||
//Ready | ||
EventHandler READY = GROUP.server("ready", () -> AftermathEventJS.ReadyJS.class); | ||
|
||
//Ongoing | ||
EventHandler ONGOING = GROUP.server("ongoing", () -> AftermathEventJS.OngoingJS.class); | ||
|
||
//Victory | ||
EventHandler VICTORY = GROUP.server("victory", () -> AftermathEventJS.VictoryJS.class); | ||
|
||
//Lose | ||
EventHandler LOSE = GROUP.server("lose", () -> AftermathEventJS.LoseJS.class); | ||
|
||
//Celebrating | ||
EventHandler CELEBRATING = GROUP.server("celebrating", () -> AftermathEventJS.CelebratingJS.class); | ||
|
||
static void register() { | ||
GROUP.register(); | ||
} | ||
|
||
} |
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 @@ | ||
com.pancake.surviving_the_aftermath.compat.kubejs.ModKubeJSPlugin |