fix: infinite recursion with exploding gas
All checks were successful
ci/woodpecker/tag/central-override Pipeline was successful

This commit is contained in:
LordMZTE 2024-08-27 15:39:21 +02:00
parent 707daa39e4
commit 9c60425829
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
4 changed files with 70 additions and 39 deletions

View file

@ -15,32 +15,44 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.0.+') {
changing = true
}
}
}
apply plugin: 'scala'
apply plugin: 'forge'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = "1.2.3.0-BETA"
group= "emasher" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
group = "emasher" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "EngineersToolbox"
minecraft {
version = "1.7.10-10.13.4.1490-1.7.10"
version = "1.7.10-10.13.4.1614-1.7.10"
runDir = "run"
}
repositories {
maven {
name 'CB Maven FS'
url "http://chickenbones.net/maven/"
url = "https://s3.tilera.xyz/cdn/minecraft/libs/"
metadataSources { artifact() }
}
maven { url = "https://maven.tilera.xyz" }
maven {
name "central"
url "https://nexus.covers1624.net/repository/maven-hosted/"
}
}
dependencies {
provided "codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev"
provided "codechicken:CodeChickenCore:1.7.10-1.0.7.46:dev"
provided "codechicken:NotEnoughItems:1.7.10-1.0.5.110:dev"
implementation "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev"
implementation "codechicken:CodeChickenCore:1.7.10-1.0.7.48:dev"
implementation "codechicken:CodeChickenLib:1.7.10-1.1.3.141:dev"
}
sourceSets {
@ -54,38 +66,49 @@ sourceSets {
}
}
sourceSets.main.compileClasspath += [configurations.provided]
idea {
module{
scopes.PROVIDED.plus += [configurations.provided]
}
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
filesMatching('mcmod.info') {
expand 'version':project.version, 'mcversion':project.minecraft.version
}
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
publishing {
tasks.publish.dependsOn 'build'
publications {
mavenJava(MavenPublication) {
artifactId = project.archivesBaseName
artifact deobfJar
artifact sourcesJar
artifact jar
}
}
repositories {
if (project.hasProperty('mvnURL')) {
maven {
credentials {
username findProperty("mvnUsername")
password findProperty("mvnPassword")
}
url = findProperty("mvnURL")
}
}
else {
mavenLocal()
}
}
}
reobf {deobfFile = new net.minecraftforge.gradle.delayed.DelayedFile(project, "build/tmp/deobfBinJar/deobfed.jar") }
sourceSets {
main {
output.resourcesDir = output.classesDir
}
}
allprojects{
sourceCompatibility=1.7
targetCompatibility=1.7
}

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip

0
gradlew vendored Normal file → Executable file
View file

View file

@ -24,6 +24,7 @@ public abstract class BlockGasGeneric extends BlockContainer implements IFluidBl
public boolean canBurn;
public boolean isDestructive;
public Fluid blocksFluid;
public boolean explodeNextTick = false;
public BlockGasGeneric( int lightOpacity, boolean canExplode ) {
super( Material.circuits );
@ -61,9 +62,8 @@ public abstract class BlockGasGeneric extends BlockContainer implements IFluidBl
public void contactFire( World world, int x, int y, int z ) {
if( canExplode && emasher.util.Config.gasBlocksCanExplode() ) {
world.setBlockToAir( x, y, z );
world.removeTileEntity( x, y, z );
world.createExplosion( null, x, y, z, 4, true );
this.explodeNextTick = true;
world.scheduleBlockUpdate( x, y, z, this, 0 );
} else if( canBurn ) {
int tempY = y - 1;
while( world.getBlock( x, tempY, z ) == this || world.getBlock( x, tempY, z ) == Blocks.air || world.getBlock( x, tempY, z ).isReplaceable( world, x, tempY, z ) ) {
@ -77,7 +77,15 @@ public abstract class BlockGasGeneric extends BlockContainer implements IFluidBl
world.setBlock( x, tempY, z, Blocks.fire );
}
}
@Override
public void updateTick( World world, int x, int y, int z, Random rand ) {
if ( this.explodeNextTick ) {
world.setBlockToAir( x, y, z );
world.removeTileEntity( x, y, z );
world.createExplosion( null, x, y, z, 4, true );
}
}
@Override
public boolean isReplaceable( IBlockAccess world, int i, int j, int k ) {