diff --git a/.gitignore b/.gitignore index ad6bc2b5f..a8f2e903f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ /.gradle/ +/bin/ /build/ -/instance/ /eclipse/ +/lib/ +/.git/ +/.gradle/ +/.settings/ /.classpath -/.gradletasknamecache /.project -/.settings/org.eclipse.jdt.core.prefs diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location deleted file mode 100644 index e69de29bb..000000000 diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree deleted file mode 100644 index 897e2b847..000000000 Binary files a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree and /dev/null differ diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 466d7f93a..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sun Jun 05 18:58:07 CEST 2011 -version=1 -eclipse.preferences.version=1 -refresh.enabled=true diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs deleted file mode 100644 index 94c56761d..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sun Jun 05 19:03:53 CEST 2011 -eclipse.preferences.version=1 -org.eclipse.debug.ui.UseContextualLaunch=false -Console.highWaterMark=88000 -org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\r\n\r\n -org.eclipse.debug.ui.user_view_bindings=\r\n\r\n\r\n\r\n\r\n\r\n -StringVariablePreferencePage=130,107,107,86, diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs deleted file mode 100644 index 333b99153..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun Jun 05 18:58:07 CEST 2011 -eclipse.preferences.version=1 -org.eclipse.epp.usagedata.gathering.enabled=false diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 593e3199f..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Sep 18 16:44:39 NZST 2011 -org.eclipse.jdt.core.compiler.compliance=1.7 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs deleted file mode 100644 index 316ef6f30..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sun Jun 05 18:58:05 CEST 2011 -spacesForTabs=true -eclipse.preferences.version=1 -overviewRuler_migration=migrated_3.1 diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs deleted file mode 100644 index ae368abb9..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sun Jun 05 18:58:07 CEST 2011 -IMPORT_FILES_AND_FOLDERS_MODE=prompt -IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE=prompt -SAVE_ALL_BEFORE_BUILD=true -eclipse.preferences.version=1 -tipsAndTricks=true -platformState=1287081747687 -quickStart=false -PROBLEMS_FILTERS_MIGRATE=true diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs b/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs deleted file mode 100644 index cbc59537b..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun Jun 05 18:50:08 CEST 2011 -eclipse.preferences.version=1 -showIntro=false diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client-Full.launch.template b/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client-Full.launch.template deleted file mode 100644 index cea00228b..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client-Full.launch.template +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client-Minimal.launch.template b/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client-Minimal.launch.template deleted file mode 100644 index 83c9daf3d..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client-Minimal.launch.template +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - -@@eclipseRuntimeClasspath@@ - - - - - - - diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server-Full.launch.template b/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server-Full.launch.template deleted file mode 100644 index 52e1a1d25..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server-Full.launch.template +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server-Minimal.launch.template b/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server-Minimal.launch.template deleted file mode 100644 index d5a8227d8..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server-Minimal.launch.template +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - -@@eclipseRuntimeClasspath@@ - - - - - - - diff --git a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml b/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml deleted file mode 100644 index 1208f602e..000000000 --- a/.meta/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build.gradle b/build.gradle index 546dc246a..d96474736 100644 --- a/build.gradle +++ b/build.gradle @@ -1,171 +1,56 @@ buildscript { - repositories { - mavenCentral() - maven { - name = "GTMaven" - url = "https://gregtech.overminddl1.com/" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - maven { - url = "https://repo1.maven.org/maven2/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - -allprojects { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked" - } -} - -apply plugin: 'eclipse' -eclipse { - classpath { - downloadJavadoc = true - downloadSources = true - } -} - -def eclipseRuntimeClasspath = "" -def eclipseRuntimeClasspathTemplate = "\n" - -task eclipseForgeWorkspace(type: Copy) { - doFirst { - sourceSets.main.runtimeClasspath.collect { - eclipseRuntimeClasspath += eclipseRuntimeClasspathTemplate.replaceAll('@@PATH@@', it.toString()) - "" - } - } - from(".meta/eclipse/.metadata") { - include '**/*.template' - rename { it.replace '.template', '' } - filter { it.replaceAll('@@eclipseRuntimeClasspath@@', eclipseRuntimeClasspath) } - //rename '(.*).template', '$1' - } - from(".meta/eclipse/.metadata") { - exclude '**/*.launch' - } - into "eclipse/.metadata" -} - -import org.apache.tools.ant.taskdefs.condition.Os -task eclipseForgeProject { - doLast { - if(!(new File("eclipse/Minecraft")).exists()) { - if(!Os.isFamily(Os.FAMILY_WINDOWS)) { - ant.symlink(resource: "../", link: "eclipse/Minecraft") - } else { - println("WINDOWS: Before loading this workspace with Eclipse, manually run this in an Elevated/Admin command prompt:") - println("mklink /D " + (new File("").absolutePath) + "/eclipse/Minecraft " + (new File("").absolutePath)) - } - } - } -} -eclipseForgeProject.dependsOn(eclipseForgeWorkspace) - -tasks.eclipse.dependsOn(eclipseForgeProject) - -apply plugin: 'idea' -idea { - module { - downloadJavadoc = true - downloadSources = true - } + repositories { + mavenCentral() + maven { + name = "forge" + url = "https://files.minecraftforge.net/maven" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + maven { + url = "https://repo1.maven.org/maven2/" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + } } apply plugin: 'forge' -version = "1.0.27" -group= "com.hbm" -archivesBaseName = "hbm" +version = "1.0" +group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = "modid" minecraft { - version = "1.7.10-10.13.4.1614-1.7.10" - runDir = "instance" -} - -sourceCompatibility = 1.7 -targetCompatibility = 1.7 -compileJava.options.bootClasspath = org.gradle.internal.jvm.Jvm.current().getJre().getHomeDir().toString() +"/lib/rt.jar" -compileJava { - options.encoding = "UTF-8" -} - -repositories { - maven { - name = "gt" - url = "https://gregtech.overminddl1.com/" - } + version = "1.7.10-10.13.4.1558-1.7.10" + runDir = "eclipse" } dependencies { - compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev" - compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev" - compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev" +compile files('lib/CodeChickenCore-1.7.10-1.0.4.29-dev.jar') +compile files('lib/CodeChickenLib-1.7.10-1.1.3.140-dev.jar') +compile files('lib/NotEnoughItems-1.7.10-1.0.3.74-dev.jar') } processResources { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} - -task sourceJar(type: Jar) { - manifest {} - classifier = 'sources' - from sourceSets.main.allSource - exclude 'assets/**' -} - -task devJar(type: Jar) { - manifest {} - classifier = 'dev' - from sourceSets.main.output -} - -artifacts { - archives devJar, sourceJar -} - -if (!hasProperty("mavenUsername")) { - ext.mavenUsername="${System.getenv().MAVEN_USERNAME}" -} - -if (!hasProperty("mavenPassword")) { - ext.mavenPassword="${System.getenv().MAVEN_PASSWORD}" -} - -if (!hasProperty("mavenURL")) { - ext.mavenURL="${System.getenv().MAVEN_URL}" -} - -uploadArchives { - repositories { - mavenDeployer { - uniqueVersion = false - repository(url: mavenURL) { - authentication(userName: mavenUsername, password: mavenPassword) - } - } - } + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 720037912..b76121670 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e640724ad..22172ad59 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Sep 21 11:31:02 MDT 2018 +#Wed Jul 02 15:54:47 CDT 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/gradlew b/gradlew index 4453ccea3..91a7e269e 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -6,30 +6,12 @@ ## ############################################################################## -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" APP_NAME="Gradle" APP_BASE_NAME=`basename "$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="" - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -48,7 +30,6 @@ die ( ) { cygwin=false msys=false darwin=false -nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -59,11 +40,31 @@ case "`uname`" in MINGW* ) msys=true ;; - NONSTOP* ) - nonstop=true - ;; esac +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -89,7 +90,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -113,7 +114,6 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat index e95643d6a..aec99730b 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,9 +46,10 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windows variants +@rem Get command-line arguments, handling Windowz variants if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -59,6 +60,11 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/src/main/java/api/hbm/energy/IBatteryItem.java b/src/main/java/api/hbm/energy/IBatteryItem.java index e0e72362d..528e5bb87 100644 --- a/src/main/java/api/hbm/energy/IBatteryItem.java +++ b/src/main/java/api/hbm/energy/IBatteryItem.java @@ -4,7 +4,7 @@ import net.minecraft.item.ItemStack; public interface IBatteryItem { - public void chargeBattery(ItemStack stack, long i); + public void chargeBattery(ItemStack stack, long i); public void setCharge(ItemStack stack, long i); public void dischargeBattery(ItemStack stack, long i); public long getCharge(ItemStack stack); diff --git a/src/main/java/assets/hbm/textures/gui/weapon/fstbmbSchematic.png b/src/main/java/assets/hbm/textures/gui/weapon/fstbmbSchematic.png new file mode 100644 index 000000000..2fd17d9c7 Binary files /dev/null and b/src/main/java/assets/hbm/textures/gui/weapon/fstbmbSchematic.png differ diff --git a/src/main/java/com/hbm/blocks/test/TestEventTester.java b/src/main/java/com/hbm/blocks/test/TestEventTester.java index 010d7e1c6..25aea7d1a 100644 --- a/src/main/java/com/hbm/blocks/test/TestEventTester.java +++ b/src/main/java/com/hbm/blocks/test/TestEventTester.java @@ -8,6 +8,8 @@ import java.util.Map.Entry; import com.hbm.blocks.ModBlocks; import com.hbm.entity.effect.EntityCloudTom; +import com.hbm.explosion.ExplosionNT; +import com.hbm.explosion.ExplosionNT.ExAttrib; import com.hbm.saveddata.RadiationSavedData; import net.minecraft.block.Block; @@ -376,10 +378,19 @@ public class TestEventTester extends Block { worldObj.spawnEntityInWorld(entityfallingblock); }*/ - if(!worldObj.isRemote) { + /*if(!worldObj.isRemote) { EntityCloudTom tom = new EntityCloudTom(worldObj, 100); tom.setPosition(par2 + 0.5, par3 + 2, par4 + 0.5); worldObj.spawnEntityInWorld(tom); + }*/ + + if(!worldObj.isRemote) { + + worldObj.setBlockToAir(par2, par3, par4); + ExplosionNT ex = new ExplosionNT(worldObj, null, par2 + 0.5, par3 + 2, par4 + 0.5, 5); + ex.addAttrib(ExAttrib.ALLDROP); + ex.doExplosionA(); + ex.doExplosionB(false); } return true; diff --git a/src/main/java/com/hbm/explosion/ExplosionNT.java b/src/main/java/com/hbm/explosion/ExplosionNT.java new file mode 100644 index 000000000..eaf55153a --- /dev/null +++ b/src/main/java/com/hbm/explosion/ExplosionNT.java @@ -0,0 +1,288 @@ +package com.hbm.explosion; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; + +import com.hbm.blocks.ModBlocks; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.enchantment.EnchantmentProtection; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; + +public class ExplosionNT extends Explosion { + + public Set atttributes = new HashSet(); + + private Random explosionRNG = new Random(); + private World worldObj; + protected int field_77289_h = 16; + protected Map affectedEntities = new HashMap(); + + public ExplosionNT(World world, Entity exploder, double x, double y, double z, float strength) { + super(world, exploder, x, y, z, strength); + this.worldObj = world; + } + + public ExplosionNT addAttrib(ExAttrib attrib) { + atttributes.add(attrib); + return this; + } + + public void doExplosionA() + { + float f = this.explosionSize; + HashSet hashset = new HashSet(); + int i; + int j; + int k; + double d5; + double d6; + double d7; + + for (i = 0; i < this.field_77289_h; ++i) + { + for (j = 0; j < this.field_77289_h; ++j) + { + for (k = 0; k < this.field_77289_h; ++k) + { + if (i == 0 || i == this.field_77289_h - 1 || j == 0 || j == this.field_77289_h - 1 || k == 0 || k == this.field_77289_h - 1) + { + double d0 = (double)((float)i / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double d1 = (double)((float)j / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double d2 = (double)((float)k / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + d0 /= d3; + d1 /= d3; + d2 /= d3; + float f1 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); + d5 = this.explosionX; + d6 = this.explosionY; + d7 = this.explosionZ; + + for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) + { + int j1 = MathHelper.floor_double(d5); + int k1 = MathHelper.floor_double(d6); + int l1 = MathHelper.floor_double(d7); + Block block = this.worldObj.getBlock(j1, k1, l1); + + if (block.getMaterial() != Material.air) + { + float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, j1, k1, l1, block) : block.getExplosionResistance(this.exploder, worldObj, j1, k1, l1, explosionX, explosionY, explosionZ); + f1 -= (f3 + 0.3F) * f2; + } + + if (f1 > 0.0F && (this.exploder == null || this.exploder.func_145774_a(this, this.worldObj, j1, k1, l1, block, f1))) + { + hashset.add(new ChunkPosition(j1, k1, l1)); + } + + d5 += d0 * (double)f2; + d6 += d1 * (double)f2; + d7 += d2 * (double)f2; + } + } + } + } + } + + this.affectedBlockPositions.addAll(hashset); + + if(!has(ExAttrib.NOHURT)) { + + this.explosionSize *= 2.0F; + i = MathHelper.floor_double(this.explosionX - (double)this.explosionSize - 1.0D); + j = MathHelper.floor_double(this.explosionX + (double)this.explosionSize + 1.0D); + k = MathHelper.floor_double(this.explosionY - (double)this.explosionSize - 1.0D); + int i2 = MathHelper.floor_double(this.explosionY + (double)this.explosionSize + 1.0D); + int l = MathHelper.floor_double(this.explosionZ - (double)this.explosionSize - 1.0D); + int j2 = MathHelper.floor_double(this.explosionZ + (double)this.explosionSize + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double)i, (double)k, (double)l, (double)j, (double)i2, (double)j2)); + net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, this.explosionSize); + Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ); + + for (int i1 = 0; i1 < list.size(); ++i1) + { + Entity entity = (Entity)list.get(i1); + double d4 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double)this.explosionSize; + + if (d4 <= 1.0D) + { + d5 = entity.posX - this.explosionX; + d6 = entity.posY + (double)entity.getEyeHeight() - this.explosionY; + d7 = entity.posZ - this.explosionZ; + double d9 = (double)MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7); + + if (d9 != 0.0D) + { + d5 /= d9; + d6 /= d9; + d7 /= d9; + double d10 = (double)this.worldObj.getBlockDensity(vec3, entity.boundingBox); + double d11 = (1.0D - d4) * d10; + entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float)((int)((d11 * d11 + d11) / 2.0D * 8.0D * (double)this.explosionSize + 1.0D))); + double d8 = EnchantmentProtection.func_92092_a(entity, d11); + entity.motionX += d5 * d8; + entity.motionY += d6 * d8; + entity.motionZ += d7 * d8; + + if (entity instanceof EntityPlayer) + { + this.affectedEntities.put((EntityPlayer)entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11)); + } + } + } + } + + this.explosionSize = f; + } + } + + public void doExplosionB(boolean p_77279_1_) + { + this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + + if (!has(ExAttrib.NOPARTICLE)) { + if (this.explosionSize >= 2.0F && this.isSmoking) + { + this.worldObj.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + else + { + this.worldObj.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + } + + Iterator iterator; + ChunkPosition chunkposition; + int i; + int j; + int k; + Block block; + + if (this.isSmoking) + { + iterator = this.affectedBlockPositions.iterator(); + + while (iterator.hasNext()) + { + chunkposition = (ChunkPosition)iterator.next(); + i = chunkposition.chunkPosX; + j = chunkposition.chunkPosY; + k = chunkposition.chunkPosZ; + block = this.worldObj.getBlock(i, j, k); + + if (!has(ExAttrib.NOPARTICLE)) + { + double d0 = (double)((float)i + this.worldObj.rand.nextFloat()); + double d1 = (double)((float)j + this.worldObj.rand.nextFloat()); + double d2 = (double)((float)k + this.worldObj.rand.nextFloat()); + double d3 = d0 - this.explosionX; + double d4 = d1 - this.explosionY; + double d5 = d2 - this.explosionZ; + double d6 = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); + d3 /= d6; + d4 /= d6; + d5 /= d6; + double d7 = 0.5D / (d6 / (double)this.explosionSize + 0.1D); + d7 *= (double)(this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F); + d3 *= d7; + d4 *= d7; + d5 *= d7; + this.worldObj.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5); + this.worldObj.spawnParticle("smoke", d0, d1, d2, d3, d4, d5); + } + + if (block.getMaterial() != Material.air) + { + if (block.canDropFromExplosion(this)) + { + float chance = 1.0F; + + if(!has(ExAttrib.ALLDROP)) + chance = 1.0F / this.explosionSize; + + block.dropBlockAsItemWithChance(this.worldObj, i, j, k, this.worldObj.getBlockMetadata(i, j, k), chance, 0); + } + + block.onBlockExploded(this.worldObj, i, j, k, this); + } + } + } + + if(has(ExAttrib.FIRE) || has(ExAttrib.BALEFIRE) || has(ExAttrib.LAVA)) + { + iterator = this.affectedBlockPositions.iterator(); + + while (iterator.hasNext()) + { + chunkposition = (ChunkPosition)iterator.next(); + i = chunkposition.chunkPosX; + j = chunkposition.chunkPosY; + k = chunkposition.chunkPosZ; + block = this.worldObj.getBlock(i, j, k); + Block block1 = this.worldObj.getBlock(i, j - 1, k); + + boolean shouldReplace = true; + + if(!has(ExAttrib.ALLMOD)) + shouldReplace = this.explosionRNG.nextInt(3) == 0; + + if (block.getMaterial() == Material.air && block1.func_149730_j() && shouldReplace) + { + if(has(ExAttrib.FIRE)) + this.worldObj.setBlock(i, j, k, Blocks.fire); + else if(has(ExAttrib.BALEFIRE)) + this.worldObj.setBlock(i, j, k, ModBlocks.balefire); + else if(has(ExAttrib.LAVA)) + this.worldObj.setBlock(i, j, k, Blocks.flowing_lava); + } + } + } + } + + public Map func_77277_b() + { + return this.affectedEntities; + } + + public EntityLivingBase getExplosivePlacedBy() + { + return this.exploder == null ? null : (this.exploder instanceof EntityTNTPrimed ? ((EntityTNTPrimed)this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLivingBase ? (EntityLivingBase)this.exploder : null)); + } + + //unconventional name, sure, but it's short + public boolean has(ExAttrib attrib) { + return this.atttributes.contains(attrib); + } + + //this solution is a bit hacky but in the end easier to work with + public static enum ExAttrib { + FIRE, //classic vanilla fire explosion + BALEFIRE, //same with but with balefire + LAVA, //again the same thing but lava + ALLMOD, //block placer attributes like fire are applied for all destroyed blocks + ALLDROP, //miner TNT! + NOPARTICLE, + NOHURT + } + +} diff --git a/src/main/java/com/hbm/interfaces/Spaghetti.java b/src/main/java/com/hbm/interfaces/Spaghetti.java index e6a20e2c2..eb9542b6f 100644 --- a/src/main/java/com/hbm/interfaces/Spaghetti.java +++ b/src/main/java/com/hbm/interfaces/Spaghetti.java @@ -5,4 +5,4 @@ package com.hbm.interfaces; public @interface Spaghetti { public String value(); -} \ No newline at end of file +} diff --git a/src/main/java/com/hbm/lib/Library.java b/src/main/java/com/hbm/lib/Library.java index 28a4feb6d..6c83bcf36 100644 --- a/src/main/java/com/hbm/lib/Library.java +++ b/src/main/java/com/hbm/lib/Library.java @@ -440,14 +440,13 @@ public class Library { return power; } - //TODO: jesus christ + //TODO: jesus christ kill it //Flut-Füll gesteuerter Energieübertragungsalgorithmus //Flood fill controlled energy transmission algorithm public static void ffgeua(int x, int y, int z, boolean newTact, ISource that, World worldObj) { Block block = worldObj.getBlock(x, y, z); TileEntity tileentity = worldObj.getTileEntity(x, y, z); - //TODO: transition multiblocks to use the XR mutliblock handler so this spaghetti trash becomes obsolete //Factories if(block == ModBlocks.factory_titanium_conductor && worldObj.getBlock(x, y + 1, z) == ModBlocks.factory_titanium_core) {