Compare commits

...
6 Commits
Author SHA1 Message Date
Pilzinsel64 1728809a8a fix single solar cell max capacity (#99) 2023-02-17 22:00:12 +01:00
miozune 0edabd4a9d Fix energy stored in Slice'N'Splice with Melodic Capacitor (#98) 2023-02-16 16:53:10 +01:00
Pilzinsel64 b5752a8338 Fix NullReferenceException at getCapacity->getBlockMetadata (#97)
* fix NullReferenceException on getBlockMetadata

* oh no-no, please be static, it's your present! :)
2023-02-10 22:23:59 +01:00
Pilzinsel64 29b0d711f7 Solar Panels: Use config for capacity RF (#94)
* make Solar Energy configurable

* spotlessApply

* calc capacity also for single solar panels

* getCapacity(,) sanity check 'panel' against null
2023-02-08 21:01:19 +01:00
Pilzinsel64 e41827fb69 fix Waila tooltip for Endergy Energy Conduits (#95) 2023-02-08 21:01:10 +01:00
D-Cysteine 628af062ba Fix for getTravelItemTravelSource (#96)
This bug does not currently have any gameplay effect, because the return value of this method is not used to determine teleport range. But we should fix it anyway.
2023-02-08 11:42:03 +01:00
6 changed files with 257 additions and 15 deletions

No files matched your search

+179 -6
View File
@@ -1,4 +1,4 @@
//version: 1675110695
//version: 1676031737
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -9,11 +9,15 @@
import com.diffplug.blowdryer.Blowdryer
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute
import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar
import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask
import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseRelation
import com.modrinth.minotaur.dependencies.ModDependency
import com.modrinth.minotaur.dependencies.VersionDependency
import cpw.mods.fml.relauncher.Side
import org.gradle.api.tasks.options.Option;
import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.jetbrains.gradle.ext.*
@@ -23,6 +27,7 @@ import java.nio.file.Paths
import java.util.concurrent.TimeUnit
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
import javax.inject.Inject
buildscript {
repositories {
@@ -66,7 +71,7 @@ plugins {
id 'com.diffplug.spotless' version '6.7.2' apply false
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.1.2'
id 'com.gtnewhorizons.retrofuturagradle' version '1.1.6'
}
boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated
@@ -186,11 +191,21 @@ configurations {
}
if (enableModernJavaSyntax.toBoolean()) {
repositories {
mavenCentral {
mavenContent {
includeGroup("me.eigenraven.java8unsupported")
}
}
}
dependencies {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
transitive = false // We only care about the 1 annotation class
}
// Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937.
patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0')
}
tasks.withType(JavaCompile).configureEach {
@@ -401,6 +416,16 @@ configurations.configureEach {
}
}
}
def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE)
if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
// Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server
if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') {
details.useVersion '2388750'
details.because 'Pick obfuscated jar'
}
}
}
}
// Ensure tests have access to minecraft classes
@@ -520,20 +545,20 @@ dependencies {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.12:processor')
if (usesMixinDebug.toBoolean()) {
runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
}
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
implementation('com.gtnewhorizon:gtnhmixins:2.1.10')
implementation('com.gtnewhorizon:gtnhmixins:2.1.12')
}
}
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
if (usesMixins.toBoolean()) {
dependencies {
kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
kapt('com.gtnewhorizon:gtnhmixins:2.1.12:processor')
}
}
}
@@ -633,9 +658,142 @@ tasks.named("processResources", ProcessResources).configure {
if (usesMixins.toBoolean()) {
from refMap
dependsOn("compileJava", "compileScala")
}
}
ext.java17Toolchain = (JavaToolchainSpec spec) -> {
spec.languageVersion.set(JavaLanguageVersion.of(17))
spec.vendor.set(JvmVendorSpec.matching("jetbrains"))
}
ext.java17DependenciesCfg = configurations.create("java17Dependencies")
ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies")
dependencies {
def lwjgl3ifyVersion = '1.1.21'
def asmVersion = '9.4'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.31')
}
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}")
java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1')
java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0")
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches")
}
ext.java17JvmArgs = [
// Java 9+ support
"--illegal-access=warn",
"-Dfile.encoding=UTF-8",
"-Djava.security.manager=allow",
"--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED",
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens", "java.base/java.text=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
"--add-modules", "jdk.dynalink",
"--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
"--add-modules", "java.sql.rowset",
"--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"
]
ext.hotswapJvmArgs = [
// DCEVM advanced hot reload
"-XX:+AllowEnhancedClassRedefinition",
"-XX:HotswapAgent=fatjar"
]
ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") {
group = "GTNH Buildscript"
description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory"
def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar'
def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")}
def targetFilename = "hotswap-agent.jar"
onlyIf {
!targetFolderProvider.get().file(targetFilename).asFile.exists()
}
doLast {
def targetFolder = targetFolderProvider.get()
targetFolder.asFile.mkdirs()
download.run {
src hsaUrl
dest targetFolder.file(targetFilename).asFile
overwrite false
tempAndMove true
}
}
}
public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
// IntelliJ doesn't seem to allow commandline arguments so we also support an env variable
private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP"));
@Input
public boolean getEnableHotswap() { return enableHotswap }
@Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger")
public boolean setEnableHotswap(boolean enable) { enableHotswap = enable }
@Inject
public RunHotswappableMinecraftTask(Side side, String superTask) {
super(side)
this.lwjglVersion = 3
this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain)
this.extraJvmArgs.addAll(project.java17JvmArgs)
this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : []))
this.classpath(project.java17PatchDependenciesCfg)
if (side == Side.CLIENT) {
this.classpath(project.minecraftTasks.lwjgl3Configuration)
}
// Use a raw provider instead of map to not create a dependency on the task
this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath))
this.classpath.filter { file ->
!file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2
}
this.classpath(project.java17DependenciesCfg)
if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) {
this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
}
}
}
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Side.CLIENT, "runClient")
runClient17Task.configure {
setup(project)
group = "Modded Minecraft"
description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge"
dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
mainClass = "GradleStart"
}
def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer")
runServer17Task.configure {
setup(project)
group = "Modded Minecraft"
description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge"
dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
mainClass = "GradleStartServer"
extraArgs.add("nogui")
}
def getManifestAttributes() {
def manifestAttributes = [:]
if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
@@ -705,7 +863,7 @@ if (usesShadowedDependencies.toBoolean()) {
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
skip()
}
for (runTask in ["runClient", "runServer"]) {
for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
tasks.named(runTask).configure {
dependsOn("shadowJar")
}
@@ -743,6 +901,7 @@ idea {
module {
downloadJavadoc = true
downloadSources = true
inheritOutputDirs = true
}
project {
settings {
@@ -753,6 +912,20 @@ idea {
"2. Run Server"(Gradle) {
taskNames = ["runServer"]
}
"1a. Run Client (Java 17)"(Gradle) {
taskNames = ["runClient17"]
}
"2a. Run Server (Java 17)"(Gradle) {
taskNames = ["runServer17"]
}
"1b. Run Client (Java 17, Hotswap)"(Gradle) {
taskNames = ["runClient17"]
envs = ["HOTSWAP": "true"]
}
"2b. Run Server (Java 17, Hotswap)"(Gradle) {
taskNames = ["runServer17"]
envs = ["HOTSWAP": "true"]
}
"3. Run Obfuscated Client"(Gradle) {
taskNames = ["runObfClient"]
}
@@ -288,6 +288,10 @@ public final class Config {
public static int maxPhotovoltaicAdvancedOutputRF = 40;
public static int maxPhotovoltaicVibrantOutputRF = 160;
public static int photovoltaicCellCapacityRF = 10000;
public static int photovoltaicAdvancedCellCapacityRF = 10000;
public static int photovoltaicVibrantCellCapacityRF = 10000;
public static int zombieGeneratorRfPerTick = 80;
public static int zombieGeneratorTicksPerBucketFuel = 12000;
@@ -808,6 +812,26 @@ public final class Config {
"Maximum output in RF/t of the Vibrant Photovoltaic Panels.")
.getInt(maxPhotovoltaicVibrantOutputRF);
photovoltaicCellCapacityRF = config.get(
sectionPower.name,
"photovoltaicCellCapacityRF",
photovoltaicCellCapacityRF,
"Maximum capacity in RF/t of the Photovoltaic Panels.").getInt(photovoltaicCellCapacityRF);
photovoltaicAdvancedCellCapacityRF = config
.get(
sectionPower.name,
"photovoltaicAdvancedCellCapacityRF",
photovoltaicAdvancedCellCapacityRF,
"Maximum capacity in RF/t of the Advanced Photovoltaic Panels.")
.getInt(photovoltaicAdvancedCellCapacityRF);
photovoltaicVibrantCellCapacityRF = config
.get(
sectionPower.name,
"photovoltaicVibrantCellCapacityRF",
photovoltaicVibrantCellCapacityRF,
"Maximum capacity in RF/t of the Vibrant Photovoltaic Panels.")
.getInt(photovoltaicVibrantCellCapacityRF);
useAlternateBinderRecipe = config
.get(
sectionRecipe.name,
@@ -54,7 +54,7 @@ public class TileSliceAndSplice extends AbstractPoweredTaskEntity {
private static final BasicCapacitor CAP_FIVE = new BasicCapacitor(
0,
POWER_PER_TICK_FIVE * 2,
Capacitors.ENDER_CAPACITOR.capacitor.getMaxEnergyStored(),
Capacitors.MELODIC_CAPACITOR.capacitor.getMaxEnergyStored(),
POWER_PER_TICK_FIVE);
public static final int POWER_PER_TICK_SIX = Config.sliceAndSpliceLevelSixPowerPerTickRF;
@@ -135,13 +135,13 @@ public class TileSliceAndSplice extends AbstractPoweredTaskEntity {
setCapacitor(CAP_SEVEN);
break;
case SILVER_CAPACITOR:
setCapacitor(CAP_ONE);
setCapacitor(CAP_EIGHT);
break;
case ENDERGETIC_CAPACITOR:
setCapacitor(CAP_TWO);
setCapacitor(CAP_NINE);
break;
case ENDERGISED_CAPACITOR:
setCapacitor(CAP_THREE);
setCapacitor(CAP_TEN);
break;
default:
break;
@@ -10,6 +10,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.EnergyStorage;
import com.google.common.collect.Lists;
import crazypants.enderio.config.Config;
public class SolarPanelNetwork {
@@ -17,6 +18,7 @@ public class SolarPanelNetwork {
private boolean empty = true;
private EnergyStorage energy;
private boolean hasAppliedMaxEnergyConfig = false;
public static final int ENERGY_PER = 10000;
@@ -25,12 +27,13 @@ public class SolarPanelNetwork {
public SolarPanelNetwork() {
panels = Lists.newArrayList();
energy = new EnergyStorage(ENERGY_PER);
energy = new EnergyStorage(getCapacity());
}
SolarPanelNetwork(TileEntitySolarPanel initial) {
this();
panels.add(initial);
energy.setCapacity(getCapacity(initial, 1));
empty = false;
}
@@ -83,8 +86,49 @@ public class SolarPanelNetwork {
destroyNetwork();
}
private int getCapacity() {
int capacity = ENERGY_PER;
if (panels.size() > 0) {
TileEntitySolarPanel masterPanel = getMaster();
capacity = getCapacity(masterPanel, panels.size());
}
return capacity;
}
private int getCapacity(TileEntitySolarPanel panel, int panelsCount) {
int capacity = ENERGY_PER;
if (panel != null && panel.hasWorldObj()) {
int meta = panel.getBlockMetadata();
switch (meta) {
case 0: // Default
capacity = Config.photovoltaicCellCapacityRF;
break;
case 1: // Advanced
capacity = Config.photovoltaicAdvancedCellCapacityRF;
break;
case 2: // Vibrant
capacity = Config.photovoltaicVibrantCellCapacityRF;
break;
}
hasAppliedMaxEnergyConfig = true;
}
capacity = capacity * panelsCount;
return capacity;
}
private void updateEnergyIfNeeded() {
if (!hasAppliedMaxEnergyConfig) {
updateEnergy();
}
}
private void updateEnergy() {
energy.setCapacity(ENERGY_PER * panels.size());
energy.setCapacity(getCapacity());
energy.setMaxExtract(energy.getMaxEnergyStored());
}
@@ -119,6 +163,7 @@ public class SolarPanelNetwork {
}
public int setEnergyStored(int energy) {
updateEnergyIfNeeded();
if (isValid()) {
this.energy.setEnergyStored(energy);
}
@@ -554,8 +554,8 @@ public class TravelController {
return null;
}
ItemStack equipped = ep.getCurrentEquippedItem();
if (equipped.getItem() instanceof ItemTravelStaff) {
if (((ItemTravelStaff) equipped.getItem()).isActive(ep, equipped)) {
if (equipped.getItem() instanceof ItemTeleportStaff) {
if (((ItemTeleportStaff) equipped.getItem()).isActive(ep, equipped)) {
return TravelSource.TELEPORT_STAFF;
}
} else if (equipped.getItem() instanceof IItemOfTravel) {
@@ -301,7 +301,7 @@ public class WailaCompat implements IWailaDataProvider {
return;
}
if (itemStack.getItem() == EnderIO.itemPowerConduit) {
if (itemStack.getItem() == EnderIO.itemPowerConduit || itemStack.getItem() == EnderIO.itemPowerConduitEndergy) {
NBTTagCompound nbtRoot = _accessor.getNBTData();
if (nbtRoot.hasKey("storedEnergyRF")) {
int stored = nbtRoot.getInteger("storedEnergyRF");