diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..88a9244c --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,37 @@ +name: Java CI with Gradle + +on: [push] +jobs: + + jdk17: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: build + + - name: Locate built JARfile + id: jar + run: jarfile=$(find build/libs/ -name "*-all.jar" -not -name "*slim*" -not -name "*source*" | tr '\n' ' '); echo "jarfile=$jarfile" >> $GITHUB_OUTPUT + + - name: Set Artifact name + id: jarname + run: jarname=$(find build/libs/ -name "*-all.jar" -not -name "*slim*" -not -name "*source*" | sed 's:.*/::' | tr '\n' ' '); echo "jarname=$jarname" >> $GITHUB_OUTPUT + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.jarname.outputs.jarname }} + path: ${{ steps.jar.outputs.jarfile }} + diff --git a/build.gradle b/build.gradle index b9f0fe0f..86f3777c 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,7 @@ repositories { maven { url "https://cursemaven.com" } + maven { url = "https://api.modrinth.com/maven" } flatDir { dir 'libs' } @@ -137,6 +138,12 @@ dependencies { // The group id is ignored when searching -- in this case, it is "blank" // implementation "blank:coolmod-${mc_version}:${coolmod_version}" + implementation ('com.lovetropics.ltweather:ltweather-neoforge:1.21-1.0') + implementation ('com.lovetropics.ltextras:LTExtras:1.3.0-release+248-gha') + implementation ('com.tropicraft:Tropicraft:9.7.3-beta+688-gha') + implementation ("com.lovetropics.minigames:LTMinigames:${ltminigames_version}") + //implementation ('maven.modrinth:tropicraft:9.7.3-1.21') + implementation ("com.corosus.coroutil:coroutil-neoforge:${project.minecraft_version}.0-${project.coroutil_version}") //implementation ("com.github.stephengold:Libbulletjme:$libbulletjme_version") diff --git a/gradle.properties b/gradle.properties index 9d63b40d..8701ae73 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,3 +38,4 @@ org.gradle.parallel=true mod_authors=Corosus mod_license=All Rights Reserved +ltminigames_version=0.1.0-alpha+1140-gha \ No newline at end of file diff --git a/src/main/java/weather2/ClientTickHandler.java b/src/main/java/weather2/ClientTickHandler.java index b2bcb077..2070a5dd 100644 --- a/src/main/java/weather2/ClientTickHandler.java +++ b/src/main/java/weather2/ClientTickHandler.java @@ -20,7 +20,7 @@ import weather2.util.WindReader; import weather2.weathersystem.WeatherManagerClient; -@Mod(Weather.MODID) + public class ClientTickHandler { public static final ClientTickHandler INSTANCE = new ClientTickHandler(); diff --git a/src/main/java/weather2/ClientWeatherProxy.java b/src/main/java/weather2/ClientWeatherProxy.java index a02a973b..3346aa5c 100644 --- a/src/main/java/weather2/ClientWeatherProxy.java +++ b/src/main/java/weather2/ClientWeatherProxy.java @@ -7,6 +7,7 @@ import net.minecraft.world.phys.Vec3; import weather2.client.SceneEnhancer; import weather2.ltcompat.ClientWeatherIntegration; +import weather2.ltcompat.ServerWeatherIntegration; import weather2.weathersystem.storm.StormObject; import weather2.weathersystem.storm.WeatherObjectParticleStorm; @@ -72,6 +73,7 @@ public PrecipitationType getPrecipitationType(Biome biome) { } public float getWindSpeed() { + System.out.println("client getWindSpeed" + ClientWeatherIntegration.get().getWindSpeed()); return ClientWeatherIntegration.get().getWindSpeed(); } diff --git a/src/main/java/weather2/ServerWeatherProxy.java b/src/main/java/weather2/ServerWeatherProxy.java index f6fa247e..8fb8a2c7 100644 --- a/src/main/java/weather2/ServerWeatherProxy.java +++ b/src/main/java/weather2/ServerWeatherProxy.java @@ -8,6 +8,8 @@ public class ServerWeatherProxy { public static float getWindSpeed(ServerLevel level) { if (isWeatherEffectsServerSideControlled()) { + //System.out.println("server getWindSpeed" + ServerWeatherIntegration.getWindSpeed(level)); + //return 1f;//ServerWeatherIntegration.getWindSpeed(level); return ServerWeatherIntegration.getWindSpeed(level); } else { return -1; diff --git a/src/main/java/weather2/client/SceneEnhancer.java b/src/main/java/weather2/client/SceneEnhancer.java index e3d7d54e..578d4728 100644 --- a/src/main/java/weather2/client/SceneEnhancer.java +++ b/src/main/java/weather2/client/SceneEnhancer.java @@ -505,6 +505,8 @@ public void tickEnvironmentalParticleSpawning() { Random rand = CoroUtilMisc.random(); float windSpeed = windMan.getWindSpeed(posPlayer); + if (world.getGameTime() % 40 == 0) + //System.out.println("client wind speed: " + windSpeed + " - " + windMan.manager.getWorld().dimension() + " - " + windMan); //funnel.tickGame(); diff --git a/src/main/java/weather2/ltcompat/ClientWeatherIntegration.java b/src/main/java/weather2/ltcompat/ClientWeatherIntegration.java index 92d76c9d..d65c3975 100644 --- a/src/main/java/weather2/ltcompat/ClientWeatherIntegration.java +++ b/src/main/java/weather2/ltcompat/ClientWeatherIntegration.java @@ -1,6 +1,8 @@ package weather2.ltcompat; import weather2.datatypes.PrecipitationType; +import com.lovetropics.weather.ClientWeather; +import com.lovetropics.weather.TypeBridge; public final class ClientWeatherIntegration { private static ClientWeatherIntegration instance = new ClientWeatherIntegration(); @@ -16,7 +18,7 @@ public static void reset() { instance = new ClientWeatherIntegration(); } - public float getRainAmount() { + /*public float getRainAmount() { return 0; } @@ -46,12 +48,12 @@ public boolean isSnowstorm() { public boolean hasWeather() { return false; - } + }*/ /** * TODO: for LT, turn back on when LT is needed, activates dependency on LTWeather */ - /*public float getRainAmount() { + public float getRainAmount() { return ClientWeather.get().getRainAmount(); } @@ -81,5 +83,5 @@ public boolean isSnowstorm() { public boolean hasWeather() { return ClientWeather.get().hasWeather(); - }*/ + } } diff --git a/src/main/java/weather2/ltcompat/ServerWeatherIntegration.java b/src/main/java/weather2/ltcompat/ServerWeatherIntegration.java index 61ce2c67..a4a190ec 100644 --- a/src/main/java/weather2/ltcompat/ServerWeatherIntegration.java +++ b/src/main/java/weather2/ltcompat/ServerWeatherIntegration.java @@ -3,10 +3,11 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Tuple; import weather2.datatypes.StormState; +import com.lovetropics.weather.TypeBridge; public class ServerWeatherIntegration { - public static float getWindSpeed(ServerLevel level) { + /*public static float getWindSpeed(ServerLevel level) { return 0; } @@ -16,12 +17,12 @@ public static StormState getSandstormForEverywhere(ServerLevel level) { public static StormState getSnowstormForEverywhere(ServerLevel level) { return null; - } + }*/ /** * TODO: for LT, turn back on when LT is needed, activates dependency on LTWeather */ - /*public static float getWindSpeed(ServerLevel level) { + public static float getWindSpeed(ServerLevel level) { return TypeBridge.getWindSpeed(level); } @@ -33,6 +34,6 @@ public static StormState getSandstormForEverywhere(ServerLevel level) { public static StormState getSnowstormForEverywhere(ServerLevel level) { Tuple data = TypeBridge.getSnowstormData(level); return data != null ? new StormState(data.getA(), data.getB()) : null; - }*/ + } } diff --git a/src/main/java/weather2/weathersystem/WeatherManager.java b/src/main/java/weather2/weathersystem/WeatherManager.java index d067b329..8e006519 100644 --- a/src/main/java/weather2/weathersystem/WeatherManager.java +++ b/src/main/java/weather2/weathersystem/WeatherManager.java @@ -74,8 +74,8 @@ public void tick() { } } - //tick wind - if (WeatherUtilConfig.listDimensionsWindEffects.contains(getWorld().dimension().location().toString())) { + //tick wind, always tick if love tropics installed, so the override on wind speed updates correctly + if (Weather.isLoveTropicsInstalled() || WeatherUtilConfig.listDimensionsWindEffects.contains(getWorld().dimension().location().toString())) { wind.tick(); } } diff --git a/src/main/java/weather2/weathersystem/storm/StormObject.java b/src/main/java/weather2/weathersystem/storm/StormObject.java index c37c3035..90d7d856 100644 --- a/src/main/java/weather2/weathersystem/storm/StormObject.java +++ b/src/main/java/weather2/weathersystem/storm/StormObject.java @@ -35,6 +35,7 @@ import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.fml.LogicalSide; import net.neoforged.fml.util.thread.EffectiveSide; +import net.tropicraft.core.common.entity.underdasea.SharkEntity; import weather2.EntityRegistry; import weather2.ServerTickHandler; import weather2.Weather; @@ -2475,9 +2476,9 @@ public void spinEntityv2(Entity entity) { if (entHeightFromBase > 90) { if (Weather.isLoveTropicsInstalled()) { //TODO: for LT, reenable or make it a soft dependency somehow - /*if (isSharknado() && entity instanceof SharkEntity) { + if (isSharknado() && entity instanceof SharkEntity) { entity.getPersistentData().putBoolean("tornado_shoot", true); - }*/ + } if (isSharknado() && entity instanceof Dolphin) { entity.getPersistentData().putBoolean("tornado_shoot", true); } diff --git a/src/main/java/weather2/weathersystem/tornado/simple/TornadoFunnelSimple.java b/src/main/java/weather2/weathersystem/tornado/simple/TornadoFunnelSimple.java index b9528c83..9684e1f1 100644 --- a/src/main/java/weather2/weathersystem/tornado/simple/TornadoFunnelSimple.java +++ b/src/main/java/weather2/weathersystem/tornado/simple/TornadoFunnelSimple.java @@ -130,7 +130,8 @@ public void tick() { * TODO: for LT, turn back on when LT is needed, activates dependency on LTWeather / Tropicraft */ //ent = new SharkEntity(TropicraftEntities.HAMMERHEAD.get(), level); - } else { + } + if (ent == null) { ent = new Dolphin(EntityType.DOLPHIN, level); } if (ent == null) { diff --git a/src/main/java/weather2/weathersystem/wind/WindManager.java b/src/main/java/weather2/weathersystem/wind/WindManager.java index 1a2ea75b..a743d7c6 100644 --- a/src/main/java/weather2/weathersystem/wind/WindManager.java +++ b/src/main/java/weather2/weathersystem/wind/WindManager.java @@ -92,7 +92,9 @@ public float getWindSpeed(@Nullable BlockPos pos) { } public float getWindSpeed(@Nullable BlockPos pos, float extraHeightAmpMax) { - if (pos != null) { + //TODO: rethink use of Weather.isLoveTropicsInstalled() here, this was added just to get wind working in LT again, but theres probably a better way to integrate it + //this is new since adding turbines after last love tropics, so somethings not accounted for correctly + if (pos != null && !Weather.isLoveTropicsInstalled()) { return getWindSpeedPositional(pos, extraHeightAmpMax); } if (windTimeEvent > 0 && (windSpeedEvent > windSpeedGust && windSpeedEvent > windSpeedGlobal)) { @@ -338,6 +340,8 @@ public void tick() { } float speedOverride = ServerWeatherProxy.getWindSpeed((ServerLevel) manager.getWorld()); + //System.out.println("tick wind speed for " + manager.getWorld().dimension() + " - " + speedOverride); + //System.out.println("tick server wind speed for " + manager.getWorld().dimension() + " - " + speedOverride + " - " + this); if (speedOverride != -1) { windSpeedGlobal = speedOverride; } @@ -651,6 +655,11 @@ public Vec3 applyWindForceImpl(Vec3 pos, Vec3 motion, float weight, float multip } public CompoundTag nbtSyncForClient() { + /*float speedOverride = ServerWeatherProxy.getWindSpeed((ServerLevel) manager.getWorld()); + System.out.println("sync wind speed for " + manager.getWorld().dimension() + " - " + speedOverride); + if (speedOverride != -1) { + windSpeedGlobal = speedOverride; + }*/ CompoundTag data = new CompoundTag(); //idea: only sync the wind data client cares about (the active priority wind) @@ -681,6 +690,8 @@ public void nbtSyncFromServer(CompoundTag parNBT) { windTimeEvent = parNBT.getInt("windTimeEvent");*/ windTimeGust = parNBT.getInt("windTimeGust"); + + //System.out.println("synced client wind speed for " + manager.getWorld().dimension() + " - " + windSpeedGlobal + " - " + this); } public Vec3 getWindForce(@Nullable BlockPos pos) {