From c9836c63aa11d409c2085a12701acf6aff20f642 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Sun, 16 Sep 2018 22:38:15 +0200 Subject: Initial commit --- .gitignore | 23 +++++++++++++++++++++++ LICENSE | 21 +++++++++++++++++++++ README.md | 2 ++ 3 files changed, 46 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..a1c2a238a9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..ab602974d2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000000..7734188f28 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# bartworks +A Gregtech addon. -- cgit From c05995f211407bc8538b35695254e6934d90c054 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Sun, 16 Sep 2018 22:44:58 +0200 Subject: Source Upload --- .gitignore | 5 + ID Range.txt | 6 + build.gradle | 111 ++++++ build.properties | 5 + gradlew | 164 +++++++++ gradlew.bat | 90 +++++ .../github/bartimaeusnek/bartworks/GuiHandler.java | 26 ++ .../github/bartimaeusnek/bartworks/MainMod.java | 66 ++++ .../bartworks/client/creativetabs/GT2Tab.java | 17 + .../client/gui/GT_GUIContainer_Destructopack.java | 31 ++ .../bartworks/client/gui/GT_GUIContainer_LESU.java | 60 +++ .../bartworks/common/ConfigHandler.java | 31 ++ .../bartworks/common/blocks/BW_Blocks.java | 63 ++++ .../bartworks/common/items/BW_ItemBlocks.java | 60 +++ .../common/items/GT_Destructopack_Item.java | 35 ++ .../bartworks/common/items/GT_Rockcutter_Item.java | 145 ++++++++ .../bartworks/common/items/GT_Teslastaff_Item.java | 122 +++++++ .../bartworks/common/items/SimpleIconItem.java | 21 ++ .../bartworks/common/loaders/ItemRegistry.java | 48 +++ .../bartworks/common/loaders/LoaderRegistry.java | 14 + .../bartworks/common/loaders/RecipeLoader.java | 149 ++++++++ .../GT_MetaTileEntity_EnergyDistributor.java | 53 +++ .../common/tileentities/GT_TileEntity_LESU.java | 403 +++++++++++++++++++++ .../container/GT_Container_Item_Destructopack.java | 58 +++ .../server/container/GT_Container_LESU.java | 37 ++ .../bartworks/util/ChatColorHelper.java | 27 ++ .../bartworks/util/ConnectedBlocksChecker.java | 171 +++++++++ .../bartworks/util/NEIbartworksConfig.java | 30 ++ .../resources/assets/bartworks/lang/en_US.lang | 8 + .../bartworks/textures/GT2/gui/Destructopack.png | Bin 0 -> 3569 bytes .../assets/bartworks/textures/GT2/gui/LESU.png | Bin 0 -> 2266 bytes .../bartworks/textures/blocks/EtchedLapisCell.png | Bin 0 -> 471 bytes .../bartworks/textures/blocks/LESU_CASING_0.png | Bin 0 -> 666 bytes .../bartworks/textures/blocks/LESU_CASING_1.png | Bin 0 -> 680 bytes .../bartworks/textures/blocks/LESU_CASING_2.png | Bin 0 -> 680 bytes .../bartworks/textures/blocks/LESU_CASING_3.png | Bin 0 -> 682 bytes .../assets/bartworks/textures/blocks/LESU_CELL.png | Bin 0 -> 795 bytes .../bartworks/textures/blocks/PlatedLapisCell.png | Bin 0 -> 623 bytes .../assets/bartworks/textures/items/GT2Coin.png | Bin 0 -> 259 bytes .../bartworks/textures/items/GT_Rockcutter.png | Bin 0 -> 353 bytes .../bartworks/textures/items/GT_Teslastaff.png | Bin 0 -> 362 bytes .../textures/items/gt.GT2Destructopack.png | Bin 0 -> 284 bytes src/main/resources/mcmod.info | 16 + 43 files changed, 2072 insertions(+) create mode 100644 ID Range.txt create mode 100644 build.gradle create mode 100644 build.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/GT2Tab.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_Destructopack.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_LESU.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/ConfigHandler.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_Blocks.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Destructopack_Item.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Rockcutter_Item.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Teslastaff_Item.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/items/SimpleIconItem.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/LoaderRegistry.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_MetaTileEntity_EnergyDistributor.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_TileEntity_LESU.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/server/container/GT_Container_Item_Destructopack.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/server/container/GT_Container_LESU.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/ChatColorHelper.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/NEIbartworksConfig.java create mode 100644 src/main/resources/assets/bartworks/lang/en_US.lang create mode 100644 src/main/resources/assets/bartworks/textures/GT2/gui/Destructopack.png create mode 100644 src/main/resources/assets/bartworks/textures/GT2/gui/LESU.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/EtchedLapisCell.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/LESU_CASING_0.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/LESU_CASING_1.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/LESU_CASING_2.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/LESU_CASING_3.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/LESU_CELL.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/PlatedLapisCell.png create mode 100644 src/main/resources/assets/bartworks/textures/items/GT2Coin.png create mode 100644 src/main/resources/assets/bartworks/textures/items/GT_Rockcutter.png create mode 100644 src/main/resources/assets/bartworks/textures/items/GT_Teslastaff.png create mode 100644 src/main/resources/assets/bartworks/textures/items/gt.GT2Destructopack.png create mode 100644 src/main/resources/mcmod.info diff --git a/.gitignore b/.gitignore index a1c2a238a9..5f699efc89 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,11 @@ # BlueJ files *.ctxt +# IDEA files +*.iml +*.ipr +*.iws + # Mobile Tools for Java (J2ME) .mtj.tmp/ diff --git a/ID Range.txt b/ID Range.txt new file mode 100644 index 0000000000..07d3e9079a --- /dev/null +++ b/ID Range.txt @@ -0,0 +1,6 @@ +12500-13000 + +12500-12600 are occupied by Crops++ +12900-13000 are occupied by EMT + +12600-12700 are aviable for bartworks \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..21d3faeed4 --- /dev/null +++ b/build.gradle @@ -0,0 +1,111 @@ +buildscript { + repositories { + mavenCentral() + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + classpath "de.undercouch:gradle-download-task:3.1.2" + } +} + +apply plugin: 'forge' +apply plugin: 'idea' +apply plugin: 'signing' +import de.undercouch.gradle.tasks.download.Download + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + + +ext.configFile = file "build.properties" +configFile.withReader { + def prop = new Properties() + prop.load(it) + project.ext.config = new ConfigSlurper().parse prop +} + + +version = config.mod_version +group= "com.github.bartimaeusnek.bartworks" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = "bartworks"+ "[" + config.mc_version + "]" + + + +minecraft { + version = "1.7.10-10.13.4.1614-1.7.10" + replaceIn "MainMod.java" + replace "@version@", project.version + runDir = "run" +} + +repositories { + mavenLocal() + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" + } +} + +dependencies { + compile "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev" +} + +//task getGregTech(type: Download) { +// onlyIf { +// !file("libs/gregtech-${config.gregtech.version}-dev.jar").exists() +// } +// src "http://jenkins.usrv.eu:8080/job/Gregtech-5-Unofficial/${config.gregtech.jenkinsbuild}/artifact/build/libs/gregtech-${config.gregtech.version}-dev.jar" +// dest file("libs/gregtech-${config.gregtech.version}-dev.jar") +// mustRunAfter "deobfBinJar" +// mustRunAfter "repackMinecraft" +//} + +tasks.setupCIWorkspace.dependsOn getGregTech +tasks.setupDevWorkspace.dependsOn getGregTech +tasks.setupDecompWorkspace.dependsOn getGregTech +tasks.compileJava.dependsOn getGregTech + +processResources +{ + // 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 signJar(dependsOn: 'reobf'){ + doLast { + ant.signjar( + destDir: jar.destinationDir, + jar: jar.getArchivePath(), + alias: findProperty('keyStoreAlias') ?: '', + keystore: findProperty('keyStore') ?: '', + storepass: findProperty('keyStorePass') ?: '', + digestalg: findProperty('signDigestAlg') ?: '', + tsaurl: findProperty('signTSAurl') ?: '', + verbose: true + ) + } +} diff --git a/build.properties b/build.properties new file mode 100644 index 0000000000..d52a4ddb8b --- /dev/null +++ b/build.properties @@ -0,0 +1,5 @@ +mc_version=1.7.10 +mod_version=0.0.1 +ic2.version=2.2.828-experimental +gregtech.version=5.09.32.36 +gregtech.jenkinsbuild=143 diff --git a/gradlew b/gradlew new file mode 100644 index 0000000000..91a7e269e1 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# 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"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=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. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +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 + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000000..8a0b282aa6 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@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 Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@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. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +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 + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java new file mode 100644 index 0000000000..1a19fa32d6 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java @@ -0,0 +1,26 @@ +package com.github.bartimaeusnek.bartworks; + +import com.github.bartimaeusnek.bartworks.client.gui.GT_GUIContainer_Destructopack; +import com.github.bartimaeusnek.bartworks.server.container.GT_Container_Item_Destructopack; +import cpw.mods.fml.common.network.IGuiHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class GuiHandler implements IGuiHandler { + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + switch (ID){ + case 0: return new GT_Container_Item_Destructopack(player.inventory); + } + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + switch (ID){ + case 0: return new GT_GUIContainer_Destructopack(player.inventory); + } + return null; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java new file mode 100644 index 0000000000..8e7bb21122 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -0,0 +1,66 @@ +package com.github.bartimaeusnek.bartworks; + + +import codechicken.nei.NEIActions; +import codechicken.nei.NEIClientUtils; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.asm.NEICorePlugin; +import com.github.bartimaeusnek.bartworks.client.creativetabs.GT2Tab; +import com.github.bartimaeusnek.bartworks.common.ConfigHandler; +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import com.github.bartimaeusnek.bartworks.common.loaders.LoaderRegistry; +import com.github.bartimaeusnek.bartworks.common.tileentities.GT_MetaTileEntity_EnergyDistributor; +import com.github.bartimaeusnek.bartworks.common.tileentities.GT_TileEntity_LESU; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import gregtech.api.enums.GT_Values; +import gregtech.nei.NEI_GT_Config; +import net.minecraft.creativetab.CreativeTabs; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@Mod( + modid = MainMod.modID, name = MainMod.name, version = MainMod.version, + dependencies = "required-after:IC2; " + + "required-after:gregtech; " + ) +public final class MainMod { + public static final String name = "BartWorks"; + public static final String version = "@version@"; + public static final String modID = "bartworks"; + public static final Logger logger = LogManager.getLogger(name); + public static boolean GTNH = false; + public static final CreativeTabs GT2 = new GT2Tab("GT2C"); + public static final IGuiHandler GH = new GuiHandler(); + @Mod.Instance(modID) + public static MainMod instance; + public static ConfigHandler CHandler; + + + @Mod.EventHandler + public void preInit(FMLPreInitializationEvent preinit) { + if(Loader.isModLoaded("dreamcraft")) { + GTNH = true; + } + CHandler= new ConfigHandler(preinit); + if (GTNH) + logger.info("GTNH-Detected . . . ACTIVATE HARDMODE."); + } + @Mod.EventHandler + public void init(FMLInitializationEvent init) { + new LoaderRegistry().run(); + } + + @Mod.EventHandler + public void postInit(FMLPostInitializationEvent postinit) { + NetworkRegistry.INSTANCE.registerGuiHandler(instance,GH); + } + + + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/GT2Tab.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/GT2Tab.java new file mode 100644 index 0000000000..82188db9c5 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/GT2Tab.java @@ -0,0 +1,17 @@ +package com.github.bartimaeusnek.bartworks.client.creativetabs; + +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class GT2Tab extends CreativeTabs { + + public GT2Tab (String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return ItemRegistry.tab; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_Destructopack.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_Destructopack.java new file mode 100644 index 0000000000..4946bdb328 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_Destructopack.java @@ -0,0 +1,31 @@ +package com.github.bartimaeusnek.bartworks.client.gui; + +import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.server.container.GT_Container_Item_Destructopack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class GT_GUIContainer_Destructopack extends GuiContainer +{ + public GT_GUIContainer_Destructopack(InventoryPlayer inventory) { + super(new GT_Container_Item_Destructopack(inventory)); + } + public static final ResourceLocation texture = new ResourceLocation(MainMod.modID, "textures/GT2/gui/Destructopack.png"); + + @Override + public void drawGuiContainerBackgroundLayer(float f, int j, int i) { + GL11.glColor4f(1F, 1F, 1F, 1F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, 175, 165); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + } + + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_LESU.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_LESU.java new file mode 100644 index 0000000000..574bc89536 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_LESU.java @@ -0,0 +1,60 @@ +package com.github.bartimaeusnek.bartworks.client.gui; + +import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.common.tileentities.GT_TileEntity_LESU; +import com.github.bartimaeusnek.bartworks.server.container.GT_Container_LESU; +import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; +import gregtech.api.gui.GT_GUIContainer; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class GT_GUIContainer_LESU extends GT_GUIContainer { + + protected GT_Container_LESU mContainer; + + public static final ResourceLocation texture = new ResourceLocation(MainMod.modID, "textures/GT2/gui/LESU.png"); + private GT_TileEntity_LESU c; + + public GT_GUIContainer_LESU(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_LESU(aInventoryPlayer, aTileEntity), texture.getResourceDomain()); + mContainer = ((GT_Container_LESU)this.inventorySlots); + c = ((GT_TileEntity_LESU)(this.mContainer.mTileEntity.getMetaTileEntity())); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.drawString(this.fontRendererObj,"L.E.S.U.", 11, 8, 16448255); + if (this.mContainer != null) { + String percell = String.valueOf(c.energyPerCell).substring(1); + this.drawString(this.fontRendererObj,"EU: " + String.valueOf(this.mContainer.mEnergy), 11, 16, 16448255); + this.drawString(this.fontRendererObj,"MAX: " + (this.c.getBaseMetaTileEntity().isActive() ? String.valueOf(this.mContainer.mOutput)+ percell : Integer.toString(0)), 11, 24, 16448255); + this.drawString(this.fontRendererObj,"MAX EU/t IN: " + String.valueOf(this.mContainer.mInput), 11, 32, 16448255); + this.drawString(this.fontRendererObj,"EU/t OUT: " + String.valueOf(this.mContainer.mOutput), 11, 40, 16448255); + this.drawString(this.fontRendererObj,"AMP/t IN/OUT: " + String.valueOf(c.getBaseMetaTileEntity().getInputAmperage()), 11, 48, 16448255); + if (c.maxEUStore() >= Long.MAX_VALUE-1) { + this.drawString(this.fontRendererObj, "Maximum Capacity!", 11, 56, Color.YELLOW.getRGB()); + } + if (!this.c.getBaseMetaTileEntity().isActive()) { + this.drawString(this.fontRendererObj,"Multiple Controllers!", 11, 56, Color.RED.getRGB()); + } + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) { + final long tScale = this.mContainer.mEnergy / Math.max(1, c.maxEUStore() / 116); + this.drawTexturedModalRect(x + 8, y + 73, 0, 251, (int) tScale, 5); + } + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/ConfigHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/ConfigHandler.java new file mode 100644 index 0000000000..e1dbebf049 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/ConfigHandler.java @@ -0,0 +1,31 @@ +package com.github.bartimaeusnek.bartworks.common; + + +import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.common.tileentities.GT_TileEntity_LESU; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import gregtech.api.enums.GT_Values; +import net.minecraftforge.common.config.Configuration; + +import java.io.File; + +public class ConfigHandler { + public static int IDOffset = 12500; + public static final int IDU=1+ GT_Values.VN.length; + public static boolean ezmode = false; + public static boolean teslastaff = false; + public final Configuration c; + public ConfigHandler(FMLPreInitializationEvent e){ + c = new Configuration(new File(e.getModConfigurationDirectory().toString()+"/"+MainMod.modID+".cfg")); + + IDOffset=c.get("System","ID Offset",12500,"ID Offset for this mod. This Mod uses "+IDU+" IDs. DO NOT CHANGE IF YOU DONT KNOW WHAT THIS IS").getInt(12500); + GT_TileEntity_LESU.energyPerCell=c.get("Multiblocks","energyPerLESUCell",1000000,"This will set Up the Energy per LESU Cell",1000000,Integer.MAX_VALUE).getInt(1000000); + ezmode=c.get("System","Mode switch",false,"If GTNH is Loaded, this will enable easy recipes, if not, it will enable harder recipes.").getBoolean(false); + MainMod.GTNH = ezmode ? !MainMod.GTNH : MainMod.GTNH; + teslastaff=c.get("System","Enable Teslastaff",false,"Enables the Teslastaff, an Item used to destroy Electric Armors").getBoolean(false); + + if (c.hasChanged()) + c.save(); + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_Blocks.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_Blocks.java new file mode 100644 index 0000000000..983ec42653 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_Blocks.java @@ -0,0 +1,63 @@ +package com.github.bartimaeusnek.bartworks.common.blocks; + +import com.github.bartimaeusnek.bartworks.MainMod; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import java.util.List; + +public class BW_Blocks extends Block { + + public BW_Blocks(String name, String[] texture) { + super(Material.anvil); + this.setHardness(15.0F); + this.setResistance(30.0F); + this.name = name; + this.textureNames=texture; + this.setCreativeTab(MainMod.GT2); + } + + @SideOnly(Side.CLIENT) + private IIcon[] texture; + private String[] textureNames; + private String name; + + @Override + public int damageDropped(final int meta) { + return meta; + } + + @Override + public void getSubBlocks(final Item item, final CreativeTabs tab, final List list) { + for (int i = 0; i < textureNames.length; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return meta < texture.length ? texture[meta] : texture[0]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister){ + texture = new IIcon[textureNames.length]; + for (int i = 0; i < textureNames.length; i++) { + texture[i] = par1IconRegister.registerIcon(textureNames[i]); + } + } + + @Override + public String getUnlocalizedName(){ + return name; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java new file mode 100644 index 0000000000..959a67014e --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java @@ -0,0 +1,60 @@ +package com.github.bartimaeusnek.bartworks.common.items; + +import com.github.bartimaeusnek.bartworks.MainMod; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.util.GT_LanguageManager; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import java.util.List; + +public class BW_ItemBlocks extends ItemBlock { + + public BW_ItemBlocks(final Block par1){ + super(par1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + this.setCreativeTab(MainMod.GT2); + } + + protected final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); + protected final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); + + @Override + public int getMetadata(final int aMeta) { + return aMeta; + } + + @Override + public String getUnlocalizedName(final ItemStack aStack) { + return this.field_150939_a.getUnlocalizedName() + "." + this.getDamage(aStack); + } + + @Override + public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { + aList.add(this.mNoMobsToolTip); + aList.add(this.mNoTileEntityToolTip); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int pass) { + return this.field_150939_a.getIcon(0,stack.getItemDamage()); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + return getIcon(stack, renderPass); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) { + return this.field_150939_a.getIcon(0,p_77618_2_); + } +} \ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Destructopack_Item.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Destructopack_Item.java new file mode 100644 index 0000000000..3747bb2141 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Destructopack_Item.java @@ -0,0 +1,35 @@ +package com.github.bartimaeusnek.bartworks.common.items; + +import com.github.bartimaeusnek.bartworks.MainMod; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.items.GT_Generic_Item; +import gregtech.api.util.GT_Config; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import sun.applet.Main; + +public class GT_Destructopack_Item extends GT_Generic_Item +{ + + public GT_Destructopack_Item() { + super("GT2Destructopack","Destructopack","Mobile Trash Bin"); + this.setMaxStackSize(1); + this.setNoRepair(); + this.setHasSubtypes(false); + this.setCreativeTab(MainMod.GT2); + } + + @Override + public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + aPlayer.openGui(MainMod.instance, 0, aWorld, 0, 0, 0); + return aStack; + } + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aIconRegister) { + this.mIcon = aIconRegister.registerIcon("bartworks:gt.GT2Destructopack"); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Rockcutter_Item.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Rockcutter_Item.java new file mode 100644 index 0000000000..7e4ef6c05c --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Rockcutter_Item.java @@ -0,0 +1,145 @@ +package com.github.bartimaeusnek.bartworks.common.items; + +import com.github.bartimaeusnek.bartworks.MainMod; +import com.google.common.collect.Sets; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTool; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class GT_Rockcutter_Item extends ItemTool implements IElectricItem +{ + @SideOnly(Side.CLIENT) + private IIcon icon; + + public int mCharge; + public int mTransfer; + public int mTier; + public static Set mineableBlocks = Sets.newHashSet(Blocks.stone, Blocks.cobblestone, Blocks.sand, Blocks.clay); + private int multi; + public GT_Rockcutter_Item(int aTier) { + super(2*aTier, ToolMaterial.EMERALD, mineableBlocks); + this.mTier = aTier; + multi = (int) Math.pow(10,(mTier-1)); + this.mineableBlocks = new HashSet(); + this.maxStackSize=1; + this.mCharge = 10000 * multi; + this.mTransfer = (int) GT_Values.V[mTier]; + this.efficiencyOnProperMaterial = 2.0f*mTier; + this.setCreativeTab(MainMod.GT2); + this.setMaxDamage(27+ 10*multi); + this.setNoRepair(); + this.setUnlocalizedName("GT_Rockcutter_Item_"+ GT_Values.VN[mTier]); + } + + public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { + aList.add("Tier: " + GT_Values.VN[this.mTier]); + } + + public void onUpdate(ItemStack aStack, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + if (!ElectricItem.manager.canUse(aStack, 500*multi)) { + if (aStack.isItemEnchanted()) { + aStack.getTagCompound().removeTag("ench"); + } + } + else if (!aStack.isItemEnchanted()) { + aStack.addEnchantment(Enchantment.silkTouch,3); + } + } + + public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) + { + ElectricItem.manager.use(aStack, 0, aPlayer); + return false; + } + + public boolean onBlockDestroyed(final ItemStack var1, final World var2, final Block var3, final int var4, final int var5, final int var6, final EntityLivingBase var7) { + ElectricItem.manager.use(var1, 0, var7); + if (ElectricItem.manager.canUse(var1, 500*multi)) { + ElectricItem.manager.use(var1, 500*multi, var7); + } + else{ + ElectricItem.manager.discharge(var1, Integer.MAX_VALUE, Integer.MAX_VALUE, true,true, false); + } + return true; + } + + @Override + public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) { + return par1Block.getMaterial().equals(Material.glass) || par1Block.getMaterial().equals(Material.clay) || par1Block.getMaterial().equals(Material.packedIce) || par1Block.getMaterial().equals(Material.ice) || par1Block.getMaterial().equals(Material.sand) || par1Block.getMaterial().equals(Material.ground) || par1Block.getMaterial().equals(Material.rock) || this.mineableBlocks.contains(par1Block); + } + + @SideOnly(Side.CLIENT) + public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + if (getChargedItem(itemStack) == this) { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + if (getEmptyItem(itemStack) == this) { + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + } + + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public Item getChargedItem(ItemStack itemStack) { + return this; + } + + @Override + public Item getEmptyItem(ItemStack itemStack) { + return this; + } + + @Override + public double getMaxCharge(ItemStack itemStack) { + return this.mCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return this.mTier; + } + + @Override + public double getTransferLimit(ItemStack itemStack) { + return this.mTransfer; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + this.icon = iconRegister.registerIcon("bartworks:GT_Rockcutter"); + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) { + return this.icon; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Teslastaff_Item.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Teslastaff_Item.java new file mode 100644 index 0000000000..addc694783 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Teslastaff_Item.java @@ -0,0 +1,122 @@ +package com.github.bartimaeusnek.bartworks.common.items; + +import com.github.bartimaeusnek.bartworks.MainMod; +import com.google.common.collect.Sets; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTool; +import net.minecraft.util.IIcon; + +import java.util.List; +import java.util.Set; + +public class GT_Teslastaff_Item extends ItemTool implements ic2.api.item.IElectricItem +{ + public double mCharge; + public double mTransfer; + public int mTier; + private static Set effective = Sets.newHashSet(Blocks.web); + + @SideOnly(Side.CLIENT) + private IIcon icon; + + public GT_Teslastaff_Item() { + super(0, ToolMaterial.GOLD, effective); + this.setCreativeTab(MainMod.GT2); + this.setNoRepair(); + this.mCharge = 10000000D; + this.mTransfer = 8192D; + this.mTier = 4; + this.setMaxStackSize(1); + this.setMaxDamage(27); + this.setUnlocalizedName("GT_Teslastaff_Item"); + } + + @Override + public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { + aList.add("No warranty!"); + } + + public boolean hitEntity(ItemStack aStack, EntityLivingBase aTarget, EntityLivingBase aPlayer) { + if (aTarget instanceof EntityLiving && ElectricItem.manager.canUse(aStack, 9000000)) { + final EntityLiving tTarget = (EntityLiving)aTarget; + final EntityLivingBase tPlayer = (EntityLivingBase)aPlayer; + ElectricItem.manager.use(aStack, 9000000, tPlayer); + for (int i = 1; i < 5; ++i) { + if (tTarget.getEquipmentInSlot(i) != null && tTarget.getEquipmentInSlot(i).getItem() instanceof IElectricItem) { + tTarget.setCurrentItemOrArmor(i,null); + } + } + } + return true; + } + + @SideOnly(Side.CLIENT) + public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + if (getChargedItem(itemStack) == this) { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + if (getEmptyItem(itemStack) == this) { + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public Item getChargedItem(ItemStack itemStack) { + return this; + } + + @Override + public Item getEmptyItem(ItemStack itemStack) { + return this; + } + + @Override + public double getMaxCharge(ItemStack itemStack) { + return this.mCharge; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getTier(ItemStack itemStack) { + return this.mTier; + } + + @Override + public double getTransferLimit(ItemStack itemStack) { + return this.mTransfer; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + this.icon = iconRegister.registerIcon("bartworks:GT_Teslastaff"); + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) { + return this.icon; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/SimpleIconItem.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/SimpleIconItem.java new file mode 100644 index 0000000000..41b72f6369 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/SimpleIconItem.java @@ -0,0 +1,21 @@ +package com.github.bartimaeusnek.bartworks.common.items; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; + +public class SimpleIconItem extends Item { + + String tex; + + public SimpleIconItem(String tex){ + super(); + this.tex=tex; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + itemIcon=iconRegister.registerIcon("bartworks:"+tex); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java new file mode 100644 index 0000000000..0ceeb19d1c --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -0,0 +1,48 @@ +package com.github.bartimaeusnek.bartworks.common.loaders; + +import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.common.ConfigHandler; +import com.github.bartimaeusnek.bartworks.common.blocks.BW_Blocks; +import com.github.bartimaeusnek.bartworks.common.items.*; +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; +import net.minecraft.item.Item; + +public class ItemRegistry implements Runnable { + + public static final Item Destructopack = new GT_Destructopack_Item(); + public static final Item Teslastaff = new GT_Teslastaff_Item(); + public static final Item RockcutterLV = new GT_Rockcutter_Item(1); + public static final Item RockcutterMV = new GT_Rockcutter_Item(2); + public static final Item RockcutterHV = new GT_Rockcutter_Item(3); + public static final Item tab = new SimpleIconItem("GT2Coin"); + public static final Block[] BW_BLOCKS = { + new BW_Blocks("BW_ItemBlocks", new String[] + { + MainMod.modID+":EtchedLapisCell", + MainMod.modID+":PlatedLapisCell", + }), + + new BW_Blocks("GT_LESU_CASING", new String[]{ + MainMod.modID+":LESU_CELL", + }), + + }; + + + @Override + public void run() { + + GameRegistry.registerBlock(BW_BLOCKS[0], BW_ItemBlocks.class,"BW_ItemBlocks"); + + GameRegistry.registerBlock(BW_BLOCKS[1],BW_ItemBlocks.class,"GT_LESU_CASING"); + + if (ConfigHandler.teslastaff) + GameRegistry.registerItem(Teslastaff,Teslastaff.getUnlocalizedName()); + + GameRegistry.registerItem(RockcutterLV,RockcutterLV.getUnlocalizedName()); + GameRegistry.registerItem(RockcutterMV,RockcutterMV.getUnlocalizedName()); + GameRegistry.registerItem(RockcutterHV,RockcutterHV.getUnlocalizedName()); + GameRegistry.registerItem(tab,"tabIconGT2"); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/LoaderRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/LoaderRegistry.java new file mode 100644 index 0000000000..199f4068bf --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/LoaderRegistry.java @@ -0,0 +1,14 @@ +package com.github.bartimaeusnek.bartworks.common.loaders; + +public class LoaderRegistry implements Runnable { + public ItemRegistry items = new ItemRegistry(); + public RecipeLoader recipes = new RecipeLoader(); + + @Override + public void run() { + items.run(); + recipes.run(); + } + + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java new file mode 100644 index 0000000000..dc7a7acda8 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java @@ -0,0 +1,149 @@ +package com.github.bartimaeusnek.bartworks.common.loaders; + +import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.common.ConfigHandler; +import com.github.bartimaeusnek.bartworks.common.tileentities.GT_MetaTileEntity_EnergyDistributor; +import com.github.bartimaeusnek.bartworks.common.tileentities.GT_TileEntity_LESU; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; + +public class RecipeLoader implements Runnable { + + private final static long bitsd = GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE; + + @Override + public void run() { + + if(MainMod.GTNH) { + GT_Values.RA.addFluidSolidifierRecipe(new ItemStack(Blocks.lapis_block),Materials.Iron.getMolten(1296L),new ItemStack(ItemRegistry.BW_BLOCKS[0],1,0),100,(int) (GT_Values.V[3]-(GT_Values.V[3]/10))); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{new ItemStack(ItemRegistry.BW_BLOCKS[0],1,0), Materials.Lapis.getPlates(9), GT_OreDictUnificator.get(OrePrefixes.circuit,Materials.Advanced,2L), GT_Utility.getIntegratedCircuit(17)}, FluidRegistry.getFluidStack("ic2coolant",1000),new ItemStack(ItemRegistry.BW_BLOCKS[0],1,1),100,(int) (GT_Values.V[3]-(GT_Values.V[3]/10))); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{new ItemStack(ItemRegistry.BW_BLOCKS[0],1,1), Materials.Lapis.getBlocks(8), GT_Utility.getIntegratedCircuit(17)}, GT_Values.NF, new ItemStack(ItemRegistry.BW_BLOCKS[1]),100,(int) (GT_Values.V[3]-(GT_Values.V[3]/10))); + } + else { + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{Materials.Lapis.getBlocks(8), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Basic, 1L), GT_Utility.getIntegratedCircuit(17)}, GT_Values.NF, new ItemStack(ItemRegistry.BW_BLOCKS[1]), 100,(int) (GT_Values.V[1] - (GT_Values.V[1] / 10))); + + GT_ModHandler.addCraftingRecipe( + new ItemStack(ItemRegistry.BW_BLOCKS[1]), + bitsd, + new Object[]{ + "LLL", + "LCL", + "LLL", + 'L', Materials.Lapis.getBlocks(1), + 'C', "circuitBasic" + }); + + GT_Values.RA.addCutterRecipe(new ItemStack(ItemRegistry.BW_BLOCKS[1]),new ItemStack(ItemRegistry.BW_BLOCKS[0],9,1),GT_Values.NI,100,(int) (GT_Values.V[1] - (GT_Values.V[1] / 10))); + GT_Values.RA.addCompressorRecipe(new ItemStack(ItemRegistry.BW_BLOCKS[0],9,1),new ItemStack(ItemRegistry.BW_BLOCKS[1]),100,(int) (GT_Values.V[1] - (GT_Values.V[1] / 10))); + GT_Values.RA.addCompressorRecipe(new ItemStack(ItemRegistry.BW_BLOCKS[0],9,0),new ItemStack(ItemRegistry.BW_BLOCKS[1]),100,(int) (GT_Values.V[1] - (GT_Values.V[1] / 10))); + GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ItemRegistry.BW_BLOCKS[0],1,0),bitsd,new Object[]{new ItemStack(ItemRegistry.BW_BLOCKS[0],1,1)}); + GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ItemRegistry.BW_BLOCKS[0],1,1),bitsd,new Object[]{new ItemStack(ItemRegistry.BW_BLOCKS[0],1,0)}); + } + + GT_ModHandler.addCraftingRecipe( + new GT_TileEntity_LESU(ConfigHandler.IDOffset,"LESU","LESU").getStackForm(1L), + bitsd, + new Object[]{ + "CDC", + "SBS", + "CFC", + 'C', GT_OreDictUnificator.get(OrePrefixes.circuit, MainMod.GTNH ? Materials.Advanced : Materials.Basic,1L), + 'D', ItemList.Cover_Screen.get(1L), + 'S', GT_OreDictUnificator.get(OrePrefixes.cableGt12, MainMod.GTNH ? Materials.Platinum : Materials.AnnealedCopper,1L), + 'B', new ItemStack(ItemRegistry.BW_BLOCKS[1]), + 'F', MainMod.GTNH ? ItemList.Field_Generator_HV.get(1L) : ItemList.Field_Generator_LV.get(1L) + }); + + GT_ModHandler.addCraftingRecipe( + new ItemStack(ItemRegistry.Destructopack), + bitsd, + new Object[]{ + "CPC", + "PLP", + "CPC", + 'C', GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced,1L), + 'P', GT_OreDictUnificator.get(MainMod.GTNH ? OrePrefixes.plateDouble : OrePrefixes.plate, Materials.Aluminium,1L), + 'L', new ItemStack(Items.lava_bucket) + }); + + GT_ModHandler.addCraftingRecipe( + new ItemStack(ItemRegistry.Destructopack), + bitsd, + new Object[]{ + "CPC", + "PLP", + "CPC", + 'C', GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced,1L), + 'P', GT_OreDictUnificator.get(MainMod.GTNH ? OrePrefixes.plateDouble : OrePrefixes.plate, MainMod.GTNH ? Materials.Steel : Materials.Iron,1L), + 'L', new ItemStack(Items.lava_bucket) + }); + + GT_ModHandler.addCraftingRecipe( + new ItemStack(ItemRegistry.RockcutterMV), + bitsd, + new Object[]{ + "DS ", + "DP ", + "DCB", + 'D', GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Diamond,1L), + 'S', GT_OreDictUnificator.get(OrePrefixes.stick,Materials.TungstenSteel,1L), + 'P', GT_OreDictUnificator.get(OrePrefixes.plate,Materials.TungstenSteel,1L), + 'C', "circuitGood", + 'B', ItemList.IC2_AdvBattery.get(1L) + }); + + GT_ModHandler.addCraftingRecipe( + new ItemStack(ItemRegistry.RockcutterLV), + bitsd, + new Object[]{ + "DS ", + "DP ", + "DCB", + 'D', GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Diamond,1L), + 'S', GT_OreDictUnificator.get(OrePrefixes.stick,Materials.Titanium,1L), + 'P', GT_OreDictUnificator.get(OrePrefixes.plate,Materials.Titanium,1L), + 'C', "circuitBasic", + 'B', ItemList.IC2_ReBattery.get(1L) + }); + + GT_ModHandler.addCraftingRecipe( + new ItemStack(ItemRegistry.RockcutterHV), + bitsd, + new Object[]{ + "DS ", + "DP ", + "DCB", + 'D', GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Diamond,1L), + 'S', GT_OreDictUnificator.get(OrePrefixes.stick,Materials.Iridium,1L), + 'P', GT_OreDictUnificator.get(OrePrefixes.plate,Materials.Iridium,1L), + 'C', "circuitAdvanced", + 'B', ItemList.IC2_EnergyCrystal.get(1L) + }); + + if (ConfigHandler.teslastaff) + GT_ModHandler.addCraftingRecipe( + new ItemStack(ItemRegistry.Teslastaff), + bitsd, + new Object[]{ + "BO ", + "OP ", + " P", + 'O', GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Superconductor,1L), + 'B', ItemList.Energy_LapotronicOrb.get(1L), + 'P', "plateAlloyIridium", + }); + + for (int i = 0; i < GT_Values.VN.length; i++) { + new GT_MetaTileEntity_EnergyDistributor(ConfigHandler.IDOffset+1+i,"Energy Distributor "+GT_Values.VN[i], "Energy Distributor "+GT_Values.VN[i], i, "Splits Amperage into several Sides"); + } + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_MetaTileEntity_EnergyDistributor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_MetaTileEntity_EnergyDistributor.java new file mode 100644 index 0000000000..fd5e1a60bb --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_MetaTileEntity_EnergyDistributor.java @@ -0,0 +1,53 @@ +package com.github.bartimaeusnek.bartworks.common.tileentities; + +import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Transformer; + +public class GT_MetaTileEntity_EnergyDistributor extends GT_MetaTileEntity_Transformer { + + public GT_MetaTileEntity_EnergyDistributor(int aID, String aName, String aNameRegional, int aTier, String aDescription) { + super(aID, aName, aNameRegional, aTier, aDescription); + } + + public GT_MetaTileEntity_EnergyDistributor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public GT_MetaTileEntity_EnergyDistributor(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EnergyDistributor(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + } + + public long maxEUInput() { + return GT_Values.V[this.mTier]; + } + + public long maxEUOutput() { + return GT_Values.V[this.mTier]; + } + + public long maxAmperesOut() { + return 64*5; + } + + public long maxAmperesIn() { + return 256; + } + + @Override + public long maxEUStore() { + return 512L + (GT_Values.V[this.mTier ] * 256L); + } + + public String[] getDescription() { + return new String[] {mDescription,"Voltage: "+ ChatColorHelper.YELLOW +GT_Values.V[this.mTier],"Amperage IN: " + ChatColorHelper.YELLOW + maxAmperesIn(),"Amperage OUT: " + ChatColorHelper.YELLOW + maxAmperesOut()}; + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_TileEntity_LESU.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_TileEntity_LESU.java new file mode 100644 index 0000000000..f4dca5cb4c --- /dev/null +++ b/src/main/java