update for 0.3.4
All checks were successful
/ Auto-Build-App (push) Successful in 15m35s

This commit is contained in:
pietru 2024-11-02 12:45:41 +01:00
parent 4156949e7d
commit 795204e41b
4 changed files with 112 additions and 62 deletions

View file

@ -1,16 +1,14 @@
plugins {
id "application"
id "java-library"
id "maven-publish"
}
repositories {
ivy {
name "Cosmic Reach"
url "https://github.com/CRModders/CosmicArchive/raw/main/versions/pre-alpha"
url "https://github.com/CRModders/CosmicArchive/raw/main/versions"
patternLayout {
//artifact "/Cosmic Reach-[revision].jar"
artifact "/[revision]/[classifier]/Cosmic Reach-[revision].jar"
artifact "/[revision]/[classifier]/Cosmic Reach-Server-[revision].jar"
artifact "[classifier]/[revision]/client/Cosmic-Reach-[revision].jar"
}
// This is required in Gradle 6.0+ as metadata file (ivy.xml) is mandatory
metadataSources {
@ -22,6 +20,23 @@ repositories {
}
}
ivy {
name "Cosmic Reach"
url "https://github.com/CRModders/CosmicArchive/raw/main/versions"
patternLayout {
artifact "[classifier]/[revision]/server/Cosmic-Reach-Server-[revision].jar"
}
// This is required in Gradle 6.0+ as metadata file (ivy.xml) is mandatory
metadataSources {
artifact()
}
content {
includeModule "finalforeach", "cosmicreach-server"
}
}
maven {
name "crmReleases"
url "https://maven.crmodders.dev/releases"
@ -59,20 +74,39 @@ repositories {
configurations {
cosmicreach // Config to provide the Cosmic Reach project
compileOnly.extendsFrom(cosmicreach) // Allows cosmic reach to be used in the codebase
// Config to provide the Cosmic Reach project
cosmicreach
// Config to provide the Cosmic Reach project
cosmicreachServer
// Allows cosmic reach to be used in the codebase
compileOnly.extendsFrom(cosmicreach)
compileOnly.extendsFrom(cosmicreachServer)
internal {
visible = false
canBeConsumed = false
canBeResolved = false
}
compileClasspath.extendsFrom(internal)
runtimeClasspath.extendsFrom(internal)
testCompileClasspath.extendsFrom(internal)
testRuntimeClasspath.extendsFrom(internal)
quiltMod // Config to be able to load Quilt Mods
implementation.extendsFrom(quiltMod)
}
dependencies {
// Cosmic Reach jar
cosmicreach "finalforeach:cosmicreach:${cosmic_reach_version}:${jar_type}"
cosmicreach "finalforeach:cosmicreach:${cosmic_reach_version}:pre-alpha"
cosmicreachServer "finalforeach:cosmicreach-server:${cosmic_reach_server_version? cosmic_reach_server_version: cosmic_reach_version}:pre-alpha"
// Cosmic Quilt
implementation "org.codeberg.CRModders:cosmic-quilt:${cosmic_quilt_version}"
internal "org.codeberg.CRModders:cosmic-quilt:${cosmic_quilt_version}"
// Modmenu
// internal "org.codeberg.CRModders:modmenu:${modmenu_version}"
//quiltMod "quilt-mod:fluxapi:0.5.8r2"
//quiltMod "dev.crmodders:fluxapi:${fluxapi_version}"//0.5.5
@ -125,41 +159,48 @@ processResources {
}
application {
// As Quilt is our loader, use its main class at:
mainClass = "org.quiltmc.loader.impl.launch.knot.KnotClient"
}
// Sets up all the Quilt Mods
//def String getQuiltModLocations(Configuration config) {
// StringBuilder sb = new StringBuilder()
// for (obj in config.allDependencies) {
// sb.append(File.pathSeparator + config.files(obj)[0])
// }
// return sb.toString()
//}
applicationDefaultJvmArgs = [
//"-Dloader.skipMcProvider=true", // Stops Quilt from attempting to find mappings, and all the other Minecraft stuff
"-Dloader.development=true", // Allows stuff to be found through the classpath
"-Dloader.gameJarPath=" + configurations.cosmicreach.asPath, // Defines path to Cosmic Reach
// "-Dloader.addMods=" +
// jar.archiveFile.get().asFile + // Add the jar of this project
// getQuiltModLocations(configurations.quiltMod) // Adds the jars of any Quilt mods added
]
run {
// To run this project in the game, depend on the creation of jar task
tasks.register("runClient", JavaExec) {
// We need to build the jar before we can actually run
dependsOn "jar"
// We need to use Quilt's main class so that we can actually modify the game
mainClass = "dev.crmodders.cosmicquilt.loader.knot.KnotClient"
// Tells this task the dependencies needed for it to run properly.
classpath sourceSets.main.runtimeClasspath
// Allows stuff to be found through the classpath
jvmArgs "-Dloader.development=true"
// Tells the loader where the game jar is located
jvmArgs "-Dloader.gameJarPath=" + configurations.cosmicreach.asPath
// Change the run directory
File runningDir = new File("run/")
if (!runningDir.exists())
runningDir.mkdirs()
tasks.run.workingDir = runningDir
workingDir = runningDir
}
tasks.register("runServer", JavaExec) {
// We need to build the jar before we can actually run
dependsOn "jar"
standardInput = System.in
// We need to use Quilt's main class so that we can actually modify the game
mainClass = "dev.crmodders.cosmicquilt.loader.knot.KnotServer"
// Tells this task the dependencies needed for it to run properly.
classpath sourceSets.main.runtimeClasspath
// Allows stuff to be found through the classpath
jvmArgs "-Dloader.development=true"
// Tells the loader where the game jar is located
jvmArgs "-Dloader.gameJarPath=" + configurations.cosmicreachServer.asPath
// Change the run directory
File runningDir = new File("run/")
if (!runningDir.exists())
runningDir.mkdirs()
workingDir = runningDir
}
java {

View file

@ -9,8 +9,9 @@ group=net.pietru
id=omni_power
# Dependency Versions
cosmic_reach_version=0.3.2-pre2
cosmic_quilt_version=2.0.2
jar_type=client
cosmic_reach_version=0.3.4
# If unspecified, will use the version above
cosmic_reach_server_version=0.3.4
cosmic_quilt_version=2.3.1
#fluxapi_version=0.6.0
# modmenu_version=1.0.7

View file

@ -2,6 +2,8 @@ package net.pietru.omni_power.blockevents;
import com.badlogic.gdx.utils.Array;
import finalforeach.cosmicreach.blockentities.BlockEntity;
import finalforeach.cosmicreach.blockevents.BlockEventArgs;
import finalforeach.cosmicreach.blockevents.ScheduledTrigger;
import finalforeach.cosmicreach.blockevents.actions.ActionId;
import finalforeach.cosmicreach.blockevents.actions.IBlockAction;
import finalforeach.cosmicreach.blocks.BlockPosition;
@ -11,6 +13,7 @@ import finalforeach.cosmicreach.world.Zone;
import net.pietru.omni_power.OmniPower;
import net.pietru.omni_power.api.IPowerClient;
import net.pietru.omni_power.api.IPowerProducer;
import org.spongepowered.asm.mixin.Shadow;
import java.util.HashMap;
import java.util.Map;
@ -28,11 +31,9 @@ public class Power implements IBlockAction {
}
@Override
public void act(BlockState blockState, BlockEventTrigger blockEventTrigger, Zone zone, Map<String, Object> args) {
this.act(zone, (BlockPosition)args.get("blockPos"));
}
public void act(Zone zone, BlockPosition sourcePos) {
public void act(BlockEventArgs args) {
Zone zone = args.zone;
BlockPosition sourcePos = args.blockPos;
boolean source_be = false;
BlockEntity source_entity = null;
if (block_entities){
@ -56,7 +57,7 @@ public class Power implements IBlockAction {
continue;
}
if (to_check!=sourcePos || this.self_run){
runTrigger(this.triggerId,to_check,zone);
runTrigger(this.triggerId,to_check,args);
}
if (block_entities && source_be){
BlockEntity target_entity = to_check.chunk.getBlockEntity(to_check.localX,to_check.localY,to_check.localZ);
@ -72,7 +73,9 @@ public class Power implements IBlockAction {
}
}
private void runTrigger(String triggerId, BlockPosition triggerPos, Zone zone) {
private void runTrigger(String triggerId, BlockPosition triggerPos, BlockEventArgs args) {
Zone zone = args.zone;
if (triggerPos != null) {
BlockState targetBlockState = triggerPos.getBlockState();
if (targetBlockState == null) {
@ -84,11 +87,14 @@ public class Power implements IBlockAction {
return;
}
Map<String, Object> args = new HashMap<>();
args.put("blockPos", triggerPos);
BlockEventArgs newArgs = new BlockEventArgs();
newArgs.blockPos = triggerPos;
newArgs.zone = zone;
newArgs.srcBlockState = targetBlockState;
newArgs.srcIdentity = args.srcIdentity;
for (BlockEventTrigger t : customTrigger) {
t.act(targetBlockState, zone, args);
t.act(newArgs);
}
}
}

View file

@ -7,6 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable;
import com.badlogic.gdx.utils.JsonValue;
import finalforeach.cosmicreach.GameAssetLoader;
import finalforeach.cosmicreach.gamestates.InGame;
import finalforeach.cosmicreach.items.ISlotContainerParent;
import finalforeach.cosmicreach.items.ItemSlot;
import finalforeach.cosmicreach.items.containers.SlotContainer;
import finalforeach.cosmicreach.items.screens.BaseItemScreen;
@ -28,7 +29,8 @@ public class CustomScreen extends BaseItemScreen {
SlotContainer container;
CustomUIBlockEntity blockEntity;
public CustomScreen(final CustomUIBlockEntity be, final String ui_id) {
public CustomScreen(ISlotContainerParent parent,final CustomUIBlockEntity be, final String ui_id) {
super(parent);
if (!OmniPower.uis.containsKey(ui_id)) {
System.out.println("Omni Power [ERROR] Tried accessing/opening non existent ui data.");
@ -51,7 +53,7 @@ public class CustomScreen extends BaseItemScreen {
for (int i = 0; i<slotWidgets.length;i++){
if (slotWidgets[i]==null)
slotWidgets[i]=new ItemSlotWidget(container,container.getSlot(i));
slotWidgets[i]=new ItemSlotWidget(parent,container,i);
}
@ -83,13 +85,13 @@ public class CustomScreen extends BaseItemScreen {
slot.setOutputOnly(is_output);
ItemSlotWidget slotWidget;
if (slot.isOutputOnly())
slotWidget = new ItemSlotWidget(screen.container, slot,
slotWidget = new ItemSlotWidget(screen.parent, screen.container, slot.getSlotId(),
new NinePatchDrawable(UI.containerOutput9Patch),
new NinePatchDrawable(UI.containerOutput9PatchHovered),
new NinePatchDrawable(UI.containerSelected9Patch)
);
else
slotWidget = new ItemSlotWidget(screen.container, slot);
slotWidget = new ItemSlotWidget(screen.parent,screen.container, slot.getSlotId());
screen.slotWidgets[n] = slotWidget;
table.add(slotWidget);
}
@ -103,7 +105,7 @@ public class CustomScreen extends BaseItemScreen {
if (!UI.openContainers.contains(container, true)) {
UI.itemCatalog.show();
UI.openContainers.add(container);
final CustomScreen screen = new CustomScreen(be, ui_id);
final CustomScreen screen = new CustomScreen(be, be, ui_id);
InGame.IN_GAME.openedMainItemScreen = screen;
InGame.IN_GAME.addBaseItemScreen(screen);
Action perFrameAct = new Action() {