aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle41
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java14
2 files changed, 35 insertions, 20 deletions
diff --git a/build.gradle b/build.gradle
index c8cf37cd1f..5e787403a3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,4 @@
-//version: 1644894948
+//version: 1650343995
/*
DO NOT CHANGE THIS FILE!
@@ -6,12 +6,11 @@ Also, you may replace this file at any time if there is an update available.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/
-import org.gradle.internal.logging.text.StyledTextOutput
-import org.gradle.internal.logging.text.StyledTextOutputFactory
-import org.gradle.internal.logging.text.StyledTextOutput.Style
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+import org.gradle.internal.logging.text.StyledTextOutput.Style
+import org.gradle.internal.logging.text.StyledTextOutputFactory
import java.util.concurrent.TimeUnit
@@ -104,6 +103,7 @@ checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
+boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
@@ -214,13 +214,17 @@ else {
def arguments = []
def jvmArguments = []
-if(usesMixins.toBoolean()) {
+if (usesMixins.toBoolean()) {
arguments += [
- "--tweakClass org.spongepowered.asm.launch.MixinTweaker"
- ]
- jvmArguments += [
- "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
+ "--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
+ if (usesMixinDebug.toBoolean()) {
+ jvmArguments += [
+ "-Dmixin.debug.countInjections=true",
+ "-Dmixin.debug.verbose=true",
+ "-Dmixin.debug.export=true"
+ ]
+ }
}
minecraft {
@@ -312,18 +316,23 @@ def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfig
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
task generateAssets {
- if(usesMixins.toBoolean()) {
- getFile("/src/main/resources/mixins." + modId + ".json").text = """{
+ if (usesMixins.toBoolean()) {
+ def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
+ if (!mixinConfigFile.exists()) {
+ mixinConfigFile.text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
"plugin": "${modGroup}.${mixinPlugin}",
"refmap": "${mixingConfigRefMap}",
"target": "@env(DEFAULT)",
- "compatibilityLevel": "JAVA_8"
+ "compatibilityLevel": "JAVA_8",
+ "mixins": [],
+ "client": [],
+ "server": []
}
-
"""
+ }
}
}
@@ -462,7 +471,7 @@ def getManifestAttributes() {
}
task sourcesJar(type: Jar) {
- from (sourceSets.main.allJava)
+ from (sourceSets.main.allSource)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
@@ -517,7 +526,7 @@ task devJar(type: Jar) {
}
task apiJar(type: Jar) {
- from (sourceSets.main.allJava) {
+ from (sourceSets.main.allSource) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
@@ -559,7 +568,7 @@ publishing {
artifact source: shadowJar, classifier: ""
}
if(!noPublishedSources) {
- artifact source: sourcesJar, classifier: "src"
+ artifact source: sourcesJar, classifier: "sources"
}
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
if (apiPackage) {
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 5d62a112aa..588a19e97b 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -54,6 +54,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@@ -219,6 +220,12 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, getEUCapacity() - getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), false, false, false), true);
}
+ protected boolean isRainPossible() {
+ BiomeGenBase biome = getBiome();
+ // see net.minecraft.client.renderer.EntityRenderer.renderRainSnow
+ return biome.rainfall > 0 && (biome.canSpawnLightningBolt() || biome.getEnableSnow());
+ }
+
@Override
public void updateEntity() {
super.updateEntity();
@@ -359,7 +366,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
return;
}
- if (getRandomNumber(1000) == 0) {
+ if (getRandomNumber(1000) == 0 && isRainPossible()) {
final int precipitationHeightAtSide2 = worldObj.getPrecipitationHeight(xCoord, zCoord - 1);
final int precipitationHeightAtSide3 = worldObj.getPrecipitationHeight(xCoord, zCoord + 1);
final int precipitationHeightAtSide4 = worldObj.getPrecipitationHeight(xCoord - 1, zCoord);
@@ -370,7 +377,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
|| (getCoverIDAtSide((byte) 3) == 0 && precipitationHeightAtSide3 - 1 < yCoord && precipitationHeightAtSide3 > -1)
|| (getCoverIDAtSide((byte) 4) == 0 && precipitationHeightAtSide4 - 1 < yCoord && precipitationHeightAtSide4 > -1)
|| (getCoverIDAtSide((byte) 5) == 0 && precipitationHeightAtSide5 - 1 < yCoord && precipitationHeightAtSide5 > -1)) {
- if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) {
+ if (GregTech_API.sMachineRainExplosions && worldObj.isRaining()) {
if (getRandomNumber(10) == 0) {
try {
GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
@@ -386,8 +393,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
mRunningThroughTick = false;
return;
}
- if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(
- 3) == 0) {
+ if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getRandomNumber(3) == 0) {
try {
GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
} catch (Exception ignored) {}