-
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
14 changed files
with
111 additions
and
22 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
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
24 changes: 24 additions & 0 deletions
24
src/main/java/com/pancake/surviving_the_aftermath/compat/kubejs/ModExtra.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 com.pancake.surviving_the_aftermath.compat.kubejs; | ||
|
||
import com.pancake.surviving_the_aftermath.api.aftermath.AftermathAPI; | ||
import com.pancake.surviving_the_aftermath.api.module.IAftermathModule; | ||
import dev.latvian.mods.kubejs.event.Extra; | ||
|
||
import java.util.List; | ||
|
||
public class ModExtra{ | ||
protected static final AftermathAPI API = AftermathAPI.getInstance(); | ||
|
||
public static final Extra AFTERMATH_TYPE = new Extra().transformer(ModExtra::toRegistryAftermath); | ||
|
||
|
||
private static List<IAftermathModule> toRegistryAftermath(Object object){ | ||
if (object == null) { | ||
return null; | ||
} | ||
if (object instanceof String str) { | ||
return API.getAftermathModules(str); | ||
} | ||
return null; | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
.../java/com/pancake/surviving_the_aftermath/compat/kubejs/event/AftermathModifyEventJS.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,32 @@ | ||
package com.pancake.surviving_the_aftermath.compat.kubejs.event; | ||
|
||
import com.pancake.surviving_the_aftermath.api.module.IAftermathModule; | ||
import dev.latvian.mods.kubejs.event.EventJS; | ||
|
||
import java.util.List; | ||
|
||
public class AftermathModifyEventJS extends EventJS { | ||
private final String identifier; | ||
private final List<IAftermathModule> aftermathModules; | ||
|
||
public AftermathModifyEventJS(String identifier, List<IAftermathModule> aftermathModules) { | ||
this.identifier = identifier; | ||
this.aftermathModules = aftermathModules; | ||
} | ||
|
||
public String getIdentifier() { | ||
return identifier; | ||
} | ||
|
||
public List<IAftermathModule> getAftermathModules() { | ||
return aftermathModules; | ||
} | ||
|
||
public void remove(String JsonName) { | ||
aftermathModules.removeIf(aftermathModule -> aftermathModule.getJsonName().equals(JsonName)); | ||
} | ||
|
||
public void add(IAftermathModule aftermathModule) { | ||
aftermathModules.add(aftermathModule); | ||
} | ||
} |