Skip to content

Commit

Permalink
Merge pull request #9 from Srdjan-V/develop
Browse files Browse the repository at this point in the history
Update 2.0.0
  • Loading branch information
Srdjan-V authored Apr 19, 2024
2 parents ee467c9 + 2281a64 commit b1e3a96
Show file tree
Hide file tree
Showing 51 changed files with 1,694 additions and 884 deletions.
Binary file added HEI_gui.xcf
Binary file not shown.
393 changes: 229 additions & 164 deletions build.gradle

Large diffs are not rendered by default.

File renamed without changes.
37 changes: 37 additions & 0 deletions examples/GroovyScript/Reservoirs.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//Register an power tier
var power = mods.tweakedMods.PowerTier.recipeBuilder()
.capacity(5555555)
.rft(5)
.register()

/*
This method will register a reservoir with the chance to drain fluid from the chunk.
If drainChance is set to 0.25 it will have a 25% chance to drain from the chunk
If drainChance is set to 0.5 it will have a 50% chance to drain from the chunk
If drainChance is set to 1 it will have a 100% chance to drain from the chunk, its the same as registering it normally
*/

//Register an fluid reservoir
mods.tweakedMods.FluidReservoir.recipeBuilder()
.name("GroovyFluidReservoir")
.fluid(fluid("lava"))
.weight(80000)
.powerTier(power)
.minSize(50)
.maxSize(1500)
.pumpSpeed(10)
.replenishRate(5)
.register()

//Remove the default IE water reservoir
mods.tweakedMods.FluidReservoir.remove("water")

//Modify the default IP lava reservoir
mods.tweakedMods.FluidReservoir.get("lava").toBuilder()
.drainChance(0.8).maxSize(Integer.MAX_VALUE).register()

/*
Groovy compat is located in 'io.github.srdjanv.tweakedpetroleum.common.compat.groovy'
Also see https://cleanroommc.com/groovy-script/
*/
22 changes: 10 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@
org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false

hei_version = 4.24.7

# Mod Information
tweaked_lib_version = 1.0.0
tweaked_lib_version = 2.0.0
groovy_script_version = 1.0.1

mod_version = 1.3.0
maven_group = srki2k
mod_version = 2.0.0
maven_group = io.github.srdjanv
archives_base_name = tweakedpetroleum


# Optionial Jar compiling
build_deobfJar = false
build_apiJar = false
build_sourceJar = true


# If any properties changes below this line, run `gradlew setupDecompWorkspace` and refresh gradle again to ensure everything is working correctly.

# Boilerplate Options
use_mixins = true
use_coremod = true
use_assetmover = false
has_access_transformer = false

# Access Transformer files should be in the root of `resources` folder and with the filename formatted as: `{archives_base_name}_at.cfg`
use_access_transformer = false

# Coremod Arguments
include_mod = true
coremod_plugin_class_name = srki2k.tweakedpetroleum.core.TweakedPetroleumPlugin
coremod_plugin_class_name = io.github.srdjanv.tweakedpetroleum.core.TweakedPetroleumPlugin
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 12 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
23 changes: 16 additions & 7 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name 'FancyGradle'
url 'https://gitlab.com/api/v4/projects/26758973/packages/maven'
}
maven {
name 'ForgeGradle 5'
url 'https://maven.minecraftforge.net'
// RetroFuturaGradle
name = "GTNH Maven"
url = uri("http://jenkins.usrv.eu:8081/nexus/content/groups/public/")
allowInsecureProtocol = true
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroup("com.gtnewhorizons.retrofuturagradle")
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}

plugins {
// Automatic toolchain provisioning
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
package srki2k.tweakedpetroleum;
package io.github.srdjanv.tweakedpetroleum;

import io.github.srdjanv.tweakedlib.api.integration.DiscoveryHandler;
import io.github.srdjanv.tweakedpetroleum.util.TweakedPetroleumErrorLogging;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.ConfigManager;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import srki2k.tweakedpetroleum.common.DefaultReservoirs;
import srki2k.tweakedpetroleum.util.TweakedPetroleumErrorLogging;


@Mod(modid = TweakedPetroleum.MODID,
version = TweakedPetroleum.VERSION,
name = "Tweaked Petroleum",
dependencies = "required-after:immersivepetroleum;" +
"required-after:crafttweaker;" +
"required-after:tweakedlib@[@TWEAKEDLIB@,)")
"required-after:tweakedlib@[" + Tags.TWEAKED_LIB_VERSION + ",)")
public class TweakedPetroleum {

public static final String MODID = "tweakedpetroleum";
public static final String VERSION = "@VERSION@";
public static final String VERSION = Tags.VERSION;

public static final Logger LOGGER = LogManager.getLogger(MODID);

Expand All @@ -36,12 +38,17 @@ public void onConfigChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
DiscoveryHandler.getInstance().preInit(event);
}

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
DefaultReservoirs.init();
TweakedPetroleumErrorLogging.register();
DiscoveryHandler.getInstance().init(event);
}

@Mod.EventHandler
public void postInit(final FMLPostInitializationEvent event) {
DiscoveryHandler.getInstance().postInit(event);
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package srki2k.tweakedpetroleum.api.crafting;
package io.github.srdjanv.tweakedpetroleum.api.crafting;

import blusunrize.immersiveengineering.api.DimensionChunkCoords;
import flaxbeard.immersivepetroleum.api.crafting.PumpjackHandler;
import io.github.srdjanv.tweakedlib.api.powertier.PowerTier;
import io.github.srdjanv.tweakedlib.api.powertier.PowerTierHandler;
import io.github.srdjanv.tweakedpetroleum.api.mixins.ITweakedPetReservoirType;
import net.minecraft.world.World;
import srki2k.tweakedlib.api.powertier.PowerTier;
import srki2k.tweakedlib.api.powertier.PowerTierHandler;
import srki2k.tweakedpetroleum.api.ihelpers.IReservoirType;

import static flaxbeard.immersivepetroleum.api.crafting.PumpjackHandler.*;

Expand All @@ -27,7 +27,7 @@ public static PowerTier getPowerTier(World world, int chunkX, int chunkZ) {
return PowerTierHandler.getFallbackPowerTier();
}

IReservoirType tweakedReservoirType = (IReservoirType) info.getType();
ITweakedPetReservoirType tweakedReservoirType = (ITweakedPetReservoirType) info.getType();
return PowerTierHandler.getPowerTier(tweakedReservoirType.getPowerTier());
}

Expand All @@ -44,11 +44,11 @@ public static PowerTier getPowerTier(World world, int chunkX, int chunkZ) {
* @param powerTier The tier of power usage
* @return The created TweakedReservoirType
*/
public static IReservoirType addTweakedReservoir(String name, String fluid, int minSize, int maxSize, int replenishRate, int pumpSpeed, int weight, int powerTier) {
public static ITweakedPetReservoirType addTweakedReservoir(String name, String fluid, int minSize, int maxSize, int replenishRate, int pumpSpeed, int weight, int powerTier) {
ReservoirType mix = new ReservoirType(name, fluid, minSize, maxSize, replenishRate);
reservoirList.put(mix, weight);

IReservoirType iMix = (IReservoirType) mix;
ITweakedPetReservoirType iMix = (ITweakedPetReservoirType) mix;
iMix.setPumpSpeed(pumpSpeed);
iMix.setPowerTier(powerTier);

Expand All @@ -71,7 +71,7 @@ public static int[] getReplenishRateAndPumpSpeed(World world, int chunkX, int ch
return replenishRateAndPumpSpeed;
}

IReservoirType tweakedReservoirType = (IReservoirType) info.getType();
ITweakedPetReservoirType tweakedReservoirType = (ITweakedPetReservoirType) info.getType();

if (tweakedReservoirType.getPumpSpeed() == 0) {
return replenishRateAndPumpSpeed;
Expand Down Expand Up @@ -117,8 +117,9 @@ public static ReservoirContent getReservoirContent(World world, int chunkX, int
return ReservoirContent.EMPTY;
}

return ((IReservoirType) info.getType()).getReservoirContent();
return ((ITweakedPetReservoirType) info.getType()).getReservoirContent();
}

public enum ReservoirContent {
LIQUID, GAS, EMPTY, DEFAULT
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package srki2k.tweakedpetroleum.api.ihelpers;
package io.github.srdjanv.tweakedpetroleum.api.mixins;

import srki2k.tweakedpetroleum.api.crafting.TweakedPumpjackHandler;
import io.github.srdjanv.tweakedpetroleum.api.crafting.TweakedPumpjackHandler;

public interface IPumpjackAddons {
public interface ITweakedPetPumpjackAddons {

void initEnergyStorage();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.github.srdjanv.tweakedpetroleum.api.mixins;

public interface ITweakedPetReservoirType extends ITweakedPetReservoirTypeGetters, ITweakedPetReservoirTypeSetters {

}


Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.github.srdjanv.tweakedpetroleum.api.mixins;

import io.github.srdjanv.tweakedpetroleum.api.crafting.TweakedPumpjackHandler;

public interface ITweakedPetReservoirTypeGetters {
String getName();

String getStringFluid();

int getMinSize();

int getMaxSize();

int getReplenishRate();

int getPowerTier();

int getPumpSpeed();

float getDrainChance();

int[] getDimensionWhitelist();

int[] getDimensionBlacklist();

String[] getBiomeWhitelist();

String[] getBiomeBlacklist();

TweakedPumpjackHandler.ReservoirContent getReservoirContent();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.github.srdjanv.tweakedpetroleum.api.mixins;

import io.github.srdjanv.tweakedpetroleum.api.crafting.TweakedPumpjackHandler;

public interface ITweakedPetReservoirTypeSetters {
void setDimensionWhitelist(int[] dimWhitelist);

void setDimensionBlacklist(int[] biomeBlacklistList);

void setBiomeBlacklist(String[] dimBlacklist);

void setBiomeWhitelist(String[] biomeWhitelistList);

void setReservoirContent(TweakedPumpjackHandler.ReservoirContent reservoirContents);

void setPowerTier(int i);

void setPumpSpeed(int i);

void setDrainChance(float f);
}
Loading

0 comments on commit b1e3a96

Please sign in to comment.