diff --git a/Changelog.txt b/Changelog.txt new file mode 100644 index 0000000..2005e0c --- /dev/null +++ b/Changelog.txt @@ -0,0 +1,20 @@ +Changelog of the mod : Electric Magic Tools, a Thaumcraft 4/Industrial-Craft 2 addon + +-------------------------------------------------------------------------------------------------------------------------------------------------------- + +Version 1.0.0 : First release of the mod. +Version 1.0.1 : Second release of the mod : fixes a crash due to the Omnitools. +Version 1.0.2 : Third release of the mod : adds the Wand Focus : Laser, and a christmas easter egg. Does not work on servers. +Version 1.0.3 : Attempt to fix the server crash of the mod. Attemps failed. +Version 1.0.3b : Second attempt to fix the server crash, it is again working in SMP. +Version 1.0.4 : Adds the Kris-tmas Focus and the Shield Focus +Version 1.0.5 : Added some Ignis/Potentia/Auram generators, Electric Goggles of revealing, Chainsaw of the Stream, and Drill of the Rockbreaker. +Version 1.0.6beta1 : Added an Industrial Wand Charging Station, some legendary tools, and a couple of other stuff. +Version 1.0.6beta2 : No new stuff, but switched to ForgeGradle (964) +Version 1.0.6beta3 : Added some enhanced boots of the traveller, and also capes for me and some friends +Version 1.0.7 : Updated to Thaumcraft 4.1.0x +Version 1.0.8 : Added some magical solar panels, different tiers and special capablities to all of them. +Version 1.0.9beta1 : Fixed the bug with the Drill of the Rockbreaker, added UU-Matter Infusion Recipes, fixed the recipe for the Quantum Solar Helmet of Revealing, added the Wand Focus: Charging, a cool particle effect existing when the Electric/Nano/Quantum boots of the traveller are worn (you an disable it in the config),a portable node (Azanor agreed about the balance), and an Elecric Hoe of Growth. +Version 1.0.9beta2 : Added a blacklist for the Ethereal Processor to anything that has "dust" in its OreDict entry. Included my build.gradle in the commit :) + +-------------------------------------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/README.md b/README.md index 7e1d36d..73a8561 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Electro-Magic-Tools -=================== +ElectricMagicTools +================== -An IC2/TC4 crossover addon, with nifty stuff! +An IC2/TC4 crossover addon \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..8938db2 --- /dev/null +++ b/build.gradle @@ -0,0 +1,41 @@ +buildscript { + repositories { + mavenCentral() + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT' + } +} + +apply plugin: 'forge' + +version = "1.0.9" +group= "electricMagicTools.tombenpotter" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = "ElectroMagicTools" + +minecraft { + version = "1.6.4-9.11.1.964" +} + +dependencies { + compile fileTree(dir: 'libs', include: '*.jar') +} +processResources +{ + // 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' + } +} \ No newline at end of file diff --git a/capes.txt b/capes.txt new file mode 100644 index 0000000..0c72587 --- /dev/null +++ b/capes.txt @@ -0,0 +1,11 @@ +Tombenpotter:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +Kris1432:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +BradXD1995:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +MexRexWasser:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +israelim125:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +fajii:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +wasliebob:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +VMvinner:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +Drullkus:https://dl.dropboxusercontent.com/s/c14341qirixfbk8/dkicapesmall.png +jztech101:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png +Pixel_404:https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes/cape.png \ No newline at end of file diff --git a/capes/Thumbs.db b/capes/Thumbs.db new file mode 100644 index 0000000..8640ab7 Binary files /dev/null and b/capes/Thumbs.db differ diff --git a/capes/cape.png b/capes/cape.png new file mode 100644 index 0000000..a7a2bb2 Binary files /dev/null and b/capes/cape.png differ diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..667288a Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..588c35f --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,16 @@ +#------------------------------------------------------------------------------- +# Copyright (c) 2014 Thomas. +# All rights reserved. +# +# This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html +# +# This class was made by Thomas and is distributed as a part of the Electro-Magic Tools mod. +# Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. +# http://www.minecraftforum.net/topic/1585216- +#------------------------------------------------------------------------------- +#Tue Oct 29 18:00:54 CDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..91a7e26 --- /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 0000000..8a0b282 --- /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/api/java/ic2/api/Direction.java b/src/api/java/ic2/api/Direction.java new file mode 100644 index 0000000..bae04e9 --- /dev/null +++ b/src/api/java/ic2/api/Direction.java @@ -0,0 +1,111 @@ +package ic2.api; + +import net.minecraft.tileentity.TileEntity; + +import net.minecraftforge.common.ForgeDirection; + +/** + * Represents the 6 possible directions along the axis of a block. + */ +public enum Direction { + /** + * -X + */ + XN(0), + /** + * +X + */ + XP(1), + + /** + * -Y + */ + YN(2), //MC-Code starts with 0 here + /** + * +Y + */ + YP(3), // 1... + + /** + * -Z + */ + ZN(4), + /** + * +Z + */ + ZP(5); + + Direction(int dir1) { + this.dir = dir1; + } + + /*public CoordinateTuple ApplyToCoordinates(CoordinateTuple coordinates) { + CoordinateTuple ret = new CoordinateTuple(coordinates); + + ret.coords[dir/2] += GetSign(); + + return ret; + }*/ + + /** + * Get the tile entity next to a tile entity following this direction. + * + * @param tileEntity tile entity to check + * @return Adjacent tile entity or null if none exists + */ + public TileEntity applyToTileEntity(TileEntity tileEntity) { + int coords[] = { tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord }; + + coords[dir/2] += getSign(); + + if (tileEntity.worldObj != null && tileEntity.worldObj.blockExists(coords[0], coords[1], coords[2])) { + try { + return tileEntity.worldObj.getBlockTileEntity(coords[0], coords[1], coords[2]); + } catch (Exception e) { + throw new RuntimeException("error getting TileEntity at dim "+tileEntity.worldObj.provider.dimensionId+" "+coords[0]+"/"+coords[1]+"/"+coords[2]); + } + } + return null; + } + + /** + * Get the inverse of this direction (XN -> XP, XP -> XN, etc.) + * + * @return Inverse direction + */ + public Direction getInverse() { + int inverseDir = dir - getSign(); + + for (Direction direction : directions) { + if (direction.dir == inverseDir) return direction; + } + + return this; + } + + /** + * Convert this direction to a Minecraft side value. + * + * @return Minecraft side value + */ + public int toSideValue() { + return (dir + 4) % 6; + } + + /** + * Determine direction sign (N for negative or P for positive). + * + * @return -1 if the direction is negative, +1 if the direction is positive + */ + private int getSign() { + return (dir % 2) * 2 - 1; + } + + public ForgeDirection toForgeDirection() { + return ForgeDirection.getOrientation(toSideValue()); + } + + private int dir; + public static final Direction[] directions = Direction.values(); +} + diff --git a/src/api/java/ic2/api/crops/BaseSeed.java b/src/api/java/ic2/api/crops/BaseSeed.java new file mode 100644 index 0000000..de6296b --- /dev/null +++ b/src/api/java/ic2/api/crops/BaseSeed.java @@ -0,0 +1,56 @@ +package ic2.api.crops; + +/** + * Base agriculture seed. Used to determine the state of a plant once it is planted from an item. + */ +public class BaseSeed { + /** + * Plant ID. + */ + public int id; + + /** + * Plant size. + */ + public int size; + + /** + * Plant growth stat. + */ + public int statGrowth; + + /** + * Plant gain stat. + */ + public int statGain; + + /** + * Plant resistance stat. + */ + public int statResistance; + + /** + * For internal usage only. + */ + public int stackSize; + + /** + * Create a BaseSeed object. + * + * @param id1 plant ID + * @param size1 plant size + * @param statGrowth1 plant growth stat + * @param statGain1 plant gain stat + * @param statResistance1 plant resistance stat + * @param stackSize1 for internal usage only + */ + public BaseSeed(int id1, int size1, int statGrowth1, int statGain1, int statResistance1, int stackSize1) { + super(); + this.id = id1; + this.size = size1; + this.statGrowth = statGrowth1; + this.statGain = statGain1; + this.statResistance = statResistance1; + this.stackSize = stackSize1; + } +} diff --git a/src/api/java/ic2/api/crops/CropCard.java b/src/api/java/ic2/api/crops/CropCard.java new file mode 100644 index 0000000..5ff8226 --- /dev/null +++ b/src/api/java/ic2/api/crops/CropCard.java @@ -0,0 +1,374 @@ +package ic2.api.crops; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Base agriculture crop. + * + * Any crop extending this can be registered using registerCrop to be added into the game. + */ +public abstract class CropCard +{ + /** + * Plant name. Will be displayed to the player. + * + * @return Plant name + */ + public abstract String name(); + + /** + * Your name here, will be shown in "Discovered by:" when analyzing seeds. + * + * @return Your name + */ + public String discoveredBy() {return "Alblaka";} + + /** + * Description of your plant. Keep it short, a few characters per line for up to two lines. + * Default is showing attributes of your plant, 2 per line. + * + * @param i line to get, starting from 0 + * @return The line + */ + public String desc(int i) + { + String[] att = attributes(); + if (att == null || att.length==0) return ""; + if (i == 0) + { + String s = att[0]; + if (att.length >= 2) + { + s+=", "+att[1]; + if (att.length >= 3) s+=","; + } + return s; + } + if (att.length < 3) return ""; + String s = att[2]; + if (att.length >= 4) s+=", "+att[3]; + return s; + } + + /** + * Tier of the plant. Ranges from 1 to 16, 0 is Weed. + * Valuable and powerful crops have higher tiers, useless and weak ones have lower tiers. + * + * @return Tier + */ + public abstract int tier(); + + /** + * Describe the plant through a set of stats, influencing breeding. + * Plants sharing stats and attributes will tend to cross-breed more often. + * + * Stats: + * - 0: Chemistry (Industrial uses based on chemical plant components) + * - 1: Consumable (Food, potion ingredients, stuff meant to be eaten or similarly used) + * - 2: Defensive (Plants with defense capabilities (damaging, explosive, chemical) or special abilities in general) + * - 3: Colorful (How colorful/aesthetically/beautiful is the plant, like dye-plants or plants without actual effects) + * - 4: Weed (Is this plant weed-like and rather unwanted/quick-spreading? Rare super-breed plants should have low values here) + * + * @param n index of the requested stat + * @return The requested value of the stats + */ + public abstract int stat(int n); + + /** + * Additional attributes of the plant, also influencing breeding. + * Plants sharing stats and attributes will tend to cross-breed more often. + * + * @return Attributes as an array of strings + */ + public abstract String[] attributes(); + + /** + * Determine the max crop size. + * + * Currently only used for texture allocation. + */ + public abstract int maxSize(); + + /** + * Instantiate your Icons here. + * + * This method will get called by IC2, don't call it yourself. + */ + @SideOnly(Side.CLIENT) + public void registerSprites(IconRegister iconRegister) { + textures = new Icon[maxSize()]; + + for (int i = 1; i <= textures.length; i++) { + textures[i-1] = iconRegister.registerIcon("ic2:crop/blockCrop."+name()+"."+i); + } + } + + /** + * Sprite the crop is meant to be rendered with. + * + * @param crop reference to ICropTile + * @return 0-255, representing the sprite index on the crop's spritesheet. + */ + @SideOnly(Side.CLIENT) + public Icon getSprite(ICropTile crop) { + if (crop.getSize() <= 0 || crop.getSize() > textures.length) return null; + + return textures[crop.getSize() - 1]; + } + + /** + * Get the crop's spritesheet. + * Per default crops_0.png of ic2-sprites + * @return Texture file path + */ + public String getTextureFile() { + return "/ic2/sprites/crops_0.png"; + } + + /** + * Amount of growth points needed to increase the plant's size. + * Default is 200 * tier. + */ + public int growthDuration(ICropTile crop) + { + return tier()*200; + } + + /** + * Check whether the plant can grow further. + * + * Consider: + * - Humidity, nutrients and air quality + * - Current size + * - Light level + * - Special biomes or conditions, accessible through crop.worldObj + * + * This method will be called upon empty upgraded crops to check whether a neighboring plant can cross onto it! Don't check if the size is greater than 0 and if the ID is real. + * + * @param crop reference to ICropTile + * @return Whether the crop can grow + */ + public abstract boolean canGrow(ICropTile crop); + + /** + * Calculate the influence for the plant to grow based on humidity, nutrients and air. + * Normal behavior is rating the three stats "normal", with each of them ranging from 0-30. + * Basic rule: Assume everything returns 10. All together must equal 30. Add the factors to your likings, for example (humidity*0.7)+(nutrients*0.9)+(air*1.4) + * + * Default is humidity + nutrients + air (no factors). + * + * @param crop reference to ICropTile + * @param humidity ground humidity, influenced by hydration + * @param nutrients nutrient quality in ground, based on fertilizers + * @param air air quality, influences by open gardens and less crops surrounding this one + * @return 0-30 + */ + public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) + { + return (int) (humidity+nutrients+air); + } + + /** + * Used to determine whether the plant can crossbreed with another crop. + * Default is allow crossbreeding if the size is greater or equal than 3. + * + * @param crop crop to crossbreed with + */ + public boolean canCross(ICropTile crop) + { + return crop.getSize() >= 3; + } + + + /** + * Called when the plant is rightclicked by a player. + * Default action is harvesting. + * + * Only called Serverside. + * + * @param crop reference to ICropTile + * @param player player rightclicking the crop + * @return Whether the plant has changed + */ + public boolean rightclick(ICropTile crop, EntityPlayer player) + { + return crop.harvest(true); + } + + /** + * Check whether the crop can be harvested. + * + * @param crop reference to ICropTile + * @return Whether the crop can be harvested in its current state. + */ + public abstract boolean canBeHarvested(ICropTile crop); + + /** + * Base chance for dropping the plant's gains, specify values greater than 1 for multiple drops. + * Default is 0.95^tier. + * + * @return Chance to drop the gains + */ + public float dropGainChance() + { + float base = 1F; + for (int i = 0; i < tier(); i++) {base*=0.95;} + return base; + } + + /** + * Item obtained from harvesting the plant. + * + * @param crop reference to ICropTile + * @return Item obtained + */ + public abstract ItemStack getGain(ICropTile crop); + + /** + * Get the size of the plant after harvesting. + * Default is 1. + * + * @param crop reference to ICropTile + * @return Plant size after harvesting + */ + public byte getSizeAfterHarvest(ICropTile crop) {return 1;} + + + /** + * Called when the plant is leftclicked by a player. + * Default action is picking the plant. + * + * Only called Serverside. + * + * @param crop reference to ICropTile + * @param player player leftclicked the crop + * @return Whether the plant has changed + */ + public boolean leftclick(ICropTile crop, EntityPlayer player) + { + return crop.pick(true); + } + + /** + * Base chance for dropping seeds when the plant is picked. + * Default is 0.5*0.8^tier with a bigger chance for sizes greater than 2 and absolutely no chance for size 0. + * + * @param crop reference to ICropTile + * @return Chance to drop the seeds + */ + public float dropSeedChance(ICropTile crop) + { + if (crop.getSize() == 1) return 0; + float base = 0.5F; + if (crop.getSize() == 2) base/=2F; + for (int i = 0; i < tier(); i++) {base*=0.8;} + return base; + } + + /** + * Obtain seeds dropped when the plant is picked. + * Multiple drops of the returned ItemStack can occur. + * Default action is generating a seed from this crop. + * + * @param crop reference to ICropTile + * @return Seeds + */ + public ItemStack getSeeds(ICropTile crop) + { + return crop.generateSeeds(crop.getID(), crop.getGrowth(), crop.getGain(), crop.getResistance(), crop.getScanLevel()); + } + + /** + * Called when a neighbor block to the crop has changed. + * + * @param crop reference to ICropTile + */ + public void onNeighbourChange(ICropTile crop){ + // + } + + /** + * Check if the crop should emit redstone. + * + * @return Whether the crop should emit redstone + */ + public int emitRedstone(ICropTile crop){return 0;} + + /** + * Called when the crop is destroyed. + * + * @param crop reference to ICropTile + */ + public void onBlockDestroyed(ICropTile crop){ + // + } + + /** + * Get the light value emitted by the plant. + * + * @param crop reference to ICropTile + * @return Light value emitted + */ + public int getEmittedLight(ICropTile crop) {return 0;} + + /** + * Default is true if the entity is an EntityLiving in jumping or sprinting state. + * + * @param crop reference to ICropTile + * @param entity entity colliding + * @return Whether trampling calculation should happen, return false if the plant is no longer valid. + */ + public boolean onEntityCollision(ICropTile crop, Entity entity) + { + if (entity instanceof EntityLivingBase) + { + return ((EntityLivingBase)entity).isSprinting(); + } + return false; + } + + + /** + * Called every time the crop ticks. + * Should be called every 256 ticks or around 13 seconds. + * + * @param crop reference to ICropTile + */ + public void tick(ICropTile crop) { + // + } + + /** + * Check whether this plant spreads weed to surrounding tiles. + * Default is true if the plant has a high growth stat (or is weeds) and size greater or equal than 2. + * + * @param crop reference to ICropTile + * @return Whether the plant spreads weed + */ + public boolean isWeed(ICropTile crop) + { + return crop.getSize()>=2 && (crop.getID()==0 || crop.getGrowth()>=24); + } + + + /** + * Get this plant's ID. + * + * @return ID of this CropCard or -1 if it's not registered + */ + public final int getId() + { + return Crops.instance.getIdFor(this); + } + + @SideOnly(Side.CLIENT) + protected Icon textures[]; +} diff --git a/src/api/java/ic2/api/crops/Crops.java b/src/api/java/ic2/api/crops/Crops.java new file mode 100644 index 0000000..c3ee515 --- /dev/null +++ b/src/api/java/ic2/api/crops/Crops.java @@ -0,0 +1,104 @@ +package ic2.api.crops; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.world.biome.BiomeGenBase; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * General management of the crop system. + */ +public abstract class Crops { + public static Crops instance; + + /** + * Adds a crop humidity and nutrient biome bonus. + * + * 0 indicates no bonus and negative values indicate a penalty. + * + * @param biome Biome to apply the bonus in + * @param humidityBonus Humidity stat bonus + * @param nutrientsBonus Nutrient stat bonus + */ + public abstract void addBiomeBonus(BiomeGenBase biome, int humidityBonus, int nutrientsBonus); + + /** + * Gets the humidity bonus for a biome. + * + * @param biome Biome to check + * @return Humidity bonus or 0 if none + */ + public abstract int getHumidityBiomeBonus(BiomeGenBase biome); + + /** + * Gets the nutrient bonus for a biome. + * + * @param biome Biome to check + * @return Nutrient bonus or 0 if none + */ + public abstract int getNutrientBiomeBonus(BiomeGenBase biome); + + /** + * Returns the list of registered crops. + * + * @return Registered crops by ID + */ + public abstract CropCard[] getCropList(); + + /** + * Auto-assign an ID to a plant and register it. + * Usage of this method is not recommended! Other plants could take your IDs and cause your plants to turn into other plants. + * + * @param crop plant to register + * @return The ID assigned to the plant + */ + public abstract short registerCrop(CropCard crop); + + /** + * Attempt to register a plant to an ID. + * If the ID is taken, the crop will not be registered and a console print will notify the user. + * + * @param crop plant to register + * @param i ID to register the plant to + * @return Whether the crop was registered + */ + public abstract boolean registerCrop(CropCard crop, int i); + + /** + * Registers a base seed, an item used to plant a crop. + * + * @param stack item + * @param id plant ID + * @param size initial size + * @param growth initial growth stat + * @param gain initial gain stat + * @param resistance initial resistance stat + * @return True if successful + */ + public abstract boolean registerBaseSeed(ItemStack stack, int id, int size, int growth, int gain, int resistance); + + /** + * Finds a base seed from the given item. + * + * @return Base seed or null if none found + */ + public abstract BaseSeed getBaseSeed(ItemStack stack); + + /** + * Execute registerSprites for all registered crop cards. + * + * This method will get called by IC2, don't call it yourself. + */ + @SideOnly(Side.CLIENT) + public abstract void startSpriteRegistration(IconRegister iconRegister); + + /** + * Returns the ID for the given crop. + * + * @param crop Crop to look up + * @return ID, or -1 if not found + */ + public abstract int getIdFor(CropCard crop); +} diff --git a/src/api/java/ic2/api/crops/ICropTile.java b/src/api/java/ic2/api/crops/ICropTile.java new file mode 100644 index 0000000..4084c50 --- /dev/null +++ b/src/api/java/ic2/api/crops/ICropTile.java @@ -0,0 +1,253 @@ +package ic2.api.crops; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + +/** + * Interface implemented by the crop tile entity. + */ +public interface ICropTile { + /** + * Get the crop's plant ID. + * + * @return Plant ID, or -1 if there is no plant currently on the crop + */ + public short getID(); + + /** + * Set the crop's plant ID. + * + * @param id Plant ID, or -1 for no plant + */ + public void setID(short id); + + /** + * Get the crop's plant size. + * + * @return Plant size, starting with 1 and maximum varies depending on plant + */ + public byte getSize(); + + /** + * Set the crop's plant size. + * + * @param size Plant size + */ + public void setSize(byte size); + + /** + * Get the crop's plant growth stat. + * Higher values indicate faster growth. + * + * @return Plant growth stat + */ + public byte getGrowth(); + + /** + * Set the crop's plant growth stat. + * + * @param growth Plant growth stat + */ + public void setGrowth(byte growth); + + /** + * Get the crop's plant gain stat. + * Higher values indicate more drops. + * + * @return Plant gain stat + */ + public byte getGain(); + + /** + * Set the crop's plant gain stat. + * + * @param gain Plant gain stat + */ + public void setGain(byte gain); + + /** + * Get the crop's plant resistance stat. + * Higher values indicate more resistance against trampling. + * + * @return Plant resistance stat + */ + public byte getResistance(); + + /** + * Set the crop's plant resistance stat. + * + * @param resistance Plant resistance stat + */ + public void setResistance(byte resistance); + + /** + * Get the crop's plant scan level. + * Increases every time the seed is analyzed. + * + * @return Plant scan level + */ + public byte getScanLevel(); + + /** + * Set the crop's plant scan level. + * + * @param scanLevel Plant scan level + */ + public void setScanLevel(byte scanLevel); + + /** + * Get the crop's plant custom data, stored alongside the crop. + * Can be modified in place. + * + * @return Plant custom data + */ + public NBTTagCompound getCustomData(); + + /** + * Get the crop's nutrient storage. + * Ranges from 0 to 100. + * + * @return Crop nutrient storage + */ + public int getNutrientStorage(); + + /** + * Set the crop's nutrient storage. + * + * @param nutrientStorage Crop nutrient storage + */ + public void setNutrientStorage(int nutrientStorage); + + /** + * Get the crop's hydration storage. + * 0 indicates nothing, 1-10 indicate water hydration and 11-100 for hydration cells. + * + * @return Crop hydration storage + */ + public int getHydrationStorage(); + + /** + * Set the crop's hydration storage. + * + * @param hydrationStorage Crop hydration storage + */ + public void setHydrationStorage(int hydrationStorage); + + /** + * Get the crop's Weed-Ex storage. + * + * @return Crop Weed-Ex storage + */ + public int getWeedExStorage(); + + /** + * Set the crop's Weed-Ex storage. + * + * @param weedExStorage Crop Weed-Ex storage + */ + public void setWeedExStorage(int weedExStorage); + + /** + * Get the crop's humidity. + * Ranges from 0 (dry) to 10 (humid). + * Updates every couple of seconds or when an update is requested. + * + * @see #updateState() + * + * @return Crop humidity level + */ + public byte getHumidity(); + + /** + * Get the crop's nutrient level. + * Ranges from 0 (empty) to 10 (full). + * Updates every couple of seconds or when an update is requested. + * + * @see #updateState() + * + * @return Crop nutrient level + */ + public byte getNutrients(); + + /** + * Get the crop's air quality. + * Ranges from 0 (cluttered) to 10 (fresh). + * Updates every couple of seconds or when an update is requested. + * + * @see #updateState() + * + * @return Crop air quality + */ + public byte getAirQuality(); + + /** + * Get the crop's world. + * + * @return Crop world + */ + public World getWorld(); + + /** + * Get the crop's location. + * + * @return Crop location + */ + public ChunkCoordinates getLocation(); + + /** + * Get the crop's light level. + * + * @return Crop light level + */ + public int getLightLevel(); + + /** + * Pick the crop, removing and giving seeds for the plant. + * + * @param manual whether it was done by hand (not automated) + * @return true if successfully picked + */ + public boolean pick(boolean manual); + + /** + * Harvest the crop, turning it into gain and resetting its size. + * + * @param manual whether it one by hand (not automated) + * @return true if successfully harvested + */ + public boolean harvest(boolean manual); + + /** + * Fully clears the crop without dropping anything. + */ + public void reset(); + + /** + * Request a texture and lighting update. + */ + public void updateState(); + + /** + * Check if a block is under the farmland containing the crop. + * Searches up to 2 blocks below the farmland or an air space, whichever appears first. + * + * @param block block to search + * @return Whether the block was found + */ + public boolean isBlockBelow(Block block); + + /** + * Generate plant seeds with the given parameters. + * + * @param plant plant ID + * @param growth plant growth stat + * @param gain plant gain stat + * @param resis plant resistance stat + * @param scan plant scan level + * @return Plant seed item + */ + public ItemStack generateSeeds(short plant, byte growth, byte gain, byte resis, byte scan); +} diff --git a/src/api/java/ic2/api/energy/EnergyNet.java b/src/api/java/ic2/api/energy/EnergyNet.java new file mode 100644 index 0000000..822bfc2 --- /dev/null +++ b/src/api/java/ic2/api/energy/EnergyNet.java @@ -0,0 +1,18 @@ +package ic2.api.energy; + + +/** + * Provides access to the energy network. + * + * The old EnergyNet methods missing in IEnergyNet have been migrated to events (load, unload) or + * removed (tiles no longer emit energy actively, the energy net implementation requests it). + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public final class EnergyNet { + /** + * Instance of the global EnergyNet class. + */ + public static IEnergyNet instance; +} + diff --git a/src/api/java/ic2/api/energy/IEnergyNet.java b/src/api/java/ic2/api/energy/IEnergyNet.java new file mode 100644 index 0000000..e0d674a --- /dev/null +++ b/src/api/java/ic2/api/energy/IEnergyNet.java @@ -0,0 +1,64 @@ +package ic2.api.energy; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import net.minecraftforge.common.ForgeDirection; + +/** + * Interface representing the methods provided by the global EnergyNet class. + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public interface IEnergyNet { + /** + * Get the EnergyNet-registered tile entity at the specified position. + * + * This is not the same as World.getBlockTileEntity(), it's possible to register delegate tile + * entities with the energy net which are different from what's actually in the world. Those + * delegates allow to use separate TileEntity objects just for the EnergyNet interfaces, + * simplifying cross-mod dependencies and multi-blocks. + * + * @param world World containing the tile entity + * @param x x-coordinate + * @param y y-coordinate + * @param z z-coordinate + * @return tile entity registered to the energy net or null if none is registered + */ + TileEntity getTileEntity(World world, int x, int y, int z); + + /** + * Get the EnergyNet-registered neighbor tile entity at the specified position. + * + * @param te TileEntity indicating the world and position to search from + * @param dir direction the neighbor is to be found + * @return neighbor tile entity registered to the energy net or null if none is registered + */ + TileEntity getNeighbor(TileEntity te, ForgeDirection dir); + + /** + * determine how much energy has been emitted by the EnergyEmitter specified + * + * @note call this twice with x ticks delay to get the avg. emitted power p = (call2 - call1) / x EU/tick + * + * @param tileEntity energy emitter + */ + long getTotalEnergyEmitted(TileEntity tileEntity); + + /** + * determine how much energy has been sunken by the EnergySink specified + * + * @note call this twice with x ticks delay to get the avg. sunken power p = (call2 - call1) / x EU/tick + * + * @param tileEntity energy emitter + */ + long getTotalEnergySunken(TileEntity tileEntity); + + /** + * Determine the typical power used by the specific tier, e.g. 128 eu/t for tier 2. + * + * @param tier tier + * @return power in eu/t + */ + int getPowerFromTier(int tier); +} diff --git a/src/api/java/ic2/api/energy/event/EnergyTileEvent.java b/src/api/java/ic2/api/energy/event/EnergyTileEvent.java new file mode 100644 index 0000000..94b1b4a --- /dev/null +++ b/src/api/java/ic2/api/energy/event/EnergyTileEvent.java @@ -0,0 +1,23 @@ +package ic2.api.energy.event; + +import net.minecraft.tileentity.TileEntity; + +import net.minecraftforge.event.world.WorldEvent; + +import ic2.api.energy.tile.IEnergyTile; + +/** + * Base class for energy net events, don't use it directly. + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public class EnergyTileEvent extends WorldEvent { + public final IEnergyTile energyTile; + + public EnergyTileEvent(IEnergyTile energyTile1) { + super(((TileEntity) energyTile1).worldObj); + + this.energyTile = energyTile1; + } +} + diff --git a/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.java b/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.java new file mode 100644 index 0000000..bf019ae --- /dev/null +++ b/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.java @@ -0,0 +1,26 @@ +package ic2.api.energy.event; + +import ic2.api.energy.tile.IEnergyTile; + +/** + * Event announcing new energy tiles. + * + * This event notifies subscribers of loaded energy tiles, e.g. after getting + * loaded through the chunk they are in or after being placed down by the + * player or another deployer mechanism. + * + * Every energy tile which wants to get connected to the IC2 Energy Network has + * to either post this event or alternatively call EnergyNet.addTileEntity(). + * + * You may use this event to build a static representation of energy tiles for + * your own energy grid implementation if you need to. It's not required if you + * always lookup energy paths on demand. + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public class EnergyTileLoadEvent extends EnergyTileEvent { + public EnergyTileLoadEvent(IEnergyTile energyTile1) { + super(energyTile1); + } +} + diff --git a/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.java b/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.java new file mode 100644 index 0000000..2b22ae3 --- /dev/null +++ b/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.java @@ -0,0 +1,27 @@ +package ic2.api.energy.event; + +import ic2.api.energy.tile.IEnergyTile; + +/** + * Event announcing terminated energy tiles. + * + * This event notifies subscribers of unloaded energy tiles, e.g. after getting + * unloaded through the chunk they are in or after being destroyed by the + * player or another block pick/destruction mechanism. + * + * Every energy tile which wants to get disconnected from the IC2 Energy + * Network has to either post this event or alternatively call + * EnergyNet.removeTileEntity(). + * + * You may use this event to build a static representation of energy tiles for + * your own energy grid implementation if you need to. It's not required if you + * always lookup energy paths on demand. + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public class EnergyTileUnloadEvent extends EnergyTileEvent { + public EnergyTileUnloadEvent(IEnergyTile energyTile1) { + super(energyTile1); + } +} + diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.java b/src/api/java/ic2/api/energy/prefab/BasicSink.java new file mode 100644 index 0000000..c60517c --- /dev/null +++ b/src/api/java/ic2/api/energy/prefab/BasicSink.java @@ -0,0 +1,375 @@ +package ic2.api.energy.prefab; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +import cpw.mods.fml.common.FMLCommonHandler; + +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.MinecraftForge; + +import ic2.api.energy.EnergyNet; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; + +/** + * BasicSink is a simple adapter to provide an ic2 energy sink. + * + * It's designed to be attached to a tile entity as a delegate. Functionally BasicSink acts as a + * one-time configurable input energy buffer, thus providing a common use case for machines. + * + * Sub-classing BasicSink instead of using it as a delegate works as well, but isn't recommended. + * The delegate can be extended with additional functionality through a sub class though. + * + * The constraints set by BasicSink like the strict tank-like energy buffering should provide a + * more easy to use and stable interface than using IEnergySink directly while aiming for + * optimal performance. + * + * Using BasicSink involves the following steps: + * - create a BasicSink instance in your TileEntity, typically in a field + * - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSink + * instance. + * If you have other means of determining when the tile entity is fully loaded, notify onLoaded + * that way instead of forwarding updateEntity. + * - call useEnergy whenever appropriate. canUseEnergy determines if enough energy is available + * without consuming the energy. + * - optionally use getEnergyStored to display the output buffer charge level + * - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container) + * + * Example implementation code: + * @code{.java} + * public class SomeTileEntity extends TileEntity { + * // new basic energy sink, 1000 EU buffer, tier 1 (32 EU/t, LV) + * private BasicSink ic2EnergySink = new BasicSink(this, 1000, 1); + * + * @Override + * public void invalidate() { + * ic2EnergySink.invalidate(); // notify the energy sink + * ... + * super.invalidate(); // this is important for mc! + * } + * + * @Override + * public void onChunkUnload() { + * ic2EnergySink.onChunkUnload(); // notify the energy sink + * ... + * } + * + * @Override + * public void readFromNBT(NBTTagCompound tag) { + * super.readFromNBT(tag); + * + * ic2EnergySink.readFromNBT(tag); + * ... + * } + * + * @Override + * public void writeToNBT(NBTTagCompound tag) { + * super.writeToNBT(tag); + * + * ic2EnergySink.writeToNBT(tag); + * ... + * } + * + * @Override + * public void updateEntity() { + * ic2EnergySink.updateEntity(); // notify the energy sink + * ... + * if (ic2EnergySink.useEnergy(5)) { // use 5 eu from the sink's buffer this tick + * ... // do something with the energy + * } + * ... + * } + * + * ... + * } + * @endcode + */ +public class BasicSink extends TileEntity implements IEnergySink { + + // ********************************** + // *** Methods for use by the mod *** + // ********************************** + + /** + * Constructor for a new BasicSink delegate. + * + * @param parent1 TileEntity represented by this energy sink. + * @param capacity1 Maximum amount of eu to store. + * @param tier1 IC2 tier, 1=LV, 2=MV, ... + */ + public BasicSink(TileEntity parent1, int capacity1, int tier1) { + this.parent = parent1; + this.capacity = capacity1; + this.tier = tier1; + } + + // in-world te forwards >> + + /** + * Forward for the base TileEntity's updateEntity(), used for creating the energy net link. + * Either updateEntity or onLoaded have to be used. + */ + @Override + public void updateEntity() { + if (!addedToEnet) onLoaded(); + } + + /** + * Notification that the base TileEntity finished loaded, for advanced uses. + * Either updateEntity or onLoaded have to be used. + */ + public void onLoaded() { + if (!addedToEnet && + !FMLCommonHandler.instance().getEffectiveSide().isClient() && + Info.isIc2Available()) { + worldObj = parent.worldObj; + xCoord = parent.xCoord; + yCoord = parent.yCoord; + zCoord = parent.zCoord; + + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + + addedToEnet = true; + } + } + + /** + * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + @Override + public void invalidate() { + super.invalidate(); + + onChunkUnload(); + } + + /** + * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + @Override + public void onChunkUnload() { + if (addedToEnet && + Info.isIc2Available()) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + + addedToEnet = false; + } + } + + /** + * Forward for the base TileEntity's readFromNBT(), used for loading the state. + * + * @param tag Compound tag as supplied by TileEntity.readFromNBT() + */ + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + + NBTTagCompound data = tag.getCompoundTag("IC2BasicSink"); + + energyStored = data.getDouble("energy"); + } + + /** + * Forward for the base TileEntity's writeToNBT(), used for saving the state. + * + * @param tag Compound tag as supplied by TileEntity.writeToNBT() + */ + @Override + public void writeToNBT(NBTTagCompound tag) { + try { + super.writeToNBT(tag); + } catch (RuntimeException e) { + // happens if this is a delegate, ignore + } + + NBTTagCompound data = new NBTTagCompound(); + + data.setDouble("energy", energyStored); + + tag.setTag("IC2BasicSink", data); + } + + // << in-world te forwards + // methods for using this adapter >> + + /** + * Get the maximum amount of energy this sink can hold in its buffer. + * + * @return Capacity in EU. + */ + public int getCapacity() { + return capacity; + } + + /** + * Set the maximum amount of energy this sink can hold in its buffer. + * + * @param capacity1 Capacity in EU. + */ + public void setCapacity(int capacity1) { + this.capacity = capacity1; + } + + /** + * Get the IC2 energy tier for this sink. + * + * @return IC2 Tier. + */ + public int getTier() { + return tier; + } + + /** + * Set the IC2 energy tier for this sink. + * + * @param tier1 IC2 Tier. + */ + public void setTier(int tier1) { + this.tier = tier1; + } + + /** + * Determine the energy stored in the sink's input buffer. + * + * @return amount in EU, may be above capacity + */ + public double getEnergyStored() { + return energyStored; + } + + /** + * Set the stored energy to the specified amount. + * + * This is intended for server -> client synchronization, e.g. to display the stored energy in + * a GUI through getEnergyStored(). + * + * @param amount + */ + public void setEnergyStored(double amount) { + energyStored = amount; + } + + /** + * Determine if the specified amount of energy is available. + * + * @param amount in EU + * @return true if the amount is available + */ + public boolean canUseEnergy(double amount) { + return energyStored >= amount; + } + + /** + * Use the specified amount of energy, if available. + * + * @param amount amount to use + * @return true if the amount was available + */ + public boolean useEnergy(double amount) { + if (canUseEnergy(amount) && !FMLCommonHandler.instance().getEffectiveSide().isClient()) { + energyStored -= amount; + + return true; + } + return false; + } + + /** + * Discharge the supplied ItemStack into this sink's energy buffer. + * + * @param stack ItemStack to discharge (null is ignored) + * @param limit Transfer limit, values <= 0 will use the battery's limit + * @return true if energy was transferred + */ + public boolean discharge(ItemStack stack, int limit) { + if (stack == null || !Info.isIc2Available()) return false; + + int amount = (int) Math.floor(capacity - energyStored); + if (amount <= 0) return false; + + if (limit > 0 && limit < amount) amount = limit; + + amount = ElectricItem.manager.discharge(stack, amount, tier, limit > 0, false); + + energyStored += amount; + + return amount > 0; + } + + // << methods for using this adapter + + // backwards compatibility (ignore these) >> + + @Deprecated + public void onUpdateEntity() { + updateEntity(); + } + + @Deprecated + public void onInvalidate() { + invalidate(); + } + + @Deprecated + public void onOnChunkUnload() { + onChunkUnload(); + } + + @Deprecated + public void onReadFromNbt(NBTTagCompound tag) { + readFromNBT(tag); + } + + @Deprecated + public void onWriteToNbt(NBTTagCompound tag) { + writeToNBT(tag); + } + + // << backwards compatibility + + // ****************************** + // *** Methods for use by ic2 *** + // ****************************** + + // energy net interface >> + + @Override + public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { + return true; + } + + @Override + public double demandedEnergyUnits() { + return Math.max(0, capacity - energyStored); + } + + @Override + public double injectEnergyUnits(ForgeDirection directionFrom, double amount) { + energyStored += amount; + + return 0; + } + + @Override + public int getMaxSafeInput() { + return EnergyNet.instance.getPowerFromTier(tier); + } + + // << energy net interface + + + public final TileEntity parent; + + protected int capacity; + protected int tier; + protected double energyStored; + protected boolean addedToEnet; +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.java b/src/api/java/ic2/api/energy/prefab/BasicSource.java new file mode 100644 index 0000000..f8097e6 --- /dev/null +++ b/src/api/java/ic2/api/energy/prefab/BasicSource.java @@ -0,0 +1,375 @@ +package ic2.api.energy.prefab; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +import cpw.mods.fml.common.FMLCommonHandler; + +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.MinecraftForge; + +import ic2.api.energy.EnergyNet; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergySource; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; + +/** + * BasicSource is a simple adapter to provide an ic2 energy source. + * + * It's designed to be attached to a tile entity as a delegate. Functionally BasicSource acts as a + * one-time configurable output energy buffer, thus providing a common use case for generators. + * + * Sub-classing BasicSource instead of using it as a delegate works as well, but isn't recommended. + * The delegate can be extended with additional functionality through a sub class though. + * + * The constraints set by BasicSource like the strict tank-like energy buffering should provide a + * more easy to use and stable interface than using IEnergySource directly while aiming for + * optimal performance. + * + * Using BasicSource involves the following steps: + * - create a BasicSource instance in your TileEntity, typically in a field + * - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSource + * instance. + * If you have other means of determining when the tile entity is fully loaded, notify onLoaded + * that way instead of forwarding updateEntity. + * - call addEnergy whenever appropriate, using getFreeCapacity may determine if e.g. the generator + * should run + * - optionally use getEnergyStored to display the output buffer charge level + * - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container) + * + * Example implementation code: + * @code{.java} + * public class SomeTileEntity extends TileEntity { + * // new basic energy source, 1000 EU buffer, tier 1 (32 EU/t, LV) + * private BasicSource ic2EnergySource = new BasicSource(this, 1000, 1); + * + * @Override + * public void invalidate() { + * ic2EnergySource.invalidate(); // notify the energy source + * ... + * super.invalidate(); // this is important for mc! + * } + * + * @Override + * public void onChunkUnload() { + * ic2EnergySource.onChunkUnload(); // notify the energy source + * ... + * } + * + * @Override + * public void readFromNBT(NBTTagCompound tag) { + * super.readFromNBT(tag); + * + * ic2EnergySource.readFromNBT(tag); + * ... + * } + * + * @Override + * public void writeToNBT(NBTTagCompound tag) { + * super.writeToNBT(tag); + * + * ic2EnergySource.writeToNBT(tag); + * ... + * } + * + * @Override + * public void updateEntity() { + * ic2EnergySource.updateEntity(); // notify the energy source + * ... + * ic2EnergySource.addEnergy(5); // add 5 eu to the source's buffer this tick + * ... + * } + * + * ... + * } + * @endcode + */ +public class BasicSource extends TileEntity implements IEnergySource { + + // ********************************** + // *** Methods for use by the mod *** + // ********************************** + + /** + * Constructor for a new BasicSource delegate. + * + * @param parent1 Base TileEntity represented by this energy source. + * @param capacity1 Maximum amount of eu to store. + * @param tier1 IC2 tier, 1=LV, 2=MV, ... + */ + public BasicSource(TileEntity parent1, int capacity1, int tier1) { + int power = EnergyNet.instance.getPowerFromTier(tier1); + + this.parent = parent1; + this.capacity = capacity1 < power ? power : capacity1; + this.tier = tier1; + } + + // in-world te forwards >> + + /** + * Forward for the base TileEntity's updateEntity(), used for creating the energy net link. + * Either updateEntity or onLoaded have to be used. + */ + @Override + public void updateEntity() { + if (!addedToEnet) onLoaded(); + } + + /** + * Notification that the base TileEntity finished loading, for advanced uses. + * Either updateEntity or onLoaded have to be used. + */ + public void onLoaded() { + if (!addedToEnet && + !FMLCommonHandler.instance().getEffectiveSide().isClient() && + Info.isIc2Available()) { + worldObj = parent.worldObj; + xCoord = parent.xCoord; + yCoord = parent.yCoord; + zCoord = parent.zCoord; + + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + + addedToEnet = true; + } + } + + /** + * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + @Override + public void invalidate() { + super.invalidate(); + + onChunkUnload(); + } + + /** + * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + @Override + public void onChunkUnload() { + if (addedToEnet && + Info.isIc2Available()) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + + addedToEnet = false; + } + } + + /** + * Forward for the base TileEntity's readFromNBT(), used for loading the state. + * + * @param tag Compound tag as supplied by TileEntity.readFromNBT() + */ + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + + NBTTagCompound data = tag.getCompoundTag("IC2BasicSource"); + + energyStored = data.getDouble("energy"); + } + + /** + * Forward for the base TileEntity's writeToNBT(), used for saving the state. + * + * @param tag Compound tag as supplied by TileEntity.writeToNBT() + */ + @Override + public void writeToNBT(NBTTagCompound tag) { + try { + super.writeToNBT(tag); + } catch (RuntimeException e) { + // happens if this is a delegate, ignore + } + + NBTTagCompound data = new NBTTagCompound(); + + data.setDouble("energy", energyStored); + + tag.setTag("IC2BasicSource", data); + } + + // << in-world te forwards + // methods for using this adapter >> + + /** + * Get the maximum amount of energy this source can hold in its buffer. + * + * @return Capacity in EU. + */ + public int getCapacity() { + return capacity; + } + + /** + * Set the maximum amount of energy this source can hold in its buffer. + * + * @param capacity1 Capacity in EU. + */ + public void setCapacity(int capacity1) { + int power = EnergyNet.instance.getPowerFromTier(tier); + + if (capacity1 < power) capacity1 = power; + + this.capacity = capacity1; + } + + /** + * Get the IC2 energy tier for this source. + * + * @return IC2 Tier. + */ + public int getTier() { + return tier; + } + + /** + * Set the IC2 energy tier for this source. + * + * @param tier1 IC2 Tier. + */ + public void setTier(int tier1) { + int power = EnergyNet.instance.getPowerFromTier(tier1); + + if (capacity < power) capacity = power; + + this.tier = tier1; + } + + + /** + * Determine the energy stored in the source's output buffer. + * + * @return amount in EU + */ + public double getEnergyStored() { + return energyStored; + } + + /** + * Set the stored energy to the specified amount. + * + * This is intended for server -> client synchronization, e.g. to display the stored energy in + * a GUI through getEnergyStored(). + * + * @param amount + */ + public void setEnergyStored(double amount) { + energyStored = amount; + } + + /** + * Determine the free capacity in the source's output buffer. + * + * @return amount in EU + */ + public double getFreeCapacity() { + return capacity - energyStored; + } + + /** + * Add some energy to the output buffer. + * + * @param amount maximum amount of energy to add + * @return amount added/used, NOT remaining + */ + public double addEnergy(double amount) { + if (FMLCommonHandler.instance().getEffectiveSide().isClient()) return 0; + if (amount > capacity - energyStored) amount = capacity - energyStored; + + energyStored += amount; + + return amount; + } + + /** + * Charge the supplied ItemStack from this source's energy buffer. + * + * @param stack ItemStack to charge (null is ignored) + * @return true if energy was transferred + */ + public boolean charge(ItemStack stack) { + if (stack == null || !Info.isIc2Available()) return false; + + int amount = ElectricItem.manager.charge(stack, (int) energyStored, tier, false, false); + + energyStored -= amount; + + return amount > 0; + } + + // << methods for using this adapter + + // backwards compatibility (ignore these) >> + + @Deprecated + public void onUpdateEntity() { + updateEntity(); + } + + @Deprecated + public void onInvalidate() { + invalidate(); + } + + @Deprecated + public void onOnChunkUnload() { + onChunkUnload(); + } + + @Deprecated + public void onReadFromNbt(NBTTagCompound tag) { + readFromNBT(tag); + } + + @Deprecated + public void onWriteToNbt(NBTTagCompound tag) { + writeToNBT(tag); + } + + // << backwards compatibility + + // ****************************** + // *** Methods for use by ic2 *** + // ****************************** + + // energy net interface >> + + @Override + public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) { + return true; + } + + @Override + public double getOfferedEnergy() { + int power = EnergyNet.instance.getPowerFromTier(tier); + + if (energyStored >= power) { + return power; + } + return 0; + } + + @Override + public void drawEnergy(double amount) { + energyStored -= amount; + } + + // << energy net interface + + + public final TileEntity parent; + + protected int capacity; + protected int tier; + protected double energyStored; + protected boolean addedToEnet; +} diff --git a/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.java b/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.java new file mode 100644 index 0000000..8b1d75e --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.java @@ -0,0 +1,27 @@ +package ic2.api.energy.tile; + +import net.minecraft.tileentity.TileEntity; + +import net.minecraftforge.common.ForgeDirection; + +/** + * For internal/multi-block usage only. + * + * @see IEnergySink + * @see IEnergyConductor + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public interface IEnergyAcceptor extends IEnergyTile { + /** + * Determine if this acceptor can accept current from an adjacent emitter in a direction. + * + * The TileEntity in the emitter parameter is what was originally added to the energy net, + * which may be normal in-world TileEntity, a delegate or an IMetaDelegate. + * + * @param emitter energy emitter + * @param direction direction the energy is being received from + */ + boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction); +} + diff --git a/src/api/java/ic2/api/energy/tile/IEnergyConductor.java b/src/api/java/ic2/api/energy/tile/IEnergyConductor.java new file mode 100644 index 0000000..16965af --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IEnergyConductor.java @@ -0,0 +1,53 @@ +package ic2.api.energy.tile; + +/** + * Tile entities which conduct energy pulses without buffering (mostly cables) have to implement this + * interface. + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public interface IEnergyConductor extends IEnergyAcceptor, IEnergyEmitter { + /** + * Energy loss for the conductor in EU per block. + * + * @return Energy loss + */ + double getConductionLoss(); + + /** + * Amount of energy the insulation will handle before shocking nearby players and mobs. + * + * @return Insulation energy absorption in EU + */ + int getInsulationEnergyAbsorption(); + + /** + * Amount of energy the insulation will handle before it is destroyed. + * Ensure that this value is greater than the insulation energy absorption + 64. + * + * @return Insulation-destroying energy in EU + */ + int getInsulationBreakdownEnergy(); + + /** + * Amount of energy the conductor will handle before it melts. + * + * @return Conductor-destroying energy in EU + */ + int getConductorBreakdownEnergy(); + + /** + * Remove the conductor's insulation if the insulation breakdown energy was exceeded. + * + * @see #getInsulationBreakdownEnergy() + */ + void removeInsulation(); + + /** + * Remove the conductor if the conductor breakdown energy was exceeded. + * + * @see #getConductorBreakdownEnergy() + */ + void removeConductor(); +} + diff --git a/src/api/java/ic2/api/energy/tile/IEnergyEmitter.java b/src/api/java/ic2/api/energy/tile/IEnergyEmitter.java new file mode 100644 index 0000000..2379252 --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IEnergyEmitter.java @@ -0,0 +1,28 @@ +package ic2.api.energy.tile; + +import net.minecraft.tileentity.TileEntity; + +import net.minecraftforge.common.ForgeDirection; + +/** + * For internal/multi-block usage only. + * + * @see IEnergySource + * @see IEnergyConductor + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public interface IEnergyEmitter extends IEnergyTile { + /** + * Determine if this emitter can emit energy to an adjacent receiver. + * + * The TileEntity in the receiver parameter is what was originally added to the energy net, + * which may be normal in-world TileEntity, a delegate or an IMetaDelegate. + * + * @param receiver receiver, may be an IMetaDelegate + * @param direction direction the receiver is from the emitter + * @return Whether energy should be emitted + */ + boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction); +} + diff --git a/src/api/java/ic2/api/energy/tile/IEnergySink.java b/src/api/java/ic2/api/energy/tile/IEnergySink.java new file mode 100644 index 0000000..9826d54 --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IEnergySink.java @@ -0,0 +1,46 @@ +package ic2.api.energy.tile; + +import net.minecraftforge.common.ForgeDirection; + +/** + * Allows a tile entity (mostly a machine) to receive energy. + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public interface IEnergySink extends IEnergyAcceptor { + /** + * Determine how much energy the sink accepts. + * + * This value is unrelated to getMaxSafeInput(). + * + * Make sure that injectEnergy() does accepts energy if demandsEnergy() returns anything > 0. + * + * @return max accepted input in eu + */ + double demandedEnergyUnits(); + + /** + * Transfer energy to the sink. + * + * It's highly recommended to accept all energy by letting the internal buffer overflow to + * increase the performance and accuracy of the distribution simulation. + * + * @param directionFrom direction from which the energy comes from + * @param amount energy to be transferred + * @return Energy not consumed (leftover) + */ + double injectEnergyUnits(ForgeDirection directionFrom, double amount); + + /** + * Determine the amount of eu which can be safely injected into the specific energy sink without exploding. + * + * Typical values are 32 for LV, 128 for MV, 512 for HV and 2048 for EV. A value of Integer.MAX_VALUE indicates no + * limit. + * + * This value is unrelated to demandsEnergy(). + * + * @return max safe input in eu + */ + int getMaxSafeInput(); +} + diff --git a/src/api/java/ic2/api/energy/tile/IEnergySource.java b/src/api/java/ic2/api/energy/tile/IEnergySource.java new file mode 100644 index 0000000..1a8bc0a --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IEnergySource.java @@ -0,0 +1,26 @@ +package ic2.api.energy.tile; + +/** + * Allows a tile entity (mostly a generator) to emit energy. + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public interface IEnergySource extends IEnergyEmitter { + /** + * Energy output provided by the source this tick. + * This is typically Math.min(stored energy, max output/tick). + * + * @return Energy offered this tick + */ + double getOfferedEnergy(); + + /** + * Draw energy from this source's buffer. + * + * If the source doesn't have a buffer, this is a no-op. + * + * @param amount amount of EU to draw, may be negative + */ + void drawEnergy(double amount); +} + diff --git a/src/api/java/ic2/api/energy/tile/IEnergyTile.java b/src/api/java/ic2/api/energy/tile/IEnergyTile.java new file mode 100644 index 0000000..3938190 --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IEnergyTile.java @@ -0,0 +1,15 @@ +package ic2.api.energy.tile; + +/** + * For internal usage only, base class for all energy tiles. + * + * @see IEnergySink + * @see IEnergySource + * @see IEnergyConductor + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public interface IEnergyTile { + // +} + diff --git a/src/api/java/ic2/api/energy/tile/IMetaDelegate.java b/src/api/java/ic2/api/energy/tile/IMetaDelegate.java new file mode 100644 index 0000000..8f4e830 --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IMetaDelegate.java @@ -0,0 +1,34 @@ +package ic2.api.energy.tile; + +import java.util.List; + +import net.minecraft.tileentity.TileEntity; + +/** + * Interface for grouping multi-block structures to a single energy net delegate. + * + * The energy net uses TileEntity to refer to a specific xyz+world position. If multiple of those + * positions should belong to the same functional structure, i.e. they consume or produce energy + * only once for the whole multi-block instead of once per every single block, this interface + * allows to do so. + * + * The tile entity implementing IMetaDelegate has to be added/removed to/from the energy net + * instead of every single sub-TileEntity. The energy net interaction will be handled by the + * IMetaDelegate TileEntity as well. + * + * The sub tile array TileEntity[] just provides optional connectivity (IEnergyAcceptor, + * IEnergyEmitter) and mandatory position (x, y, z, World) data. + * If the connectivity data on the sub tile is missing, the meta delegate is queried instead. + * + * See ic2/api/energy/usage.txt for an overall description of the energy net api. + */ +public interface IMetaDelegate extends IEnergyTile { + /** + * Get the sub-TileEntities belonging to this Meta TileEntity. + * + * @note the list has to be consistent between the EnergyNet Load and Unload events. + * + * @return sub-TileEntity array + */ + List getSubTiles(); +} diff --git a/src/api/java/ic2/api/energy/usage.txt b/src/api/java/ic2/api/energy/usage.txt new file mode 100644 index 0000000..49bd995 --- /dev/null +++ b/src/api/java/ic2/api/energy/usage.txt @@ -0,0 +1,144 @@ +-------------------------------- +-- Energy Network Description -- +-------------------------------- + +There are currently three different types of energy network blocks: +- energy sources, e.g. generators or the output side of a storage block/transformer +- energy sinks, e.g. machines or the input side of a storage block/transformer +- conductors, e.g. cables + +Note that storage blocks or transformers are both sources and sinks. + +All those blocks have to have a tile entity which has to implement the interface corresponding to +its function and also post events to the Forge event bus. + +The energy generation, distribution and consumption is strictly limited to the simulating (server) +side, use the proper side checks before posting the related events. One possibility is to check for +FMLCommonHandler.instance().getEffectiveSide().isClient() being false. + +The energy network works by calculating the energy flow between the sources which offer energy +through getOfferedEnergy() and the sinks which request energy through demandedEnergyUnits(). +Conductors will carry the energy over a distance. Once the energy distribution is calculated, the +energy net will update the sources and sinks through drawEnergy() and injectEnergyUnits() respectively. + + +--------------------------- +-- Energy Network Events -- +--------------------------- + +The energy network currently requires 2 events to manage its internal representation of the grids: + +-- EnergyTileLoadEvent -- + +For all energy network tiles (sources, sinks, conductors) you have to post an EnergyTileLoadEvent. + +The event has to be posted as soon as the implementing tile entity is fully loaded, usually after +loading the chunk which contains it or after the user placing the block. + +The energy net implementation will use the event to add it to its energy grid map, taking it into +account for further energy transfers. + +You can detect the loading by either using the 1st iteration of updateEntity() or by waiting for +the next world tick after TileEntity.validate(). The 2nd approach is obviously more sophisticated +and requires to use some tick queuing mechanism. + +The event can by posted as following: + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + +-- EnergyTileUnloadEvent -- + +Another event every energy tile has to post is the EnergyTileUnloadEvent. + +The event has to be posted as soon as the implementing tile entity is being unloaded, either by +unloading the containing chunk or by destroying the block containing it. + +It's possible to detect the unloading by triggering on both the beginning of +TileEntity.invalidate() and the beginning of TileEntity.onChunkUnload(). + +It is important that the tile entity is still properly linked to the world while posting the unload +event, otherwise the energy net can't find all affected connections. + + +-------------------------------------- +-- Participating Block Requirements -- +-------------------------------------- + +The energy net blocks have to do the following to work properly: + +-- energy source -- + +An energy source has to post the following events: + - EnergyTileLoadEvent on load + - EnergyTileUnloadEvent on unload + +Additionally the interface IEnergySource has to be implemented. + +-- energy sink -- + +An energy sink has to post the following events: + - EnergyTileLoadEvent on load + - EnergyTileUnloadEvent on unload + +Additionally the interface IEnergySink has to be implemented. + +-- energy conductor -- + +An energy conductor has to post the following events: + - EnergyTileLoadEvent on load + - EnergyTileUnloadEvent on unload + +Additionally the interface IEnergyConductor has to be implemented. + + +------------------------------ +-- Energy Network Delegates -- +------------------------------ + +A delegate is a separate object which performs tasks for the original object, in this case handling +the energy net interaction. + +The TileEntity instances used by the events don't have to be the same as the in-world TileEntity +instance for the corresponding position, it can be delegated to a separate TileEntity instance. +This separate instance (delegate) needs to have its world and xyz coordinate fields set to match +the in-world instance. The delegate implements the energy net interfaces and is added and removed +to/from the energy net through EnergyTileLoadEvent and EnergyTileUnloadEvent. + +Separating the interfaces through a delegate allows to isolate the IC2 API usage into separate +classes an potentially share common code like an input buffer with battery discharging outside the +class hierarchy. +It's even possible to use an ic2 energy net delegate alongside an in-world TileEntity which isn't +designed to work with ic2 energy at all, like making a furnace electric by receiving energy through +a delegate and adding the corresponding fuel amount to the in-world furnace TileEntity. + +Getting the in-world TileEntity for a delegate involves calling World.getBlockTileEntity() with the +delegate's world and xyz coordinate information. + + +------------------ +-- Multi Blocks -- +------------------ + +Multi blocks are a group of blocks which act as one functional entity. + +The IMetaDelegate interface groups multiple TileEntity instances (=sub tiles) representing the +individual blocks to a single Energy Net relevant node. The sub tiles may be normal in-world or +delegate TileEntity instances. + +The meta delegate is added to energy net once for the whole multi block structure and implements +the energy net interfaces as well. The sub tiles may optionally implement IEnergyEmitter and/or +IEnergyAcceptor to specify their connectivity rules independently, otherwise the meta delegate will +be queried. + + +-------------------------------------------------- +-- How to implement/add your own energy network -- +-------------------------------------------------- + +If you want to create an alternative way of distributing energy, e.g. to have different +distribution rules or to use energy networks provided by other mods, you can register to the energy +tile events and use the interfaces to handle the energy distribution yourself. It's no longer +required to use conversion blocks. + +IC2's EnergyNet itself is built on top of the api events and interfaces, providing their default +use case. + diff --git a/src/api/java/ic2/api/event/LaserEvent.java b/src/api/java/ic2/api/event/LaserEvent.java new file mode 100644 index 0000000..a6efffd --- /dev/null +++ b/src/api/java/ic2/api/event/LaserEvent.java @@ -0,0 +1,113 @@ +package ic2.api.event; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import net.minecraftforge.event.Cancelable; +import net.minecraftforge.event.world.WorldEvent; + +/** + * A bunch of Events to handle the power of the Mining Laser. + */ +@Cancelable +public class LaserEvent extends WorldEvent { + // the Laser Entity + public final Entity lasershot; + + // the following variables can be changed and the Laser will adjust to them + + // the Player firing the Laser. If the Laser gets "reflected" the Player could change. + public EntityLivingBase owner; + // Range of the Laser Shot. Determine the amount of broken blocks, as well, as each broken block will subtract ~1F from range. + public float range, power; + public int blockBreaks; + // Determines whether the laser will explode upon hitting something + public boolean explosive, smelt; + + public LaserEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1) { + super(world1); + this.lasershot = lasershot1; + this.owner = owner1; + this.range = range1; + this.power = power1; + this.blockBreaks = blockBreaks1; + this.explosive = explosive1; + this.smelt = smelt1; + } + + /** + * Event when the Laser is getting shot by a Player. + * + * The Item is the Laser Gun which the "Player" has shot + */ + public static class LaserShootEvent extends LaserEvent { + ItemStack laseritem; + + public LaserShootEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1, ItemStack laseritem1) { + super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1); + this.laseritem = laseritem1; + } + } + + /** + * Event when the Laser is exploding for some Reason. + * + * The Laser will no longer exist after this Event is posted as it either Explodes or despawns after the Event is fired. + */ + public static class LaserExplodesEvent extends LaserEvent { + // explosion strength, even that can be changed! + public float explosionpower, explosiondroprate, explosionentitydamage; + + public LaserExplodesEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1, float explosionpower1, float explosiondroprate1, float explosionentitydamage1) { + super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1); + this.explosionpower = explosionpower1; + this.explosiondroprate = explosiondroprate1; + this.explosionentitydamage = explosionentitydamage1; + } + } + + /** + * Event when the Laser is hitting a Block + * x, y and z are the Coords of the Block. + * + * Canceling this Event stops the Laser from attempting to break the Block, what is very useful for Glass. + * Use lasershot.setDead() to remove the Shot entirely. + */ + public static class LaserHitsBlockEvent extends LaserEvent { + // targeted block, even that can be changed! + public int x, y, z; + public int side; + // removeBlock determines if the Block will be removed. dropBlock determines if the Block should drop something. + public boolean removeBlock, dropBlock; + public float dropChance; + + public LaserHitsBlockEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1, int x1, int y1, int z1, int side1, float dropChance1, boolean removeBlock1, boolean dropBlock1) { + super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1); + this.x = x1; + this.y = y1; + this.z = z1; + this.side = side1; + this.removeBlock = removeBlock1; + this.dropBlock = dropBlock1; + this.dropChance = dropChance1; + } + } + + /** + * Event when the Laser is getting at a Living Entity + * + * Canceling this Event ignores the Entity + * Use lasershot.setDead() to remove the Shot entirely. + */ + public static class LaserHitsEntityEvent extends LaserEvent { + // the Entity which the Laser has shot at, even the target can be changed! + public Entity hitentity; + + public LaserHitsEntityEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1, Entity hitentity1) { + super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1); + this.hitentity = hitentity1; + } + } +} diff --git a/src/api/java/ic2/api/event/PaintEvent.java b/src/api/java/ic2/api/event/PaintEvent.java new file mode 100644 index 0000000..5626338 --- /dev/null +++ b/src/api/java/ic2/api/event/PaintEvent.java @@ -0,0 +1,31 @@ +package ic2.api.event; + +import net.minecraft.world.World; + +import net.minecraftforge.event.Cancelable; +import net.minecraftforge.event.world.WorldEvent; + +@Cancelable +public class PaintEvent extends WorldEvent { + // target block + public final int x; + public final int y; + public final int z; + public final int side; + + // color to paint the block + public final int color; + + // set to true to confirm the operation + public boolean painted = false; + + public PaintEvent(World world1, int x1, int y1, int z1, int side1, int color1) { + super(world1); + + this.x = x1; + this.y = y1; + this.z = z1; + this.side = side1; + this.color = color1; + } +} diff --git a/src/api/java/ic2/api/event/RetextureEvent.java b/src/api/java/ic2/api/event/RetextureEvent.java new file mode 100644 index 0000000..57383f1 --- /dev/null +++ b/src/api/java/ic2/api/event/RetextureEvent.java @@ -0,0 +1,35 @@ +package ic2.api.event; + +import net.minecraft.world.World; + +import net.minecraftforge.event.Cancelable; +import net.minecraftforge.event.world.WorldEvent; + +@Cancelable +public class RetextureEvent extends WorldEvent { + // target block + public final int x; + public final int y; + public final int z; + public final int side; + + // referenced block (to grab the texture from) + public final int referencedBlockId; + public final int referencedMeta; + public final int referencedSide; + + // set to true to confirm the operation + public boolean applied = false; + + public RetextureEvent(World world1, int x1, int y1, int z1, int side1, int referencedBlockId1, int referencedMeta1, int referencedSide1) { + super(world1); + + this.x = x1; + this.y = y1; + this.z = z1; + this.side = side1; + this.referencedBlockId = referencedBlockId1; + this.referencedMeta = referencedMeta1; + this.referencedSide = referencedSide1; + } +} diff --git a/src/api/java/ic2/api/info/IEnergyValueProvider.java b/src/api/java/ic2/api/info/IEnergyValueProvider.java new file mode 100644 index 0000000..50e84e6 --- /dev/null +++ b/src/api/java/ic2/api/info/IEnergyValueProvider.java @@ -0,0 +1,14 @@ +package ic2.api.info; + +import net.minecraft.item.ItemStack; + +public interface IEnergyValueProvider { + /** + * Determine the energy value for a single item in the supplied stack. + * The value is used by most machines in the discharge slot. + * + * @param itemStack ItemStack containing the item to evaluate. + * @return energy in EU + */ + int getEnergyValue(ItemStack itemStack); +} diff --git a/src/api/java/ic2/api/info/IFuelValueProvider.java b/src/api/java/ic2/api/info/IFuelValueProvider.java new file mode 100644 index 0000000..7c7fe0f --- /dev/null +++ b/src/api/java/ic2/api/info/IFuelValueProvider.java @@ -0,0 +1,15 @@ +package ic2.api.info; + +import net.minecraft.item.ItemStack; + +public interface IFuelValueProvider { + /** + * Determine the fuel value for a single item in the supplied stack. + * The information currently applies to Generators and the Iron Furnace. + * + * @param itemStack ItemStack containing the item to evaluate. + * @param allowLava Determine if lava has a fuel value, currently only true for the Iron Furnace. + * @return fuel value + */ + int getFuelValue(ItemStack itemStack, boolean allowLava); +} diff --git a/src/api/java/ic2/api/info/Info.java b/src/api/java/ic2/api/info/Info.java new file mode 100644 index 0000000..3b5a544 --- /dev/null +++ b/src/api/java/ic2/api/info/Info.java @@ -0,0 +1,32 @@ +package ic2.api.info; + +import net.minecraft.util.DamageSource; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.LoaderState; + +public class Info { + public static IEnergyValueProvider itemEnergy; + public static IFuelValueProvider itemFuel; + public static Object ic2ModInstance; + + /** + * Damage Sources used by IC2. + * Getting assigned in preload. + */ + public static DamageSource DMG_ELECTRIC, DMG_NUKE_EXPLOSION, DMG_RADIATION; + + public static boolean isIc2Available() { + if (ic2Available != null) return ic2Available; + + boolean loaded = Loader.isModLoaded("IC2"); + + if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) { + ic2Available = loaded; + } + + return loaded; + } + + private static Boolean ic2Available = null; +} \ No newline at end of file diff --git a/src/api/java/ic2/api/item/ElectricItem.java b/src/api/java/ic2/api/item/ElectricItem.java new file mode 100644 index 0000000..511220f --- /dev/null +++ b/src/api/java/ic2/api/item/ElectricItem.java @@ -0,0 +1,108 @@ +package ic2.api.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +/** + * Allows for charging, discharging and using electric items (IElectricItem). + * + * The charge or remaining capacity of an item can be determined by calling charge/discharge with + * ignoreTransferLimit and simulate set to true. + */ +public final class ElectricItem { + /** + * IElectricItemManager to use for interacting with IElectricItem ItemStacks. + * + * This manager will act as a gateway and delegate the tasks to the final implementation + * (rawManager or a custom one) as necessary. + */ + public static IElectricItemManager manager; + + /** + * Standard IElectricItemManager implementation, only call it directly from another + * IElectricItemManager. Use manager instead. + */ + public static IElectricItemManager rawManager; + + /** + * Charge an item with a specified amount of energy + * + * @param itemStack electric item's stack + * @param amount amount of energy to charge in EU + * @param tier tier of the charging device, has to be at least as high as the item to charge + * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() + * @param simulate don't actually change the item, just determine the return value + * @return Energy transferred into the electric item + * + * @deprecated use manager.charge() instead + */ + @Deprecated + public static int charge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { + return manager.charge(itemStack, amount, tier, ignoreTransferLimit, simulate); + } + + /** + * Discharge an item by a specified amount of energy + * + * @param itemStack electric item's stack + * @param amount amount of energy to charge in EU + * @param tier tier of the discharging device, has to be at least as high as the item to discharge + * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() + * @param simulate don't actually discharge the item, just determine the return value + * @return Energy retrieved from the electric item + * + * @deprecated use manager.discharge() instead + */ + @Deprecated + public static int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { + return manager.discharge(itemStack, amount, tier, ignoreTransferLimit, simulate); + } + + /** + * Determine if the specified electric item has at least a specific amount of EU. + * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. + * BatPacks are not taken into account. + * + * @param itemStack electric item's stack + * @param amount minimum amount of energy required + * @return true if there's enough energy + * + * @deprecated use manager.canUse() instead + */ + @Deprecated + public static boolean canUse(ItemStack itemStack, int amount) { + return manager.canUse(itemStack, amount); + } + + /** + * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. + * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. + * + * @param itemStack electric item's stack + * @param amount amount of energy to discharge in EU + * @param player player holding the item + * @return true if the operation succeeded + * + * @deprecated use manager.use() instead + */ + @Deprecated + public static boolean use(ItemStack itemStack, int amount, EntityPlayer player) { + return manager.use(itemStack, amount, player); + } + + /** + * Charge an item from the BatPack a player is wearing. + * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. + * use() already contains this functionality. + * + * @param itemStack electric item's stack + * @param player player holding the item + * + * @deprecated use manager.chargeFromArmor() instead + */ + @Deprecated + public static void chargeFromArmor(ItemStack itemStack, EntityPlayer player) { + manager.chargeFromArmor(itemStack, player); + } +} + diff --git a/src/api/java/ic2/api/item/IBoxable.java b/src/api/java/ic2/api/item/IBoxable.java new file mode 100644 index 0000000..bca2cc0 --- /dev/null +++ b/src/api/java/ic2/api/item/IBoxable.java @@ -0,0 +1,14 @@ +package ic2.api.item; + +import net.minecraft.item.ItemStack; + + +public interface IBoxable { + /** + * Determine whether an item can be stored in a toolbox or not. + * + * @param itemstack item to be stored + * @return Whether to store the item in the toolbox or not + */ + public abstract boolean canBeStoredInToolbox(ItemStack itemstack); +} diff --git a/src/api/java/ic2/api/item/ICustomElectricItem.java b/src/api/java/ic2/api/item/ICustomElectricItem.java new file mode 100644 index 0000000..9f4b1a6 --- /dev/null +++ b/src/api/java/ic2/api/item/ICustomElectricItem.java @@ -0,0 +1,67 @@ +package ic2.api.item; + +import net.minecraft.item.ItemStack; + +/** + * Provides the ability to store energy on the implementing item. + * + * This interface is a special version of IElectricItem which delegates the implementation of + * charge(), discharge() and canUse() to the implementing Item. + * + * The default implementation (when not using ICustomElectricItem) does the following: + * - store and retrieve the charge + * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account + * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId()) + * - update and manage the damage value for the visual charge indicator + * + * @note ICustomElectricItem must not call the ElectricItem methods charge, discharge or canUse + * + * @deprecated Use ISpecialElectricItem instead. + */ +@Deprecated +public interface ICustomElectricItem extends IElectricItem { + /** + * Charge an item with a specified amount of energy + * + * @param itemStack electric item's stack + * @param amount amount of energy to charge in EU + * @param tier tier of the charging device, has to be at least as high as the item to charge + * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() + * @param simulate don't actually change the item, just determine the return value + * @return Energy transferred into the electric item + */ + public int charge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate); + + /** + * Discharge an item by a specified amount of energy + * + * @param itemStack electric item's stack + * @param amount amount of energy to charge in EU + * @param tier tier of the discharging device, has to be at least as high as the item to discharge + * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() + * @param simulate don't actually discharge the item, just determine the return value + * @return Energy retrieved from the electric item + */ + public int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate); + + /** + * Determine if the specified electric item has at least a specific amount of EU. + * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. + * BatPacks are not taken into account. + * + * @param itemStack electric item's stack + * @param amount minimum amount of energy required + * @return true if there's enough energy + */ + public boolean canUse(ItemStack itemStack, int amount); + + /** + * Determine whether to show the charge tool tip with NEI or other means. + * + * Return false if IC2's handler is incompatible, you want to implement your own or you don't + * want to display the charge at all. + * + * @return true to show the tool tip (x/y EU) + */ + public boolean canShowChargeToolTip(ItemStack itemStack); +} diff --git a/src/api/java/ic2/api/item/IDebuggable.java b/src/api/java/ic2/api/item/IDebuggable.java new file mode 100644 index 0000000..b1fa66b --- /dev/null +++ b/src/api/java/ic2/api/item/IDebuggable.java @@ -0,0 +1,23 @@ +package ic2.api.item; + + + +/** + * Allows a tile entity to output a debug message when the debugItem is used on it. + * Suggestions by Myrathi + */ +public abstract interface IDebuggable { + /** + * Checks if the tile entity is in a state that can be debugged. + * + * @return True if the tile entity can be debugged + */ + public abstract boolean isDebuggable(); + + /** + * Gets the debug text for the tile entity. + * + * @return The text that the debugItem should show + */ + public abstract String getDebugText(); +} diff --git a/src/api/java/ic2/api/item/IElectricItem.java b/src/api/java/ic2/api/item/IElectricItem.java new file mode 100644 index 0000000..adaf3b7 --- /dev/null +++ b/src/api/java/ic2/api/item/IElectricItem.java @@ -0,0 +1,54 @@ +package ic2.api.item; + +import net.minecraft.item.ItemStack; + +/** + * Provides the ability to store energy on the implementing item. + * + * The item should have a maximum damage of 13. + */ +public interface IElectricItem { + /** + * Determine if the item can be used in a machine or as an armor part to supply energy. + * + * @return Whether the item can supply energy + */ + boolean canProvideEnergy(ItemStack itemStack); + + /** + * Get the item ID to use for a charge energy greater than 0. + * + * @return Item ID to use + */ + int getChargedItemId(ItemStack itemStack); + + /** + * Get the item ID to use for a charge energy of 0. + * + * @return Item ID to use + */ + int getEmptyItemId(ItemStack itemStack); + + /** + * Get the item's maximum charge energy in EU. + * + * @return Maximum charge energy + */ + int getMaxCharge(ItemStack itemStack); + + /** + * Get the item's tier, lower tiers can't send energy to higher ones. + * Batteries are Tier 1, Energy Crystals are Tier 2, Lapotron Crystals are Tier 3. + * + * @return Item's tier + */ + int getTier(ItemStack itemStack); + + /** + * Get the item's transfer limit in EU per transfer operation. + * + * @return Transfer limit + */ + int getTransferLimit(ItemStack itemStack); +} + diff --git a/src/api/java/ic2/api/item/IElectricItemManager.java b/src/api/java/ic2/api/item/IElectricItemManager.java new file mode 100644 index 0000000..88eab75 --- /dev/null +++ b/src/api/java/ic2/api/item/IElectricItemManager.java @@ -0,0 +1,92 @@ +package ic2.api.item; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +/** + * This interface specifies a manager to handle the various tasks for electric items. + * + * The default implementation does the following: + * - store and retrieve the charge + * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account + * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId()) + * - update and manage the damage value for the visual charge indicator + * + * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the + * default implementations through ElectricItem.rawManager. The default implementation is designed + * to minimize its dependency on its own constraints/structure and delegates most work back to the + * more atomic features in the gateway manager. + */ +public interface IElectricItemManager { + /** + * Charge an item with a specified amount of energy + * + * @param itemStack electric item's stack + * @param amount amount of energy to charge in EU + * @param tier tier of the charging device, has to be at least as high as the item to charge + * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() + * @param simulate don't actually change the item, just determine the return value + * @return Energy transferred into the electric item + */ + int charge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate); + + /** + * Discharge an item by a specified amount of energy + * + * @param itemStack electric item's stack + * @param amount amount of energy to charge in EU + * @param tier tier of the discharging device, has to be at least as high as the item to discharge + * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() + * @param simulate don't actually discharge the item, just determine the return value + * @return Energy retrieved from the electric item + */ + int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate); + + /** + * Determine the charge level for the specified item + * + * @param itemStack ItemStack containing the electric item + * @return charge level in EU + */ + int getCharge(ItemStack itemStack); + + /** + * Determine if the specified electric item has at least a specific amount of EU. + * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. + * BatPacks are not taken into account. + * + * @param itemStack electric item's stack + * @param amount minimum amount of energy required + * @return true if there's enough energy + */ + boolean canUse(ItemStack itemStack, int amount); + + /** + * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. + * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. + * + * @param itemStack electric item's stack + * @param amount amount of energy to discharge in EU + * @param entity entity holding the item + * @return true if the operation succeeded + */ + boolean use(ItemStack itemStack, int amount, EntityLivingBase entity); + + /** + * Charge an item from the BatPack a player is wearing. + * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. + * use() already contains this functionality. + * + * @param itemStack electric item's stack + * @param entity entity holding the item + */ + void chargeFromArmor(ItemStack itemStack, EntityLivingBase entity); + + /** + * Get the tool tip to display for electric items. + * + * @param itemStack ItemStack to determine the tooltip for + * @return tool tip string or null for none + */ + String getToolTip(ItemStack itemStack); +} diff --git a/src/api/java/ic2/api/item/IItemHudInfo.java b/src/api/java/ic2/api/item/IItemHudInfo.java new file mode 100644 index 0000000..fe6ec0f --- /dev/null +++ b/src/api/java/ic2/api/item/IItemHudInfo.java @@ -0,0 +1,26 @@ +package ic2.api.item; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IItemHudInfo { + + /* + Add Info to Nano- and Quantum-Suit Helm Hud + for itemStack + + @Override + public List getHudInfo(ItemStack itemStack) { + List info = new LinkedList(); + info.add("i am a Cool Item"); + info.add("and have Cool info"); + return info; + } + + + */ + + public List getHudInfo(ItemStack itemStack); + +} diff --git a/src/api/java/ic2/api/item/IMetalArmor.java b/src/api/java/ic2/api/item/IMetalArmor.java new file mode 100644 index 0000000..16ffd24 --- /dev/null +++ b/src/api/java/ic2/api/item/IMetalArmor.java @@ -0,0 +1,20 @@ +package ic2.api.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +/** + * Armor items implementing this can be considered metal armor. + * + * Currently used for determining which boots can be used to slide up a magnetic pole. + */ +public interface IMetalArmor { + /** + * Determine if the given armor piece is metal armor. + * + * @param itemstack Armor piece as worn by the player + * @param player The player + * @return Whether the armor piece is metal armor + */ + public boolean isMetalArmor(ItemStack itemstack, EntityPlayer player); +} diff --git a/src/api/java/ic2/api/item/ISpecialElectricItem.java b/src/api/java/ic2/api/item/ISpecialElectricItem.java new file mode 100644 index 0000000..a7302f5 --- /dev/null +++ b/src/api/java/ic2/api/item/ISpecialElectricItem.java @@ -0,0 +1,13 @@ +package ic2.api.item; + +import net.minecraft.item.ItemStack; + +public interface ISpecialElectricItem extends IElectricItem { + /** + * Supply a custom IElectricItemManager. + * + * @param itemStack ItemStack to get the manager for + * @return IElectricItemManager instance + */ + IElectricItemManager getManager(ItemStack itemStack); +} diff --git a/src/api/java/ic2/api/item/ITerraformingBP.java b/src/api/java/ic2/api/item/ITerraformingBP.java new file mode 100644 index 0000000..58f7e2f --- /dev/null +++ b/src/api/java/ic2/api/item/ITerraformingBP.java @@ -0,0 +1,35 @@ +package ic2.api.item; + +import net.minecraft.world.World; + +/** + * Allows an item to act as a terraformer blueprint. + */ +public interface ITerraformingBP +{ + /** + * Get the energy consumption per operation of the blueprint. + * + * @return Energy consumption in EU + */ + public abstract int getConsume(); + + /** + * Get the maximum range of the blueprint. + * Should be a divisor of 5. + * + * @return Maximum range in blocks + */ + public abstract int getRange(); + + /** + * Perform the terraforming operation. + * + * @param world world to terraform + * @param x X position to terraform + * @param z Z position to terraform + * @param yCoord Y position of the terraformer + * @return Whether the operation was successful and the terraformer should consume energy. + */ + public abstract boolean terraform(World world, int x, int z, int yCoord); +} diff --git a/src/api/java/ic2/api/item/ItemWrapper.java b/src/api/java/ic2/api/item/ItemWrapper.java new file mode 100644 index 0000000..58f8073 --- /dev/null +++ b/src/api/java/ic2/api/item/ItemWrapper.java @@ -0,0 +1,50 @@ +package ic2.api.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Multimap; + +/** + * Wrapper for inserting interfaces into items you don't own. + * + * @author Richard + */ +public class ItemWrapper { + private static final Multimap boxableItems = ArrayListMultimap.create(); + private static final Multimap metalArmorItems = ArrayListMultimap.create(); + + public static void registerBoxable(Item item, IBoxable boxable) { + boxableItems.put(item, boxable); + } + + public static boolean canBeStoredInToolbox(ItemStack stack) { + Item item = stack.getItem(); + // use customs first to allow for overriding behavior + for (IBoxable boxable : boxableItems.get(item)) { + if (boxable.canBeStoredInToolbox(stack)) return true; + } + + if (item instanceof IBoxable && ((IBoxable) item).canBeStoredInToolbox(stack)) return true; + + return false; + } + + public static void registerMetalArmor(Item item, IMetalArmor armor) { + metalArmorItems.put(item, armor); + } + + public static boolean isMetalArmor(ItemStack stack, EntityPlayer player) { + Item item = stack.getItem(); + // use customs first to allow for overriding behavior + for (IMetalArmor metalArmor : metalArmorItems.get(item)) { + if (metalArmor.isMetalArmor(stack, player)) return true; + } + + if (item instanceof IMetalArmor && ((IMetalArmor) item).isMetalArmor(stack, player)) return true; + + return false; + } +} diff --git a/src/api/java/ic2/api/item/Items.java b/src/api/java/ic2/api/item/Items.java new file mode 100644 index 0000000..18fbd66 --- /dev/null +++ b/src/api/java/ic2/api/item/Items.java @@ -0,0 +1,599 @@ +package ic2.api.item; + +import net.minecraft.item.ItemStack; + +/** + * Provides access to IC2 blocks and items. + * + * Some items can be acquired through the ore dictionary which is the recommended way. + * The items are initialized while IC2 is being loaded - try to use ModsLoaded() or load your mod after IC2. + * Some blocks/items can be disabled by a config setting, so it's recommended to check if they're null first. + * + * Getting the associated Block/Item for an ItemStack x: + * Blocks: Block.blocksList[x.itemID] + * Items: x.getItem() + */ +public final class Items { + /** + * Get an ItemStack for a specific item name, example: Items.getItem("resin") + * See the list below for item names. + * Make sure to copy() the ItemStack if you want to modify it. + * + * @param name item name + * @return The item or null if the item does not exist or an error occurred + */ + public static ItemStack getItem(String name) { + try { + if (Ic2Items == null) Ic2Items = Class.forName(getPackage() + ".core.Ic2Items"); + + Object ret = Ic2Items.getField(name).get(null); + + if (ret instanceof ItemStack) { + return (ItemStack) ret; + } + return null; + } catch (Exception e) { + System.out.println("IC2 API: Call getItem failed for "+name); + + return null; + } + } + + /* Possible values: + + // ores + copperOre; // Copper Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreCopper, null with enableWorldGenOreCopper=false + tinOre; // Tin Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreTin, null with enableWorldGenOreTin=false + uraniumOre; // Tin Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreUranium, null with enableWorldGenOreUranium=false + leadOre; // Lead Ore Block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreLead, null with enableWorldGenOreLead=false + + // rubber related + + Rubber wood block, meta reflects the state, meta in ItemStack set to 0, ore dictionary: woodRubber (with meta 0), null with enableWorldGenTreeRubber=false + dropped (as an item) -> metadata 0 + block, no resin spot -> metadata 0 or 1 + block, wet resin spot -> metadata 2-5 (according to the side) + block, dry resin spot -> metadata 8-11 (wet state + 6) + + rubberWood; + rubberLeaves; // Rubber Leaves block, currently not meta sensitive, meta in ItemStack set to 0, null with enableWorldGenTreeRubber=false + rubberSapling; // Rubber Sapling block, currently not meta sensitive, meta in ItemStack set to 0, null with enableWorldGenTreeRubber=false + resinSheet; // Resin Sheet block, currently not meta sensitive + rubberTrampoline; // Rubber Trampoline block, meta reflects internal state, meta in ItemStack set to 0 + + // building/storage + ironFence; // Iron Fence block, currently not meta sensitive + + reinforcedStone; // Reinforced Stone block, currently not meta sensitive + reinforcedGlass; // Reinforced Glass block, currently not meta sensitive + reinforcedDoorBlock; // Reinforced Door block, meta reflects the state (see vanilla doors), meta in ItemStack set to 0 + + constructionreinforcedFoam; // Construction Reinforced Foam block, currently not meta sensitive + constructionFoam; // Construction Foam block, currently not meta sensitive + constructionFoamWall; // Construction Foam Wall block, meta = color, implements IPaintableBlock + scaffold; // Scaffold block, meta reflects internal physical model data + ironScaffold; // Scaffold block, meta reflects internal physical model data + + bronzeBlock; // Bronze block, meta sensitive + copperBlock; // Copper block, meta sensitive + tinBlock; // Tin block, meta sensitive + uraniumBlock; // Uranium block, meta sensitive + leadBlock; // Uranium block, meta sensitive + + // cables (when placed as a block, inventory items are different; TE implements IEnergyConductor) + + copperCableBlock; // Copper Cable block, meta sensitive + insulatedCopperCableBlock; // Insulated Copper Cable block, meta sensitive + + goldCableBlock; // Gold Cable block, meta sensitive + insulatedGoldCableBlock; // Insulated Gold Cable block, meta sensitive + doubleInsulatedGoldCableBlock; // Double Insulated Gold Cable block, meta sensitive + + ironCableBlock; // Iron Cable block, meta sensitive + insulatedIronCableBlock; // Insulated Iron Cable block, meta sensitive + doubleInsulatedIronCableBlock; // Double Insulated Iron Cable block, meta sensitive + trippleInsulatedIronCableBlock; // Tripple Insulated Iron Cable block, meta sensitive + + glassFiberCableBlock; // Glass Fiber Cable block, meta sensitive + + tinCableBlock; // Tin Cable block, meta sensitive + insulatedtinCableBlock; // Insulated Tin Cable item, meta sensitive + detectorCableBlock; // Detector Cable block, meta sensitive + splitterCableBlock; // Splitter Cable block, meta sensitive + + // generators + related (TE implements IEnergySource ex. reactorChamber) + + generator; // Generator block, meta sensitive + geothermalGenerator; // Geothermal Generator block, meta sensitive + waterMill; // Water Mill block, meta sensitive + solarPanel; // Solar Panel block, meta sensitive + windMill; // Wind Mill block, meta sensitive + nuclearReactor; // Nuclear Reactor block, meta sensitive + reactorChamber; // Reactor Chamber block, currently not meta sensitive + RTGenerator; // Radioisotope Thermoelectric Generator block, meta sensitive + semifluidGenerator; // Semifluid Generator block, meta sensitive + + + // energy storages (TE implements IEnergySource and IEnergyConductor) + + batBox; // BatBox block, meta sensitive + cesuUnit; // CESU Unit block, meta sensitive + mfeUnit; // MFE Unit block, meta sensitive + mfsUnit; // MFS Unit block, meta sensitive + + // transformers (TE implements IEnergySource and IEnergyConductor) + + lvTransformer; // LV Transformer block, meta sensitive + mvTransformer; // MV Transformer block, meta sensitive + hvTransformer; // HV Transformer block, meta sensitive + evTransformer; // EV Transformer block, meta sensitive + + // machines + related (TE implements IEnergySink ex. machine, miningPipe, miningPipeTip) + + machine; // Machine block, meta sensitive + advancedMachine; // Advanced Machine block, meta sensitive + + ironFurnace; // Iron Furnace block, meta sensitive + electroFurnace; // Electro Furnace block, meta sensitive + macerator; // Macerator block, meta sensitive + extractor; // Extractor block, meta sensitive + compressor; // Compressor block, meta sensitive + canner; // Canner block, meta sensitive + miner; // Miner block, meta sensitive + pump; // Pump block, meta sensitive + magnetizer; // Magnetizer block, meta sensitive + electrolyzer; // Electrolyzer block, meta sensitive + recycler; // Recycler block, meta sensitive + inductionFurnace; // Induction Furnace block, meta sensitive + massFabricator; // Mass Fabricator block, meta sensitive + terraformer; // Terraformer block, meta sensitive + teleporter; // Teleporter block, meta sensitive + teslaCoil; // Tesla Coil block, meta sensitive + luminator; // Passive (dark) Luminator block, meta = facing + activeLuminator; // Active (bright) Luminator block, meta = facing + centrifuge; // Centrifuge block, meta sensitive + metalformer; // MetalFormer block ,meta sensitive + orewashingplant; // Ore Wasching Plant,Meta sensitive + patternstorage; // Pattern Storage,Meta sensitive + scanner; // Scanner,Meta sensitive + replicator; // Replicator,Meta sensitive + + miningPipe; // Mining Pipe block, currently not meta sensitive, meta in ItemStack set to 0 + miningPipeTip; // Mining Pipe Tip block, currently not meta sensitive, meta in ItemStack set to 0 + + + // personal blocks + + personalSafe; // Personal Safe block, meta sensitive + tradeOMat; // Trade-O-Mat block, meta sensitive + energyOMat; // Energy-O-Mat block, meta sensitive + + // explosives + + industrialTnt; // Industrial TNT block, currently not meta sensitive + nuke; // Nuke block, currently not meta sensitive + dynamiteStick; // Dynamite Stick block, meta = placement, meta in ItemStack set to 0 + dynamiteStickWithRemote; // Dynamite Stick with Remote block, meta = placement, meta in ItemStack set to 0 + + // Agriculture Stuff + + crop; // Crop Block, empty, not meta sensitive + cropmatron; // Cropmatron machien block, meta sensititve + + // ----- items ----- + + // rubber + related + resin; // Resin item, currently not meta sensitive + rubber; // Rubber item, currently not meta sensitive, ore dictionary: itemRubber + + FluidCell; + + // Lithium -> Tritium + + reactorLithiumCell; // LithiumCell use in Reaktor, , meta = damage value + TritiumCell; // Tritium, currently not meta sensitive + + // Nuclear Fuel + + UranFuel; // , currently not meta sensitive + MOXFuel; // , currently not meta sensitive + Plutonium; // , currently not meta sensitive + smallPlutonium; // , currently not meta sensitive + Uran235; // , currently not meta sensitive + smallUran235; // , currently not meta sensitive + Uran238; // , currently not meta sensitive + + reactorDepletedUraniumSimple; // Depleted Uranium Cell items, currently not meta sensitive + reactorDepletedUraniumDual; + reactorDepletedUraniumQuad; + reactorDepletedMOXSimple; // Depleted MOX Cell items, currently not meta sensitive + reactorDepletedMOXDual; + reactorDepletedMOXQuad; + reactorMOXSimple; // Depleted MOX Cell items, currently not meta sensitive + reactorMOXDual; + reactorMOXQuad; + RTGPellets; + + + // Recipe Parts + + coil; // Coil, meta sensitive + elemotor; // electric motor, meta sensitive + powerunit; // Item Power Unit, meta sensitive + powerunitsmall; // Item Power Unit, meta sensitive + + + // ItemCasing + + casingcopper; // Copper ItemCasing, meta sensitive + casingtin; // Tin ItemCasing, meta sensitive + casingbronze; // Bronze ItemCasing, meta sensitive + casinggold; // Gold ItemCasing, meta sensitive + casingiron; // Iron ItemCasing, meta sensitive + @Deprecated + casingadviron; // Refined Iron ItemCasing, meta sensitive + casinglead; // Lead ItemCasing, meta sensitive + + // Crushed Ore + crushedIronOre; // Crushed Iron Ore, meta sensitive + crushedCopperOre; // Crushed Copper Ore, meta sensitive + crushedGoldOre; // Crushed Gold Ore, meta sensitive + crushedTinOre; // Crushed Tin Ore, meta sensitive + crushedUraniumOre; // Crushed Uranium Ore, meta sensitive + crushedSilverOre; // Crushed Silver Ore, meta sensitive + crushedLeadOre; // Crushed Lead Ore, meta sensitive + + + //Purify Crushed Ore + purifiedCrushedIronOre; // Purify Crushed Iron Ore, meta sensitive + purifiedCrushedCopperOre; // Purify Crushed Copper Ore, meta sensitive + purifiedCrushedGoldOre; // Purify Crushed Gold Ore, meta sensitive + purifiedCrushedTinOre; // Purify Crushed Tin Ore, meta sensitive + purifiedCrushedUraniumOre; // Purify Crushed Uranium Ore, meta sensitive + purifiedCrushedSilverOre; // Purify Crushed Silver Ore, meta sensitive + purifiedCrushedLeadOre; // Purify Crushed Lead Ore, meta sensitive + + // dusts + stoneDust; + bronzeDust; // Bronze Dust item, meta sensitive, ore dictionary: dustBronze + clayDust; // Clay Dust item, meta sensitive, ore dictionary: dustClay + coalDust; // Coal Dust item, meta sensitive, ore dictionary: dustCoal + copperDust; // Copper Dust item, meta sensitive, ore dictionary: dustCopper + goldDust; // Gold Dust item, meta sensitive, ore dictionary: dustGold + ironDust; // Iron Dust item, meta sensitive, ore dictionary: dustIron + silverDust; // Silver Dust item, meta sensitive, ore dictionary: dustSilver + tinDust; // Tin Dust item, meta sensitive, ore dictionary: dustTin + hydratedCoalDust; // Hydrated Coal Dust item, meta sensitive + leadDust; // Lead Dust item, meta sensitive, ore dictionary: dustLead + obsidianDust; // Obsidian Dust item, meta sensitive, ore dictionary: dustObsidian + lapiDust; // Lapi Dust item, meta sensitive, ore dictionary: dustLapi + sulfurDust; // Sulfur Dust item, meta sensitive, ore dictionary: dustSulfur + lithiumDust; // Lithium dust, meta sensitive, ore dictionary: dustLithium + + // small dusts + + smallIronDust; // Small Iron Dust item, meta sensitive + smallCopperDust; // Small Copper Dust item, meta sensitive + smallGoldDust; // Small Gold Dust item, meta sensitive + smallTinDust; // Small Tin Dust item, meta sensitive + smallSilverDust; // Small Silver Dust item, meta sensitive + smallLeadDust; // Small Lead Dust item, meta sensitive + smallSulfurDust; // Small Sulfur Dust item, meta sensitive + smallLithiumDust; // Small Lithium Dust item, meta sensitive + + + // ingots + @Deprecated + refinedIronIngot; // Refined Iron Ingot item, currently not meta sensitive, ore dictionary: ingotRefinedIron + copperIngot; // Copper Ingot item, currently not meta sensitive, ore dictionary: ingotCopper + tinIngot; // Tin Ingot item, currently not meta sensitive, ore dictionary: ingotTin + bronzeIngot; // Bronze Ingot item, currently not meta sensitive, ore dictionary: ingotBronze + mixedMetalIngot; // Mixed Metal Ingot item, currently not meta sensitive + leadIngot; // Lead Ingot item, currently not meta sensitive + + + // tools/weapons (without electric tools) + treetap; // Treetap item, meta = damage value + wrench; // Wrench item, meta = damage value + cutter; // Insulation Cutter item, meta = damage value + constructionFoamSprayer; // Construction Foam Sprayer item, meta = charges (as of v1.45) + + bronzePickaxe; // Bronze Pickaxe item, meta = damage value + bronzeAxe; // Bronze Axe item, meta = damage value + bronzeSword; // Bronze Sword item, meta = damage value + bronzeShovel; // Bronze Shovel item, meta = damage value + bronzeHoe; // Bronze Hoe item, meta = damage value + + ForgeHammer; // Refine Iron Hammer item, meta = damage value + + // el. tools/devices/weapons + miningDrill; // Mining Drill item, meta = damage value for charge level + diamondDrill; // Diamond Tipped Mining Drill item, meta = damage value for charge level + iridiumDrill; // Iridium Tipped Mining Drill item, meta = damage value for charge level + chainsaw; // Chainsaw item, meta = damage value for charge level + electricWrench; // Electric Wrench item, meta = damage value for charge level + electricTreetap; // Electric Treetap item, meta = damage value for charge level + miningLaser; // Mining Laser item, meta = damage value for charge level + + ecMeter; // EC-Mater item, meta = itemdata db index (as of v1.45) + odScanner; // Ore Density Scanner item, meta = damage value for charge level + ovScanner; // Ore Value Scanner item, meta = damage value for charge level + obscurator; // Obscurator item, meta = damage value for charge level + + frequencyTransmitter; // Frequency Transmitter item, meta = itemdata db index (as of v1.45) + + nanoSaber; // Idle Nano Saber item, meta = damage value for charge level + enabledNanoSaber; // Enabled Nano Saber item, meta = damage value for charge level + + toolbox; // Open/Empty toolbox, meta = Open (0) / Closed (1) + + // armor/wearable + hazmatHelmet; // Hazmat Helmet item, meta = damage value + hazmatChestplate; // Hazmat Chestplate item, meta = damage value + hazmatLeggings; // Hazmat Leggings item, meta = damage value + hazmatBoots; // Hazmat Boots item, meta = damage value + + bronzeHelmet; // Bronze Helmet Armor item, meta = damage value + bronzeChestplate; // Bronze Chestplate Armor item, meta = damage value + bronzeLeggings; // Bronze Leggings Armor item, meta = damage value + bronzeBoots; // Bronze Boots Armor item, meta = damage value + + compositeArmor; // Composite Armor item, meta = damage value for charge level + + nanoHelmet; // Nano Helmet Armor item, meta = damage value for charge level + nanoBodyarmor; // Nano Bodyarmor item, meta = damage value for charge level + nanoLeggings; // Nano Leggings Armor item, meta = damage value for charge level + nanoBoots; // Nano Boots Armor item, meta = damage value for charge level + + quantumHelmet; // Quantum Helmet Armor item, meta = damage value for charge level + quantumBodyarmor; // Quantum Bodyarmor item, meta = damage value for charge level + quantumLeggings; // Quantum Leggings Armor item, meta = damage value for charge level + quantumBoots; // Quantum Boots Armor item, meta = damage value for charge level + + jetpack; // Jetpack item, meta = damage value for fuel level + electricJetpack; // Electric Jetpack item, meta = damage value for charge level + + batPack; // BatPack item, meta = damage value for charge level + advbatPack; // Adv.BatPack item, meta = damage value for charge level + lapPack; // LapPack item, meta = damage value for charge level + energyPack; // EnergyPack item, meta = damage value for charge level + + cfPack; // CF Pack item, meta = charges (as of v1.45) + solarHelmet; // Solar Helmet, currently not meta sensitive + staticBoots; // Static Boots, currently not meta sensitive + nightvisionGoggles; // Nightvision Goggles, meta = damage value for charge level + + // batteries + reBattery; // Empty RE Battery item, currently not meta sensitive + chargedReBattery; // RE Battery item, meta = damage value for charge level + advBattery; // Adv Batteryitem, meta = damage value for charge level + energyCrystal; // Energy Crystal item, meta = damage value for charge level + lapotronCrystal; // Lapotron Crystal item, meta = damage value for charge level + suBattery; // SU Battery item, meta = damage value for charge level + + // cables + copperCableItem; // Copper Cable item, meta sensitive + insulatedCopperCableItem; // Insulated Copper Cable item, meta sensitive + + goldCableItem; // Gold Cable item, meta sensitive + insulatedGoldCableItem; // Insulated Gold Cable item, meta sensitive + + @Deprecated + doubleInsulatedGoldCableItem; // Double Insulated Gold Cable item, meta sensitive + + ironCableItem; // Iron Cable item, meta sensitive + insulatedIronCableItem; // Insulated Iron Cable item, meta sensitive + + @Deprecated + doubleInsulatedIronCableItem; // Double Insulated Iron Cable item, meta sensitive + @Deprecated + trippleInsulatedIronCableItem; // Tripple Insulated Iron Cable item, meta sensitive + insulatedTinCableItem; + glassFiberCableItem; // Glass Fiber Cable item, meta sensitive + tinCableItem; // Tin Cable item, meta sensitive + + + detectorCableItem; // Detector Cable item, meta sensitive + splitterCableItem; // Splitter Cable item, meta sensitive + + // cells/containers (without reactor components) + + cell; // Empty Cell item, meta sensitive + lavaCell; // Lava Cell item, meta sensitive + waterCell; // Water Cell item, meta sensitive + UuMatterCell; // UUMatter Cell item, meta sensitive + CFCell; // constructionFoam Cell item, meta sensitive + + + fuelRod; // Empy Fuel Rod item, currently not meta sensitive + hydratedCoalCell; // Hydrated Coal Cell item, currently not meta sensitive + bioCell; // Bio Cell item, currently not meta sensitive + coalfuelCell; // Coalfuel Cell item, currently not meta sensitive + biofuelCell; // Biofuel Cell item, currently not meta sensitive + electrolyzedWaterCell; // Electrolyzed Water Cell item, currently not meta sensitive + airCell; // Compressed Air item, currently not meta sensitive + + fuelCan; // Empty Fuel Can item, currently not meta sensitive + filledFuelCan; // Fuel Can item, meta = fuel value (as of v1.45) + + tinCan; // Empty Tin Can item, currently not meta sensitive + filledTinCan; // Filled Tin Can item, currently not meta sensitive + + // reactor components + reactorUraniumSimple; // Uranium Cell items, meta = consumed uranium ticks + reactorUraniumDual; + reactorUraniumQuad; + + reactorCoolantSimple; + reactorCoolantTriple ; // Coolant Cell item, NBT for heat-storage, meta is 0-10000 for display + reactorCoolantSix; + + reactorPlating; // Integrated Reactor Plating item, currently not meta sensitive + reactorPlatingHeat; + reactorPlatingExplosive; + + reactorHeatSwitch; // Integrated Heat Disperser item, NBT for heat-storage, meta is 0-10000 for display + reactorHeatSwitchCore; + reactorHeatSwitchSpread; + reactorHeatSwitchDiamond; + + reactorVent; // Heat Venting component, NBT for heat-storage, meta is 0-10000 for display + reactorVentCore; + reactorVentGold; + reactorVentSpread;// Special: Does not store heat + reactorVentDiamond; + + reactorReflector; // Increase efficiency without additional ticks, NBT for heat-storage, meta is 0-10000 for display + reactorReflectorThick; // Increase efficiency without additional ticks, NBT for heat-storage, meta is 0-10000 for display + reactorCondensator; // Consumes redstone to absorb heat, NBT for storage, meta is 0-10000 for display + reactorCondensatorLap; // Consumes redstone/lapis to absorb heat, mNBT for storage, meta is 0-10000 for display + + // terraformer blueprints + terraformerBlueprint; // Empty Terraformer Blueprint item, currently not meta sensitive + cultivationTerraformerBlueprint; // Cultivation Terraformer Blueprint item, currently not meta sensitive + irrigationTerraformerBlueprint; // Irrigation Terraformer Blueprint item, currently not meta sensitive + chillingTerraformerBlueprint; // Chilling Terraformer Blueprint item, currently not meta sensitive + desertificationTerraformerBlueprint; // Desertification Terraformer Blueprint item, currently not meta sensitive + flatificatorTerraformerBlueprint; // Flatificator Terraformer Blueprint item, currently not meta sensitive + mushroomTerraformerBlueprint; // Mushroom Terraformer Blueprint item, currently not meta sensitive + + // diamond chain + coalBall; // Coal Ball item, currently not meta sensitive + compressedCoalBall; // Compressed Coal Ball item, currently not meta sensitive + coalChunk; // Coal Chunk item, currently not meta sensitive + industrialDiamond; // Industrial Diamond item, currently not meta sensitive, DEPRECATED + + // recycler chain + scrap; // Scrap item, currently not meta sensitive + scrapBox; // Scrap Box item, currently not meta sensitive + + // fuel production chain + hydratedCoalClump; // Hydrated Coal Clump item, currently not meta sensitive + plantBall; // Plant Ball item, currently not meta sensitive + compressedPlantBall; // Compressed Plant Ball item, currently not meta sensitive + + // painting + painter; // Painter item, currently not meta sensitive + + blackPainter; // Black Painter item, meta = damage value + redPainter; // Red Painter item, meta = damage value + greenPainter; // Green Painter item, meta = damage value + brownPainter; // Brown Painter item, meta = damage value + bluePainter; // Blue Painter item, meta = damage value + purplePainter; // Purple Painter item, meta = damage value + cyanPainter; // Cyan Painter item, meta = damage value + lightGreyPainter; // Light Grey Painter item, meta = damage value + darkGreyPainter; // Dark Grey Painter item, meta = damage value + pinkPainter; // Pink Painter item, meta = damage value + limePainter; // Lime Painter item, meta = damage value + yellowPainter; // Yellow Painter item, meta = damage value + cloudPainter; // Cloud Painter item, meta = damage value + magentaPainter; // Magenta Painter item, meta = damage value + orangePainter; // Orange Painter item, meta = damage value + whitePainter; // White Painter item, meta = damage value + + // explosives + related + dynamite; // Throwable Dynamite item, currently not meta sensitive + stickyDynamite; // Throwable Sticky Dynamite item, currently not meta sensitive + + remote; // Dynamite Remote item, currently not meta sensitive + + // misc intermediate recipe ingredients + electronicCircuit; // Electronic Circuit item, currently not meta sensitive + advancedCircuit; // Advanced Circuit item, currently not meta sensitive + + advancedAlloy; // Advanced Alloy item, currently not meta sensitive + + carbonFiber; // Raw Carbon Fiber item, currently not meta sensitive + carbonMesh; // Raw Carbon Mesh item, currently not meta sensitive + carbonPlate; // Carbon Plate item, currently not meta sensitive + + matter; // UUA item, currently not meta sensitive + iridiumOre; // Iridium Ore item, currently not meta sensitive + iridiumPlate; // Iridium Plate item, currently not meta sensitive + + + // Metal Plates + + platecopper; // Metal plate item, meta sensitive + platetin; // Metal plate item, meta sensitive + platebronze; // Metal plate item, meta sensitive + plategold; // Metal plate item, meta sensitive + plateiron; // Metal plate item, meta sensitive + platelead; // Metal plate item, meta sensitive + platelapi; // Metal plate item, meta sensitive + plateobsidian; // Metal plate item, meta sensitive + plateadviron; // Metal plate item, meta sensitive + + // Metal Dense Plates + denseplatecopper; // Metal dense plate item, meta sensitive + denseplatetin; // Metal dense plate item, meta sensitive + denseplatebronze; // Metal dense plate item, meta sensitive + denseplategold; // Metal dense plate item, meta sensitive + denseplateiron; // Metal dense plate item, meta sensitive + @Deprecated + denseplateadviron; // Metal dense plate item, meta sensitive + denseplatelead; // Metal dense plate item, meta sensitive + denseplatelapi; // Metal dense plate item, meta sensitive + denseplateobsidian; // Metal dense plate item, meta sensitive + + + + // upgrade modules + overclockerUpgrade; // overclocker upgrade item, meta sensitive + transformerUpgrade; // transformer upgrade item, meta sensitive + energyStorageUpgrade; // energy storage upgrade item, meta sensitive + ejectorUpgrade; // ejector upgrade item, meta sensitive + + // misc + coin; // Coin item, currently not meta sensitive + reinforcedDoor; // Reinforced Door item, currently not meta sensitive + constructionFoamPowder; // Construction Foam Powder item, currently not meta sensitive + grinPowder; // Poisonous ingrident, currently not meta sensitive + debug; // Debug item, currently not meta sensitive + boatCarbon; // Carbon Fiber Canoe item, meta sensitive + boatRubber; // Rubber Dinghy item, meta sensitive + boatRubberBroken; // Damaged Rubber Dinghy item, meta sensitive + boatElectric; // Electric Boat item, meta sensitive + + //Agriculture + cropSeed; // Crop seeds, stuff stored in NBT, don't use for crafting recipes! + cropnalyzer; // Cropnalyzer handheld device + fertilizer; // Basic IC2Item, used to provide nutrients toCropBlocks + hydratingCell; // Cell used to hydrate Crops, meta = Content, 0= Full, 9999 = Near empty + electricHoe; // Electric Hoe, Metadata indicates charge level + terraWart; // Mystic opposite of NEtherWart, cures StatusEffects, simply consumeable + weedEx; // Spraying can of WEED-EX, meta indicates usages left + + //Boozeception + mugEmpty; // Simple stone mug + coffeeBeans; // Harvested CoffeeBeans + coffeePowder; // Processed Coffee Beans, used to craft drinkable Coffee + mugCoffee; // Mug of Coffee, Meta indicates status 0 = cold, 1 = Normal, 2 = Sugar'd + hops; // Hops, harvested freshly from crop + barrel; // Carried Barrel, metadata encrypts the information about the liquid inside + blockBarrel; // Unobtainable "placed barrel", TileEntity controlling the Fermentation process + mugBooze; // Mug filled with booze, metadata encrypts the information about the liquid inside + + */ + + /** + * Get the base IC2 package name, used internally. + * + * @return IC2 package name, if unable to be determined defaults to ic2 + */ + private static String getPackage() { + Package pkg = Items.class.getPackage(); + + if (pkg != null) { + String packageName = pkg.getName(); + + return packageName.substring(0, packageName.length() - ".api.item".length()); + } + + return "ic2"; + } + + private static Class Ic2Items; +} + diff --git a/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.java b/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.java new file mode 100644 index 0000000..ed3ea38 --- /dev/null +++ b/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.java @@ -0,0 +1,17 @@ +package ic2.api.network; + +import net.minecraft.entity.player.EntityPlayer; + +/** + * Allows a tile entity to receive network events received from clients. + */ +public interface INetworkClientTileEntityEventListener { + /** + * Called when a network event is received. + * + * @param player client which sent the event + * @param event event ID + */ + void onNetworkEvent(EntityPlayer player, int event); +} + diff --git a/src/api/java/ic2/api/network/INetworkDataProvider.java b/src/api/java/ic2/api/network/INetworkDataProvider.java new file mode 100644 index 0000000..c3f283e --- /dev/null +++ b/src/api/java/ic2/api/network/INetworkDataProvider.java @@ -0,0 +1,18 @@ +package ic2.api.network; + +import java.util.List; + +/** + * Tile entities which want to synchronized specific fields between client and server have to implement this. + * + * The fields don't update themselves, a field update must be sent every time a synchronized field changes. + */ +public interface INetworkDataProvider { + /** + * Get the list of synchronized fields. + * + * @return Names of the synchronized fields + */ + List getNetworkedFields(); +} + diff --git a/src/api/java/ic2/api/network/INetworkItemEventListener.java b/src/api/java/ic2/api/network/INetworkItemEventListener.java new file mode 100644 index 0000000..02ce470 --- /dev/null +++ b/src/api/java/ic2/api/network/INetworkItemEventListener.java @@ -0,0 +1,18 @@ +package ic2.api.network; + +import net.minecraft.entity.player.EntityPlayer; + +/** + * Allows an item to receive network events received from the server. + */ +public interface INetworkItemEventListener { + /** + * Called when a network event is received. + * + * @param metaData item metadata + * @param player player containing the item + * @param event event ID + */ + void onNetworkEvent(int metaData, EntityPlayer player, int event); +} + diff --git a/src/api/java/ic2/api/network/INetworkTileEntityEventListener.java b/src/api/java/ic2/api/network/INetworkTileEntityEventListener.java new file mode 100644 index 0000000..fbb4753 --- /dev/null +++ b/src/api/java/ic2/api/network/INetworkTileEntityEventListener.java @@ -0,0 +1,14 @@ +package ic2.api.network; + +/** + * Allows a tile entity to receive network events received from the server. + */ +public interface INetworkTileEntityEventListener { + /** + * Called when a network event is received. + * + * @param event Event ID + */ + void onNetworkEvent(int event); +} + diff --git a/src/api/java/ic2/api/network/INetworkUpdateListener.java b/src/api/java/ic2/api/network/INetworkUpdateListener.java new file mode 100644 index 0000000..09414ae --- /dev/null +++ b/src/api/java/ic2/api/network/INetworkUpdateListener.java @@ -0,0 +1,14 @@ +package ic2.api.network; + +/** + * Allows a tile entity to receive field sync updates received from the server. + */ +public interface INetworkUpdateListener { + /** + * Called when a field is synchronized. + * + * @param field field synchronized + */ + void onNetworkUpdate(String field); +} + diff --git a/src/api/java/ic2/api/network/NetworkHelper.java b/src/api/java/ic2/api/network/NetworkHelper.java new file mode 100644 index 0000000..900a742 --- /dev/null +++ b/src/api/java/ic2/api/network/NetworkHelper.java @@ -0,0 +1,238 @@ +package ic2.api.network; + +import java.lang.reflect.Method; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +/** + * Provides methods to initiate events and synchronize tile entity fields in SMP. + * + * The methods are transparent between singleplayer and multiplayer - if a method is called in + * singleplayer, the associated callback will be locally executed. The implementation is different + * between the client and server versions of IC2. + * + * You'll usually want to use the server->client methods defined here to synchronize information + * which is needed by the clients outside the GUI, such as rendering the block, playing sounds or + * producing effects. Anything which is only visible inside the GUI should be synchronized through + * the Container class associated to the GUI in Container.updateProgressBar(). + */ +public final class NetworkHelper { + // server -> client + + + /** + * Schedule a TileEntity's field to be updated to the clients in range. + * + * The updater will query the field's value during the next update, updates happen usually + * every 2 ticks. If low latency is important use initiateTileEntityEvent instead. + * + * IC2's network updates have to get triggered every time, it doesn't continuously poll/send + * the field value. Just call updateTileEntityField after every change to a field which needs + * network synchronization. + * + * The following field data types are currently supported: + * - int, int[], short, short[], byte, byte[], long, long[] + * - float, float[], double, double[] + * - boolean, boolean[] + * - String, String[] + * - ItemStack + * - NBTBase (includes NBTTagCompound) + * - Block, Item, Achievement, Potion, Enchantment + * - ChunkCoordinates, ChunkCoordIntPair + * - TileEntity (does not sync the actual tile entity, instead looks up the tile entity by its position in the client world) + * - World (does not sync the actual world, instead looks up the world by its dimension ID) + * + * Once the update has been processed by the client, it'll call onNetworkUpdate on the client- + * side TileEntity if it implements INetworkUpdateListener. + * + * If this method is being executed on the client (i.e. Singleplayer), it'll just call + * INetworkUpdateListener.onNetworkUpdate (if implemented by the te). + * + * @param te TileEntity to update + * @param field Name of the field to update + */ + public static void updateTileEntityField(TileEntity te, String field) { + try { + if (NetworkManager_updateTileEntityField == null) NetworkManager_updateTileEntityField = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("updateTileEntityField", TileEntity.class, String.class); + if (instance == null) instance = getInstance(); + + NetworkManager_updateTileEntityField.invoke(instance, te, field); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Immediately send an event for the specified TileEntity to the clients in range. + * + * If this method is being executed on the client (i.e. Singleplayer), it'll just call + * INetworkTileEntityEventListener.onNetworkEvent (if implemented by the te). + * + * @param te TileEntity to notify, should implement INetworkTileEntityEventListener + * @param event Arbitrary integer to represent the event, choosing the values is up to you + * @param limitRange Limit the notification range to (currently) 20 blocks instead of the + * tracking distance if true + */ + public static void initiateTileEntityEvent(TileEntity te, int event, boolean limitRange) { + try { + if (NetworkManager_initiateTileEntityEvent == null) NetworkManager_initiateTileEntityEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateTileEntityEvent", TileEntity.class, Integer.TYPE, Boolean.TYPE); + if (instance == null) instance = getInstance(); + + NetworkManager_initiateTileEntityEvent.invoke(instance, te, event, limitRange); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Immediately send an event for the specified Item to the clients in range. + * + * The item should implement INetworkItemEventListener to receive the event. + * + * If this method is being executed on the client (i.e. Singleplayer), it'll just call + * INetworkItemEventListener.onNetworkEvent (if implemented by the item). + * + * @param player EntityPlayer holding the item + * @param itemStack ItemStack containing the item + * @param event Arbitrary integer to represent the event, choosing the values is up to you + * @param limitRange Limit the notification range to (currently) 20 blocks instead of the + * tracking distance if true + */ + public static void initiateItemEvent(EntityPlayer player, ItemStack itemStack, int event, boolean limitRange) { + try { + if (NetworkManager_initiateItemEvent == null) NetworkManager_initiateItemEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateItemEvent", EntityPlayer.class, ItemStack.class, Integer.TYPE, Boolean.TYPE); + if (instance == null) instance = getInstance(); + + NetworkManager_initiateItemEvent.invoke(instance, player, itemStack, event, limitRange); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Schedule a block update (re-render) on the clients in range. + * + * If this method is being executed on the client (i.e. Singleplayer), it'll just trigger the + * block update locally. + * + * @param world World containing the block + * @param x The block's x coordinate + * @param y The block's y coordinate + * @param z The block's z coordinate + */ + public static void announceBlockUpdate(World world, int x, int y, int z) { + try { + if (NetworkManager_announceBlockUpdate == null) NetworkManager_announceBlockUpdate = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("announceBlockUpdate", World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE); + if (instance == null) instance = getInstance(); + + NetworkManager_announceBlockUpdate.invoke(instance, world, x, y, z); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + + // client -> server + + + /** + * Ask the server to send the values of the fields specified. + * + * See updateTileEntityField for the supported field types. + * + * The implementation is currently limited to TileEntitys as data providers. The tile entity + * has to be fully initialized when executing this method (i.e. valid worldObj+coords). + * + * This method doesn't do anything if executed on the server. + * + * @param dataProvider Object implementing the INetworkDataProvider interface + * + * @deprecated no need to call this anymore, IC2 initiates it automatically + */ + @Deprecated + public static void requestInitialData(INetworkDataProvider dataProvider) { + // + } + + /** + * Immediately send an event for the specified TileEntity to the server. + * + * This method doesn't do anything if executed on the server. + * + * @param te TileEntity to notify, should implement INetworkClientTileEntityEventListener + * @param event Arbitrary integer to represent the event, choosing the values is up to you + */ + public static void initiateClientTileEntityEvent(TileEntity te, int event) { + try { + if (NetworkManager_initiateClientTileEntityEvent == null) NetworkManager_initiateClientTileEntityEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateClientTileEntityEvent", TileEntity.class, Integer.TYPE); + if (instance == null) instance = getInstance(); + + NetworkManager_initiateClientTileEntityEvent.invoke(instance, te, event); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Immediately send an event for the specified Item to the clients in range. + * + * The item should implement INetworkItemEventListener to receive the event. + * + * This method doesn't do anything if executed on the server. + * + * @param itemStack ItemStack containing the item + * @param event Arbitrary integer to represent the event, choosing the values is up to you + */ + public static void initiateClientItemEvent(ItemStack itemStack, int event) { + try { + if (NetworkManager_initiateClientItemEvent == null) NetworkManager_initiateClientItemEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateClientItemEvent", ItemStack.class, Integer.TYPE); + if (instance == null) instance = getInstance(); + + NetworkManager_initiateClientItemEvent.invoke(instance, itemStack, event); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Get the base IC2 package name, used internally. + * + * @return IC2 package name, if unable to be determined defaults to ic2 + */ + private static String getPackage() { + Package pkg = NetworkHelper.class.getPackage(); + + if (pkg != null) { + String packageName = pkg.getName(); + + return packageName.substring(0, packageName.length() - ".api.network".length()); + } + + return "ic2"; + } + + /** + * Get the NetworkManager instance, used internally. + * + * @return NetworkManager instance + */ + private static Object getInstance() { + try { + return Class.forName(getPackage() + ".core.IC2").getDeclaredField("network").get(null); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + + private static Object instance; + private static Method NetworkManager_updateTileEntityField; + private static Method NetworkManager_initiateTileEntityEvent; + private static Method NetworkManager_initiateItemEvent; + private static Method NetworkManager_announceBlockUpdate; + private static Method NetworkManager_initiateClientTileEntityEvent; + private static Method NetworkManager_initiateClientItemEvent; +} + diff --git a/src/api/java/ic2/api/reactor/IC2Reactor.java b/src/api/java/ic2/api/reactor/IC2Reactor.java new file mode 100644 index 0000000..512c4ff --- /dev/null +++ b/src/api/java/ic2/api/reactor/IC2Reactor.java @@ -0,0 +1,34 @@ +package ic2.api.reactor; + +import java.lang.reflect.Field; + +public class IC2Reactor { + private static Field energyGeneratorNuclear; + + public static int getEUOutput() { + try { + if (energyGeneratorNuclear == null) energyGeneratorNuclear = Class.forName(getPackage() + ".core.IC2").getDeclaredField("energyGeneratorNuclear"); + + return energyGeneratorNuclear.getInt(null); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + + /** + * Get the base IC2 package name, used internally. + * + * @return IC2 package name, if unable to be determined defaults to ic2 + */ + private static String getPackage() { + Package pkg = IC2Reactor.class.getPackage(); + + if (pkg != null) { + String packageName = pkg.getName(); + + return packageName.substring(0, packageName.length() - ".api.reactor".length()); + } + + return "ic2"; + } +} diff --git a/src/api/java/ic2/api/reactor/IReactor.java b/src/api/java/ic2/api/reactor/IReactor.java new file mode 100644 index 0000000..f1d21a7 --- /dev/null +++ b/src/api/java/ic2/api/reactor/IReactor.java @@ -0,0 +1,138 @@ +package ic2.api.reactor; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + +/** + * Interface implemented by the tile entity of nuclear reactors. + */ +public interface IReactor { + /** + * Get the reactor's position in the world. + * + * @return Position of the reactor + */ + public ChunkCoordinates getPosition(); + + /** + * Get the reactor's corresponding world. + * + * @return The reactor's world + */ + public World getWorld(); + + /** + * Get the reactor's heat. + * + * @return The reactor's heat + */ + public int getHeat(); + + /** + * Set the reactor's heat. + * + * @param heat reactor heat + */ + public void setHeat(int heat); + + /** + * Increase the reactor's heat. + * + * Use negative values to decrease. + * + * @param amount amount of heat to add + * @return The reactor's heat after adding the specified amount + */ + public int addHeat(int amount); + + /** + * Get the reactor's maximum heat before exploding. + * + * @return Maximum heat value + */ + public int getMaxHeat(); + + /** + * Set the reactor's stored maxHeat variable. + * Used by plating to increase the reactors MaxHeat capacity. + * Needs to be called during each cycle process. + */ + public void setMaxHeat(int newMaxHeat); + + /** + * add Heat to a EmitHeat Buffer + * for use in Reactor operation.. need to be use + * for all Componetents with self-cooling + * no more magic heat disappear + */ + + + public void addEmitHeat(int heat); + + /** + * Get's the reactor's HEM (Heat Effect Modifier) + * Basic value is 1.0F. + * Reducing the value causes a weakening/reduction of the heat-based sideeffects of reactors + * (F.e. water evaporation, melting, damaging entitys, etc) + * + * @return HEM + */ + public float getHeatEffectModifier(); + + /** + * Set's the reactor's HEM + * Needs to be called during each cycle process. + */ + public void setHeatEffectModifier(float newHEM); + + /** + * Get the reactor's energy output. + * + * @return Energy output, not multiplied by the base EU/t value + */ + public float getReactorEnergyOutput(); + + /** + * Add's the given amount of energy to the Reactor's output. + * + * @return Energy output after adding the value, not multiplied by the base EU/t value + */ + public float addOutput(float energy); + + /** + * Get the item at the specified grid coordinates. + * + * @param x X position of the item, out of bounds returns null + * @param y Y position of the item, out of bounds returns null + * @return The item or null if there is no item + */ + public ItemStack getItemAt(int x, int y); + + /** + * Set the item at the specified grid coordinates. + * + * @param x X position of the item, out of bounds is a no-op + * @param y Y position of the item, out of bounds is a no-op + * @param item The item to set. + */ + public void setItemAt(int x, int y, ItemStack item); + + /** + * Explode the reactor. + */ + public void explode(); + + /** + * Get the reactor's tick rate (game ticks per reactor tick). + * + * @return Tick rate + */ + public int getTickRate(); + + /** + * Get whether the reactor is active and supposed to produce energy + * @return Whether the reactor is active + */ + public boolean produceEnergy(); +} diff --git a/src/api/java/ic2/api/reactor/IReactorChamber.java b/src/api/java/ic2/api/reactor/IReactorChamber.java new file mode 100644 index 0000000..1b9f2c9 --- /dev/null +++ b/src/api/java/ic2/api/reactor/IReactorChamber.java @@ -0,0 +1,13 @@ +package ic2.api.reactor; + +/** + * Interface implemented by the reactor chamber tile entity. + */ +public interface IReactorChamber { + /** + * Get the chamber's reactor. + * + * @return The reactor + */ + public IReactor getReactor(); +} diff --git a/src/api/java/ic2/api/reactor/IReactorComponent.java b/src/api/java/ic2/api/reactor/IReactorComponent.java new file mode 100644 index 0000000..77fbacd --- /dev/null +++ b/src/api/java/ic2/api/reactor/IReactorComponent.java @@ -0,0 +1,99 @@ +package ic2.api.reactor; + +import net.minecraft.item.ItemStack; + +/** + * Design custom Reactor components by implementing this Interface + * Items implementing the interface will not be ejected from Reactors in their clean-up + * and can/will be interacted with by other elements, f.e. Uranium Cells. + * + * All IC2 ReactorComponents implement and use this Interface + * + */ +public interface IReactorComponent +{ + /** + * Called by reactor upon iterating through it's inventory (every cycle). + * Perform all necessary calculation/interaction here + * + * @param reactor Reference to the Reactor + * @param yourStack Reference to the specific instance of iterated ItemStack + * @param x X-coordinate of the stack in the grid + * @param y Y-coordinate of the stack in the grid + * @param heatrun every Stack will cycle 2 time (true,false) first run for heat, sec for Eu calculation + */ + public void processChamber(IReactor reactor, ItemStack yourStack, int x, int y,boolean heatrun); + + /** + * Can be called by Uranium-Components who attempt to generate energy by pulsing to other components. + * Uranium-Uranium interaction (f.e.) uses this method. + * @param reactor Reference to the Reactor + * @param yourStack Reference to the specific instance of called ItemStack + * @param pulsingStack Reference to the specific instance of pulsing ItemStack + * @param youX X-coordinate of your stack in the grid + * @param youY Y-coordinate of your stack in the grid + * @param pulseX X-coordinate of pulsing stack in the grid + * @param pulseY Y-coordinate of pulsing stack in the grid + * @param heatrun true for only create heat not EU, false for only EU not heat + * @return true if this component reacts to the pulse (and pulse is therefore meant to produce heat) + */ + public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack, ItemStack pulsingStack, int youX, int youY, int pulseX, int pulseY,boolean heatrun); + + /** + * Called by components to determine whether your component can be heated. + * @param reactor Reference to the Reactor + * @param yourStack Reference to the specific instance of iterated ItemStack + * @param x X-coordinate of the stack in the grid + * @param y Y-coordinate of the stack in the grid + * @return true if your component can take heat + */ + public boolean canStoreHeat(IReactor reactor, ItemStack yourStack, int x, int y); + + /** + * Called by heat-switches to determine how much heat to distribute into which direction. + * Please return the maximum capacity of your heat-containing component here. + * @param reactor Reference to the Reactor + * @param yourStack Reference to the specific instance of iterated ItemStack + * @param x X-coordinate of the stack in the grid + * @param y Y-coordinate of the stack in the grid + * @return Maximum heat + */ + public int getMaxHeat(IReactor reactor, ItemStack yourStack, int x, int y); + + /** + * Called by heat-switches to determine how much heat to distribute into which direction. + * Please return the current amount of heat stored in this component + * @param reactor Reference to the Reactor + * @param yourStack Reference to the specific instance of iterated ItemStack + * @param x X-coordinate of the stack in the grid + * @param y Y-coordinate of the stack in the grid + * @return Current Heat + */ + public int getCurrentHeat(IReactor reactor, ItemStack yourStack, int x, int y); + + /** + * Called by components to distribute heat to your component. + * Perform heating-calculations and increase your heat (dmg) level accordingly. + * This method will as well be called to REDUCE heat, by providing a negative amount. + * + * @param reactor Reference to the Reactor + * @param yourStack Reference to the specific instance of iterated ItemStack + * @param x X-coordinate of the stack in the grid + * @param y Y-coordinate of the stack in the grid + * @param heat Amount of heat to be added (may be negative to subtract heat) + * @return 0 if the 'order' was accepted, return >0 to indicate the 'remaining' heat which couldn't be absorbed (and vice versa for <0) + */ + public int alterHeat(IReactor reactor, ItemStack yourStack, int x, int y, int heat); + + /** + * Called upon reactor explosion + * Alter the explosion size. + * Returning a float 0 < f < 1 will be counted as multiplier. + * Anything else will be counted as a flat addition (in case of <0 = reduction). + * + * @param reactor Reference to the Reactor + * @param yourStack Reference to the specific instance of iterated ItemStack + * @return your explosion modifier + */ + public float influenceExplosion(IReactor reactor, ItemStack yourStack); +} diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java new file mode 100644 index 0000000..415b3c3 --- /dev/null +++ b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java @@ -0,0 +1,51 @@ +package ic2.api.recipe; + +import java.util.Map; + +import net.minecraft.item.ItemStack; + +public interface ICannerBottleRecipeManager { + /** + * Adds a recipe to the machine. + * + * @param container Container to be filled + * @param fill Item to fill into the container + * @param output Filled container + */ + public void addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output); + + /** + * Gets the recipe output for the given input. + * + * @param container Container to be filled + * @param fill Item to fill into the container + * @param adjustInput modify the input according to the recipe's requirements + * @param acceptTest allow either container or fill to be null to see if either of them is part of a recipe + * @return Recipe output, or null if none + */ + public RecipeOutput getOutputFor(ItemStack container, ItemStack fill, boolean adjustInput, boolean acceptTest); + + /** + * Gets a list of recipes. + * + * You're a mad evil scientist if you ever modify this. + * + * @return List of recipes + */ + public Map getRecipes(); + + + public static class Input { + public Input(IRecipeInput container1, IRecipeInput fill1) { + this.container = container1; + this.fill = fill1; + } + + public boolean matches(ItemStack container1, ItemStack fill1) { + return this.container.matches(container1) && this.fill.matches(fill1); + } + + public final IRecipeInput container; + public final IRecipeInput fill; + } +} diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java new file mode 100644 index 0000000..5eba1b6 --- /dev/null +++ b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java @@ -0,0 +1,54 @@ +package ic2.api.recipe; + +import java.util.Map; + +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fluids.FluidStack; + +public interface ICannerEnrichRecipeManager { + /** + * Adds a recipe to the machine. + * + * @param input Fluid input + * @param additive Item to enrich the fluid with + * @param output Output fluid + */ + public void addRecipe(FluidStack input, IRecipeInput additive, FluidStack output); + + /** + * Gets the recipe output for the given input. + * + * @param input Fluid input + * @param additive Item to enrich the fluid with + * @param adjustInput modify the input according to the recipe's requirements + * @param acceptTest allow input or additive to be null to see if either of them is part of a recipe + * @return Recipe output, or null if none, output fluid in nbt + */ + public RecipeOutput getOutputFor(FluidStack input, ItemStack additive, boolean adjustInput, boolean acceptTest); + + /** + * Gets a list of recipes. + * + * You're a mad evil scientist if you ever modify this. + * + * @return List of recipes + */ + public Map getRecipes(); + + + public static class Input { + public Input(FluidStack fluid1, IRecipeInput additive1) { + this.fluid = fluid1; + this.additive = additive1; + } + + public boolean matches(FluidStack fluid1, ItemStack additive1) { + return (this.fluid == null || this.fluid.isFluidEqual(fluid1)) && + this.additive.matches(additive1); + } + + public final FluidStack fluid; + public final IRecipeInput additive; + } +} diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java new file mode 100644 index 0000000..756eaf6 --- /dev/null +++ b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java @@ -0,0 +1,26 @@ +package ic2.api.recipe; + +import net.minecraft.item.ItemStack; + +/** + * Recipe manager interface for crafting recipes. + * + * @author Richard + */ +public interface ICraftingRecipeManager { + /** + * Adds a shaped crafting recipe. + * + * @param output Recipe output + * @param input Recipe input format + */ + public void addRecipe(ItemStack output, Object... input); + + /** + * Adds a shapeless crafting recipe. + * + * @param output Recipe output + * @param input Recipe input + */ + public void addShapelessRecipe(ItemStack output, Object... input); +} diff --git a/src/api/java/ic2/api/recipe/ILiquidAcceptManager.java b/src/api/java/ic2/api/recipe/ILiquidAcceptManager.java new file mode 100644 index 0000000..4f377b9 --- /dev/null +++ b/src/api/java/ic2/api/recipe/ILiquidAcceptManager.java @@ -0,0 +1,10 @@ +package ic2.api.recipe; + +import java.util.Set; + +import net.minecraftforge.fluids.Fluid; + +public interface ILiquidAcceptManager { + boolean acceptsFluid(Fluid fluid); + Set getAcceptedFluids(); +} diff --git a/src/api/java/ic2/api/recipe/IListRecipeManager.java b/src/api/java/ic2/api/recipe/IListRecipeManager.java new file mode 100644 index 0000000..5bee9da --- /dev/null +++ b/src/api/java/ic2/api/recipe/IListRecipeManager.java @@ -0,0 +1,41 @@ +package ic2.api.recipe; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +/** + * Recipe manager interface for basic lists. + * + * @author Richard + */ +public interface IListRecipeManager extends Iterable { + /** + * Adds a stack to the list. + * + * @param stack Stack to add + */ + public void add(ItemStack stack); + + /** + * Checks whether the specified stack is in the list. + * + * @param stack Stack to check + * @return Whether the stack is in the list + */ + public boolean contains(ItemStack stack); + + /** + * @return if the List is Empty + */ + public boolean isEmpty(); + + /** + * Gets the list of stacks. + * + * You're a mad evil scientist if you ever modify this. + * + * @return List of stacks + */ + public List getStacks(); +} diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java new file mode 100644 index 0000000..388e394 --- /dev/null +++ b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java @@ -0,0 +1,44 @@ +package ic2.api.recipe; + +import java.util.Map; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Recipe manager interface for basic machines. + * + * @author RichardG, Player + */ +public interface IMachineRecipeManager { + /** + * Adds a recipe to the machine. + * + * @param input Recipe input + * @param metadata meta data for additional recipe properties, may be null + * @param outputs Recipe outputs, zero or more depending on the machine + * + * For the thermal centrifuge @param metadata meta data {"minHeat": 1-xxx} + * For the ore washing plant @param metadata meta data {"amount": 1-8000} + * + */ + public void addRecipe(IRecipeInput input, NBTTagCompound metadata, ItemStack... outputs); + + /** + * Gets the recipe output for the given input. + * + * @param input Recipe input + * @param adjustInput modify the input according to the recipe's requirements + * @return Recipe output, or null if none + */ + public RecipeOutput getOutputFor(ItemStack input, boolean adjustInput); + + /** + * Gets a list of recipes. + * + * You're a mad evil scientist if you ever modify this. + * + * @return List of recipes + */ + public Map getRecipes(); +} diff --git a/src/api/java/ic2/api/recipe/IPatternStorage.java b/src/api/java/ic2/api/recipe/IPatternStorage.java new file mode 100644 index 0000000..f51f0de --- /dev/null +++ b/src/api/java/ic2/api/recipe/IPatternStorage.java @@ -0,0 +1,15 @@ +package ic2.api.recipe; + +import net.minecraft.item.ItemStack; + +public interface IPatternStorage { + + boolean transferPattern(ItemStack itemstack, int amountUU , int amountEU); + + int[] getPatternvalus(ItemStack itemstack); + + short getPatternCount(); + + ItemStack getPatternItemstack(int index); + +} diff --git a/src/api/java/ic2/api/recipe/IRecipeInput.java b/src/api/java/ic2/api/recipe/IRecipeInput.java new file mode 100644 index 0000000..0c842d6 --- /dev/null +++ b/src/api/java/ic2/api/recipe/IRecipeInput.java @@ -0,0 +1,31 @@ +package ic2.api.recipe; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IRecipeInput { + /** + * Check if subject matches this recipe input, ignoring the amount. + * + * @param subject ItemStack to check + * @return true if it matches the requirement + */ + boolean matches(ItemStack subject); + + /** + * Determine the minimum input stack size. + * + * @return input amount required + */ + int getAmount(); + + /** + * List all possible inputs (best effort). + * + * The stack size is undefined, use getAmount to get the correct one. + * + * @return list of inputs, may be incomplete + */ + List getInputs(); +} diff --git a/src/api/java/ic2/api/recipe/IScrapboxManager.java b/src/api/java/ic2/api/recipe/IScrapboxManager.java new file mode 100644 index 0000000..41b694d --- /dev/null +++ b/src/api/java/ic2/api/recipe/IScrapboxManager.java @@ -0,0 +1,13 @@ +package ic2.api.recipe; + +import java.util.Map; + +import net.minecraft.item.ItemStack; + +public interface IScrapboxManager { + void addDrop(ItemStack drop, float rawChance); + + ItemStack getDrop(ItemStack input, boolean adjustInput); + + Map getDrops(); +} diff --git a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java new file mode 100644 index 0000000..87c3427 --- /dev/null +++ b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java @@ -0,0 +1,32 @@ +package ic2.api.recipe; + +import java.util.Map; + +import net.minecraftforge.fluids.Fluid; + + +public interface ISemiFluidFuelManager extends ILiquidAcceptManager { + /** + * Add a new fluid to the semi fluid generator. + * + * @param fluidName the fluid to burn + * @param amount amount of fluid to consume per tick + * @param power amount of energy generated per tick + */ + void addFluid(String fluidName, int amount, double power); + + BurnProperty getBurnProperty(Fluid fluid); + + Map getBurnProperties(); + + + public static class BurnProperty { + public BurnProperty(int amount1, double power1) { + this.amount = amount1; + this.power = power1; + } + + public final int amount; + public final double power; + } +} diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java b/src/api/java/ic2/api/recipe/RecipeInputItemStack.java new file mode 100644 index 0000000..18e98ad --- /dev/null +++ b/src/api/java/ic2/api/recipe/RecipeInputItemStack.java @@ -0,0 +1,37 @@ +package ic2.api.recipe; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.item.ItemStack; + +import net.minecraftforge.oredict.OreDictionary; + +public class RecipeInputItemStack implements IRecipeInput { + public RecipeInputItemStack(ItemStack aInput) { + this(aInput, aInput.stackSize); + } + + public RecipeInputItemStack(ItemStack aInput, int aAmount) { + input = aInput.copy(); // Never forget to copy. + amount = aAmount; + } + + @Override + public boolean matches(ItemStack subject) { + return subject.getItem() == input.getItem() && (subject.getItemDamage() == input.getItemDamage() || input.getItemDamage() == OreDictionary.WILDCARD_VALUE); + } + + @Override + public int getAmount() { + return amount; + } + + @Override + public List getInputs() { + return Arrays.asList(input); + } + + public final ItemStack input; + public final int amount; +} diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java b/src/api/java/ic2/api/recipe/RecipeInputOreDict.java new file mode 100644 index 0000000..7059059 --- /dev/null +++ b/src/api/java/ic2/api/recipe/RecipeInputOreDict.java @@ -0,0 +1,45 @@ +package ic2.api.recipe; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +import net.minecraftforge.oredict.OreDictionary; + +public class RecipeInputOreDict implements IRecipeInput { + public RecipeInputOreDict(String input1) { + this(input1, 1); + } + + public RecipeInputOreDict(String input1, int amount1) { + this.input = input1; + this.amount = amount1; + } + + @Override + public boolean matches(ItemStack subject) { + List inputs = OreDictionary.getOres(input); + + for (ItemStack input1 : inputs) { + if (subject.itemID == input1.itemID && + (subject.getItemDamage() == input1.getItemDamage() || input1.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { + return true; + } + } + + return false; + } + + @Override + public int getAmount() { + return amount; + } + + @Override + public List getInputs() { + return OreDictionary.getOres(input); + } + + public final String input; + public final int amount; +} diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.java b/src/api/java/ic2/api/recipe/RecipeOutput.java new file mode 100644 index 0000000..c9474cd --- /dev/null +++ b/src/api/java/ic2/api/recipe/RecipeOutput.java @@ -0,0 +1,21 @@ +package ic2.api.recipe; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public final class RecipeOutput { + public RecipeOutput(NBTTagCompound metadata1, List items1) { + this.metadata = metadata1; + this.items = items1; + } + + public RecipeOutput(NBTTagCompound metadata1, ItemStack... items1) { + this(metadata1, Arrays.asList(items1)); + } + + public final List items; + public final NBTTagCompound metadata; +} diff --git a/src/api/java/ic2/api/recipe/Recipes.java b/src/api/java/ic2/api/recipe/Recipes.java new file mode 100644 index 0000000..4e12a03 --- /dev/null +++ b/src/api/java/ic2/api/recipe/Recipes.java @@ -0,0 +1,60 @@ +package ic2.api.recipe; + + + +/** + * General recipe registry. + * + * @author Richard + */ +public class Recipes { + public static IMachineRecipeManager macerator; + public static IMachineRecipeManager extractor; + public static IMachineRecipeManager compressor; + public static IMachineRecipeManager centrifuge; + public static IMachineRecipeManager recycler; + public static IMachineRecipeManager metalformerExtruding; + public static IMachineRecipeManager metalformerCutting; + public static IMachineRecipeManager metalformerRolling; + public static IMachineRecipeManager oreWashing; + public static IMachineRecipeManager Scanner; + public static ICannerBottleRecipeManager cannerBottle; + public static ICannerEnrichRecipeManager cannerEnrich; + + /** + * Reference amplifier values: + * + * 5000: Scrap + * 45000: Scrapbox + * + * As Parameter for the Amplification Value you have to use the NBTTagCompound + * + * NBTTagCompound nbt = new NBTTagCompound(); + * nbt.setInteger("amplification", aValue); + * matterAmplifier.addRecipe(yourStack, nbt); + */ + public static IMachineRecipeManager matterAmplifier; + /** + * Reference scrap box chance values: + * + * 0.1: Diamond + * 0.5: Cake, Gold Helmet, Iron Ore, Gold Ore + * 1.0: Wooden tools, Soul Sand, Sign, Leather, Feather, Bone + * 1.5: Apple, Bread + * 2.0: Netherrack, Rotten Flesh + * 3.0: Grass, Gravel + * 4.0: Stick + * 5.0: Dirt, Wooden Hoe + */ + public static IScrapboxManager scrapboxDrops; + public static IListRecipeManager recyclerBlacklist; + /** + * Do not add anything to this Whitelist. This is for Configuration only. + * You may need this if you have an own Recycler in your Mod, just to check if something can be recycled. but don't add anything to this List + */ + public static IListRecipeManager recyclerWhitelist; + public static ICraftingRecipeManager advRecipes; + + public static ISemiFluidFuelManager semiFluidGenerator; + +} diff --git a/src/api/java/ic2/api/tile/ExplosionWhitelist.java b/src/api/java/ic2/api/tile/ExplosionWhitelist.java new file mode 100644 index 0000000..fa4a474 --- /dev/null +++ b/src/api/java/ic2/api/tile/ExplosionWhitelist.java @@ -0,0 +1,47 @@ +package ic2.api.tile; + +import java.util.HashSet; +import java.util.Set; + +import net.minecraft.block.Block; + +/** + * Blocks on this whitelist will not resist an explosion but won't be destroyed. + * + * The explosion code by default ignores blocks which absorb more than 1000 explosion power to + * prevent abusing personal safes, Trade-O-Mats and other blocks to serve as a cheap and + * invulnerable reactor chambers. Said blocks will not shield the explosion and won't get + * destroyed. + */ +public final class ExplosionWhitelist { + /** + * Add a block to the whitelist. + * + * @param block block to add + */ + public static void addWhitelistedBlock(Block block) { + whitelist.add(block); + } + + /** + * Remove a block from the whitelist. + * + * @param block block to remove + */ + public static void removeWhitelistedBlock(Block block) { + whitelist.remove(block); + } + + /** + * Check if a block is on the whitelist. + * + * @param block block to check if whitelisted + * @return Whether the block is whitelisted + */ + public static boolean isBlockWhitelisted(Block block) { + return whitelist.contains(block); + } + + private static Set whitelist = new HashSet(); +} + diff --git a/src/api/java/ic2/api/tile/IEnergyStorage.java b/src/api/java/ic2/api/tile/IEnergyStorage.java new file mode 100644 index 0000000..d20eb04 --- /dev/null +++ b/src/api/java/ic2/api/tile/IEnergyStorage.java @@ -0,0 +1,61 @@ +package ic2.api.tile; + +import net.minecraftforge.common.ForgeDirection; + +/** + * Interface implemented by the tile entity of energy storage blocks. + */ +public interface IEnergyStorage { + /** + * Get the amount of energy currently stored in the block. + * + * @return Energy stored in the block + */ + public int getStored(); + + /** + * Set the amount of energy currently stored in the block. + * + * @param energy stored energy + */ + public void setStored(int energy); + + /** + * Add the specified amount of energy. + * + * Use negative values to decrease. + * + * @param amount of energy to add + * @return Energy stored in the block after adding the specified amount + */ + public int addEnergy(int amount); + + /** + * Get the maximum amount of energy the block can store. + * + * @return Maximum energy stored + */ + public int getCapacity(); + + /** + * Get the block's energy output. + * + * @return Energy output in EU/t + */ + public int getOutput(); + + /** + * Get the block's energy output. + * + * @return Energy output in EU/t + */ + public double getOutputEnergyUnitsPerTick(); + + /** + * Get whether this block can have its energy used by an adjacent teleporter. + * + * @param side side the teleporter is draining energy from + * @return Whether the block is teleporter compatible + */ + public boolean isTeleporterCompatible(ForgeDirection side); +} diff --git a/src/api/java/ic2/api/tile/IWrenchable.java b/src/api/java/ic2/api/tile/IWrenchable.java new file mode 100644 index 0000000..944f4a1 --- /dev/null +++ b/src/api/java/ic2/api/tile/IWrenchable.java @@ -0,0 +1,61 @@ +package ic2.api.tile; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +/** + * Allows a tile entity to make use of the wrench's removal and rotation functions. + */ +public interface IWrenchable { + /** + * Determine if the wrench can be used to set the block's facing. + * Called before wrenchCanRemove(). + * + * @param entityPlayer player using the wrench, may be null + * @param side block's side the wrench was clicked on + * @return Whether the wrenching was done and the wrench should be damaged + */ + boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side); + + /** + * Get the block's facing. + * + * @return Block facing + */ + short getFacing(); + + /** + * Set the block's facing + * + * @param facing facing to set the block to + */ + void setFacing(short facing); + + /** + * Determine if the wrench can be used to remove the block. + * Called if wrenchSetFacing fails. + * + * @param entityPlayer player using the wrench, may be null + * @return Whether the wrenching was done and the wrench should be damaged + */ + boolean wrenchCanRemove(EntityPlayer entityPlayer); + + /** + * Determine the probability to drop the block as it is. + * The first entry in getBlockDropped will be replaced by blockid:meta if the drop is successful. + * + * @return Probability from 0 to 1 + */ + float getWrenchDropRate(); + + /** + * Determine the item the block will drop when the wrenching is successful. + * + * The ItemStack will be copied before creating the EntityItem. + * + * @param entityPlayer player using the wrench, may be null + * @return ItemStack to drop, may be null + */ + ItemStack getWrenchDrop(EntityPlayer entityPlayer); +} + diff --git a/src/api/java/ic2/api/util/IKeyboard.java b/src/api/java/ic2/api/util/IKeyboard.java new file mode 100644 index 0000000..ff6eaea --- /dev/null +++ b/src/api/java/ic2/api/util/IKeyboard.java @@ -0,0 +1,14 @@ +package ic2.api.util; + +import net.minecraft.entity.player.EntityPlayer; + +public interface IKeyboard { + boolean isAltKeyDown(EntityPlayer player); + boolean isBoostKeyDown(EntityPlayer player); + boolean isForwardKeyDown(EntityPlayer player); + boolean isJumpKeyDown(EntityPlayer player); + boolean isModeSwitchKeyDown(EntityPlayer player); + boolean isSideinventoryKeyDown(EntityPlayer player); + boolean isHudModeKeyDown(EntityPlayer player); + boolean isSneakKeyDown(EntityPlayer player); +} diff --git a/src/api/java/ic2/api/util/Keys.java b/src/api/java/ic2/api/util/Keys.java new file mode 100644 index 0000000..84d1756 --- /dev/null +++ b/src/api/java/ic2/api/util/Keys.java @@ -0,0 +1,6 @@ +package ic2.api.util; + + +public class Keys { + public static IKeyboard instance; +} \ No newline at end of file diff --git a/src/api/java/thaumcraft/api b/src/api/java/thaumcraft/api new file mode 160000 index 0000000..4c7ac43 --- /dev/null +++ b/src/api/java/thaumcraft/api @@ -0,0 +1 @@ +Subproject commit 4c7ac43fde35e011b99ec299381abc873d2a655d diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/CapeEventHandler.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/CapeEventHandler.java new file mode 100644 index 0000000..9a36205 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/CapeEventHandler.java @@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.client; + +import java.awt.Graphics; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.swing.ImageIcon; + +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.ThreadDownloadImageData; +import net.minecraftforge.client.event.RenderPlayerEvent; +import net.minecraftforge.event.ForgeSubscribe; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.relauncher.ReflectionHelper; + +public class CapeEventHandler +{ + private final String serverLocation = "https://raw.github.com/Tombenpotter/ElectricMagicTools/master/capes.txt"; + private final int timeout = 1000; + + private static final Graphics TEST_GRAPHICS = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB).getGraphics(); + private HashMap cloaks = new HashMap(); + private ArrayList capePlayers = new ArrayList(); + + public static CapeEventHandler instance; + + public CapeEventHandler() + { + buildCloakURLDatabase(); + instance = this; + } + + @ForgeSubscribe + public void onPreRenderSpecials(RenderPlayerEvent.Specials.Pre event) { + if (Loader.isModLoaded("shadersmod")) + { + return; + } + if (event.entityPlayer instanceof AbstractClientPlayer) + { + AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer; + + if (!capePlayers.contains(abstractClientPlayer)) + { + String cloakURL = cloaks.get(event.entityPlayer.username); + + if (cloakURL == null) + { + return; + } + + capePlayers.add(abstractClientPlayer); + + ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), false, new String[] { "textureUploaded", "field_110559_g" }); + + new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start(); + event.renderCape = true; + } + } + } + + public void buildCloakURLDatabase() { + URL url; + try + { + url = new URL(serverLocation); + URLConnection con = url.openConnection(); + con.setConnectTimeout(timeout); + con.setReadTimeout(timeout); + InputStream io = con.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(io)); + + String str; + int linetracker = 1; + while ((str = br.readLine()) != null) + { + if (!str.startsWith("--")) + { + if (str.contains(":")) + { + String nick = str.substring(0, str.indexOf(":")); + String link = str.substring(str.indexOf(":") + 1); + new Thread(new CloakPreload(link)).start(); + cloaks.put(nick, link); + } else + { + System.err.println("[Electro-Magic Tools] [skins.txt] Syntax error on line " + linetracker + ": " + str); + } + } + linetracker++; + } + + br.close(); + } catch (MalformedURLException e) + { + e.printStackTrace(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + + private class CloakThread implements Runnable + { + AbstractClientPlayer abstractClientPlayer; + String cloakURL; + + public CloakThread(AbstractClientPlayer player, String cloak) + { + abstractClientPlayer = player; + cloakURL = cloak; + } + + @Override + public void run() { + try + { + Image cape = new ImageIcon(new URL(cloakURL)).getImage(); + BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB); + bo.getGraphics().drawImage(cape, 0, 0, null); + + ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), bo, new String[] { "bufferedImage", "field_110560_d" }); + } catch (MalformedURLException e) + { + e.printStackTrace(); + } + } + } + + private class CloakPreload implements Runnable + { + String cloakURL; + + public CloakPreload(String link) + { + cloakURL = link; + } + + @Override + public void run() { + try + { + TEST_GRAPHICS.drawImage(new ImageIcon(new URL(cloakURL)).getImage(), 0, 0, null); + } catch (MalformedURLException e) + { + e.printStackTrace(); + } + } + } + + public void refreshCapes() { + cloaks.clear(); + capePlayers.clear(); + buildCloakURLDatabase(); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/ClientProxy.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/ClientProxy.java new file mode 100644 index 0000000..8aab578 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/ClientProxy.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.client; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.CommonProxy; +import electricMagicTools.tombenpotter.electricmagictools.common.entities.EntityArcher; +import electricMagicTools.tombenpotter.electricmagictools.common.entities.EntityLaser; +import electricMagicTools.tombenpotter.electricmagictools.common.entities.RenderArcher; +import electricMagicTools.tombenpotter.electricmagictools.common.entities.RenderLaser; + +public class ClientProxy extends CommonProxy +{ + + @Override + public void load() { + registerRenders(); + } + + public void registerRenders() { + RenderingRegistry.registerEntityRenderingHandler(EntityLaser.class, new RenderLaser()); + RenderingRegistry.registerEntityRenderingHandler(EntityArcher.class, new RenderArcher()); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/gui/GuiEtherealMacerator.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/gui/GuiEtherealMacerator.java new file mode 100644 index 0000000..0173bf0 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/gui/GuiEtherealMacerator.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEtherealMacerator; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.container.ContainerEtheralMacerator; + +public class GuiEtherealMacerator extends GuiContainer +{ + + public GuiEtherealMacerator(InventoryPlayer inventory, TileEntityEtherealMacerator te) + { + super(new ContainerEtheralMacerator(inventory, te)); + xSize = 176; + ySize = 165; + } + + public static final ResourceLocation texture = new ResourceLocation("electricmagictools", "textures/guis/etherealmacerator.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, xSize, ySize); + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRenderer.drawString(I18n.getString("Ethereal Processor"), 6, 6, 4210752); + this.fontRenderer.drawString(I18n.getString("Inventory"), 8, this.ySize - 96 + 2, 4210752); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/gui/GuiIndustrialWandRecharger.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/gui/GuiIndustrialWandRecharger.java new file mode 100644 index 0000000..8659b16 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/client/gui/GuiIndustrialWandRecharger.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIndustrialWandRecharge; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.container.ContainerIndustrialWandRecharge; + +public class GuiIndustrialWandRecharger extends GuiContainer +{ + + public GuiIndustrialWandRecharger(InventoryPlayer inventory, TileEntityIndustrialWandRecharge te) + { + super(new ContainerIndustrialWandRecharge(inventory, te)); + xSize = 176; + ySize = 165; + } + + public static final ResourceLocation texture = new ResourceLocation("electricmagictools", "textures/guis/wandcharger.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, xSize, ySize); + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRenderer.drawString(I18n.getString("Industrial Wand Charging Station"), 6, 6, 4210752); + this.fontRenderer.drawString(I18n.getString("Inventory"), 8, this.ySize - 96 + 2, 4210752); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/BlockRegistry.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/BlockRegistry.java new file mode 100644 index 0000000..b61425c --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/BlockRegistry.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.blocks.BlockEMTMachines; +import electricMagicTools.tombenpotter.electricmagictools.common.blocks.BlockEMTSolars; +import electricMagicTools.tombenpotter.electricmagictools.common.blocks.BlockEMTSolars2; +import electricMagicTools.tombenpotter.electricmagictools.common.blocks.BlockEssentiaGenerators; +import electricMagicTools.tombenpotter.electricmagictools.common.blocks.BlockPortableNode; +import electricMagicTools.tombenpotter.electricmagictools.common.blocks.BlockShield; +import electricMagicTools.tombenpotter.electricmagictools.common.items.ItemBlockEMTMachines; +import electricMagicTools.tombenpotter.electricmagictools.common.items.ItemBlockEMTSolars; +import electricMagicTools.tombenpotter.electricmagictools.common.items.ItemBlockEMTSolars2; +import electricMagicTools.tombenpotter.electricmagictools.common.items.ItemBlockEssentiaGenerators; + +public class BlockRegistry +{ + + public static Block essentiaGens; + public static Block shield; + public static Block emtSolars; + public static Block emtMachines; + public static Block emtSolars2; + public static Block portableNode; + + public static void registerEMTBlocks() { + + shield = new BlockShield(Config.shieldID).setUnlocalizedName("shield"); + portableNode = new BlockPortableNode(Config.portableNodeID).setUnlocalizedName("portablenode"); + + emtSolars = new BlockEMTSolars(Config.emtSolarsID).setUnlocalizedName("emtsolars"); + essentiaGens = new BlockEssentiaGenerators(Config.essentiaGensID).setUnlocalizedName("essentiaGens"); + emtMachines = new BlockEMTMachines(Config.emtMachinesID).setUnlocalizedName("emtmachines"); + emtSolars2 = new BlockEMTSolars2(Config.emtSolars2ID).setUnlocalizedName("emtsolars2"); + + GameRegistry.registerBlock(shield, "Shield Block"); + + GameRegistry.registerBlock(portableNode, "Portable Node"); + GameRegistry.registerBlock(emtSolars, ItemBlockEMTSolars.class, "EMT Solar Panels"); + GameRegistry.registerBlock(essentiaGens, ItemBlockEssentiaGenerators.class, "Essentia Generators"); + GameRegistry.registerBlock(emtMachines, ItemBlockEMTMachines.class, "EMT Machines"); + GameRegistry.registerBlock(emtSolars2, ItemBlockEMTSolars2.class, "EMT Solars 2"); + + LanguageRegistry.addName(new ItemStack(essentiaGens, 1, 0), "Potentia Generator"); + LanguageRegistry.addName(new ItemStack(essentiaGens, 1, 1), "Ignis Generator"); + LanguageRegistry.addName(new ItemStack(essentiaGens, 1, 2), "Auram Generator"); + LanguageRegistry.addName(new ItemStack(essentiaGens, 1, 3), "Arbor Generator"); + LanguageRegistry.addName(new ItemStack(essentiaGens, 1, 4), "Saxum Generator"); + LanguageRegistry.addName(shield, "Shield Block"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 0), "Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 1), "Double Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 2), "Triple Compessed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtMachines, 1, 0), "Industrial Wand Charging Station"); + LanguageRegistry.addName(new ItemStack(emtMachines, 1, 1), "Ethereal Processor"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 3), "Water Infused Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 4), "Water Infused Double Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 5), "Water Infused Triple Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 6), "Entropy Infused Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 7), "Entropy Infused Double Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 8), "Entropy Infused Triple Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 9), "Order Infused Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 10), "Order Infused Double Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 11), "Order Infused Triple Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 12), "Fire Infused Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 13), "Fire Infused Double Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 14), "Fire Infused Triple Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars, 1, 15), "Air Infused Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars2, 1, 0), "Air Infused Double Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars2, 1, 1), "Air Infused Triple Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars2, 1, 2), "Earth Infused Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars2, 1, 3), "Earth Infused Double Compressed Solar Panel"); + LanguageRegistry.addName(new ItemStack(emtSolars2, 1, 4), "Earth Infused Triple Compressed Solar Panel"); + LanguageRegistry.addName(portableNode, "Portable Node"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/CommonProxy.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/CommonProxy.java new file mode 100644 index 0000000..06dd0c0 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/CommonProxy.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import cpw.mods.fml.common.network.IGuiHandler; +import electricMagicTools.tombenpotter.electricmagictools.client.gui.GuiEtherealMacerator; +import electricMagicTools.tombenpotter.electricmagictools.client.gui.GuiIndustrialWandRecharger; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEtherealMacerator; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIndustrialWandRecharge; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.container.ContainerEtheralMacerator; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.container.ContainerIndustrialWandRecharge; + +public class CommonProxy implements IGuiHandler +{ + + public void load() { + registerRenders(); + } + + public void registerRenders() { + /* Empty in common proxy */ + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + TileEntity entity = world.getBlockTileEntity(x, y, z); + + switch (ID) + { + case 0: + if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) + { + return new ContainerIndustrialWandRecharge(player.inventory, (TileEntityIndustrialWandRecharge) entity); + } else + { + return null; + } + + case 1: + if (entity != null && entity instanceof TileEntityEtherealMacerator) + { + return new ContainerEtheralMacerator(player.inventory, (TileEntityEtherealMacerator) entity); + } else + { + return null; + } + default: + return null; + } + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + TileEntity entity = world.getBlockTileEntity(x, y, z); + + switch (ID) + { + case 0: + if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) + { + return new GuiIndustrialWandRecharger(player.inventory, (TileEntityIndustrialWandRecharge) entity); + } else + { + return null; + } + + case 1: + if (entity != null && entity instanceof TileEntityEtherealMacerator) + { + return new GuiEtherealMacerator(player.inventory, (TileEntityEtherealMacerator) entity); + } else + { + return null; + } + default: + return null; + + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/Config.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/Config.java new file mode 100644 index 0000000..c633215 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/Config.java @@ -0,0 +1,296 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraftforge.common.Configuration; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +public class Config +{ + + public static int thaumiumDrillID; + public static int thaumiumChainsawID; + public static int quantumThaumicHelmetID; + public static int diamondChainsawID; + public static int ironOmnitoolID; + public static int diamondOmnitoolID; + public static int thaumiumOmnitoolID; + public static int nanoThaumicHelmetID; + public static int explosionFocusID; + public static int christmasFocusID; + public static int shieldFocusID; + public static int shieldID; + public static int electricGogglesID; + public static int streamChainsawID; + public static int rockbreakerDrillID; + public static int thaumiumPlateID; + public static int solarHelmetRevealingID; + public static int thorHammerID; + public static int taintedThorHammerID; + public static int lightningSummonerID; + public static int electricThorHammerID; + public static int electricBootsTravellerID; + public static int quantumBootsTravellerID; + public static int nanoBootsTravellerID; + public static int electricScribingToolsID; + public static int essentiaGeneratorsDelay; + public static int etherealProcessorBaseSpeed; + public static int etherealProcessorBonus; + public static int itemEMTItemID; + public static int electricHoeGrowthID; + public static int chargeFocusProduction; + public static int chargeFocusID; + + public static int emtSolarsID; + public static int essentiaGensID; + public static int emtMachinesID; + public static int emtSolars2ID; + public static int portableNodeID; + + public static double potentiaGenOutput; + public static double arborGenOutput; + public static double auramGenOutput; + public static double ignisGenOutput; + public static double saxumGenOutput; + public static double wandChargerConsumption; + public static double compressedSolarOutput; + public static double doubleCompressedSolarOutput; + public static double nanoBootsSpeed; + public static double quantumBootsSpeed; + public static double nanoBootsJump; + public static double quantumBootsJump; + public static double tripleCompressedSolarOutput; + + public static boolean capesOn; + public static boolean toolsInBore; + public static boolean nightVisionOff; + public static boolean enchanting; + public static boolean smoke; + + public static boolean thaumiumDrillResearch; + public static boolean thaumiumChainsawResearch; + public static boolean thaumiumOmnitoolResearch; + public static boolean rockbreakerDrillResearch; + public static boolean streamChainsawResearch; + public static boolean electricGooglesResearch; + public static boolean nanoGooglesResearch; + public static boolean quantumGooglesResearch; + public static boolean ironOmnitoolResearch; + public static boolean diamondOmnitoolResearch; + public static boolean explosionFocusResearch; + public static boolean christmasFocusResearch; + public static boolean shieldFocusResearch; + public static boolean shieldBlockResearch; + public static boolean potentiaGeneratorResearch; + public static boolean ignisGeneratorResearch; + public static boolean auramGeneratorResearch; + public static boolean arborGeneratorResearch; + public static boolean wandChargingSationResearch; + public static boolean tinyUraniumResearch; + public static boolean thorHammerResearch; + public static boolean superchargedThorHammerResearch; + public static boolean compressedSolarsResearch; + public static boolean solarHelmetResearch; + public static boolean electricBootsResearch; + public static boolean nanoBootsResearch; + public static boolean quantumBootsResearch; + public static boolean electricScribingToolsResearch; + public static boolean etherealProcessorResearch; + public static boolean waterSolarsResearch; + public static boolean darkSolarsResearch; + public static boolean orderSolarsResearch; + public static boolean fireSolarsResearch; + public static boolean airSolarsResearch; + public static boolean earthSolarsResearch; + public static boolean saxumGenResearch; + public static boolean uuMInfusionResearch; + public static boolean portableNodeResarch; + public static boolean electricHoeGrowthResearch; + public static boolean chargeFocusResearch; + + public static String CATEGORY_RESEARCH = "Research"; + public static String CATEGORY_VALUES = "Numeric Values"; + + public static void create(FMLPreInitializationEvent event) { + Configuration config = new Configuration(event.getSuggestedConfigurationFile()); + config.addCustomCategoryComment(CATEGORY_VALUES, "The only way to change some numbers that my machines uses."); + config.addCustomCategoryComment(CATEGORY_RESEARCH, "The only way to disable some researches. " + "Be careful, if you disable some researches, " + "all researches linked to it will be removed too. " + "Really, don't touch that unless you know exactly what you are doing."); + + config.load(); + + // Random Booleans + capesOn = config.get(Configuration.CATEGORY_GENERAL, "Enable showing capes", true, "This config option is to enable or disable capes for people who have them. " + "Seriously, you shouldn't touch that unless you have another cape and " + "it conflicts with it.").getBoolean(capesOn); + + toolsInBore = config.get(Configuration.CATEGORY_GENERAL, "Making the tools worth begin used in the Arcane Bore.", false, "This will augment the durablilty of the tools, and will also decrease the EU cost to 1. " + "The tools should have the same number of uses than before.").getBoolean(toolsInBore); + + nightVisionOff = config.get(Configuration.CATEGORY_GENERAL, "Disable totally the nightvision ability of the Nanosuit Googles of Revealing, " + "Quantum Googles of Revealing and of the Quantum Solar Helmet of Revealing", false).getBoolean(nightVisionOff); + + enchanting = config.get(Configuration.CATEGORY_GENERAL, "Disable the enchanting of my items. " + "Even if on, it will not make them be able to use the repair enchant! " + "This is disabled by default", true).getBoolean(enchanting); + smoke = config.get(Configuration.CATEGORY_GENERAL, "Disable the smoke effect for the Electric/Nano/Quantum Boots of the Traveller", false).getBoolean(smoke); + + // Item IDs + thaumiumDrillID = config.getItem("Thaumium Drill", 4000).getInt(); + thaumiumChainsawID = config.getItem("Thaumium Chainsaw", 4001).getInt(); + quantumThaumicHelmetID = config.getItem("Quantum Goggles of Revealing", 4002).getInt(); + diamondChainsawID = config.getItem("Diamond Chainsaw", 4003).getInt(); + ironOmnitoolID = config.getItem("Iron Omnitool", 4004).getInt(); + diamondOmnitoolID = config.getItem("Diamond Omnitool", 4005).getInt(); + thaumiumOmnitoolID = config.getItem("Thaumium Omnitool", 4006).getInt(); + nanoThaumicHelmetID = config.getItem("Nanosuit Goggles of Revealing", 4007).getInt(); + explosionFocusID = config.getItem("Explosion Focus", 4008).getInt(); + christmasFocusID = config.getItem("Kris-tmas Focus", 4009).getInt(); + shieldFocusID = config.getItem("Shield Focus", 4010).getInt(); + electricGogglesID = config.getItem("Electric Goggles of Revealing", 4011).getInt(); + streamChainsawID = config.getItem("Chainsaw of the Stream", 4012).getInt(); + rockbreakerDrillID = config.getItem("Drill of the Rockbreaker", 4013).getInt(); + thaumiumPlateID = config.getItem("Thauium Plate", 4014).getInt(); + solarHelmetRevealingID = config.getItem("Solar Helmet of Revealing", 4015).getInt(); + thorHammerID = config.getItem("Mjolnir", 4016).getInt(); + taintedThorHammerID = config.getItem("Broken Relic of Mjolnir", 4017).getInt(); + lightningSummonerID = config.getItem("Lightning Summoner", 4018).getInt(); + electricThorHammerID = config.getItem("Supercharged Mjolnir", 4020).getInt(); + electricBootsTravellerID = config.getItem("Electric Boots of the Traveller", 4021).getInt(); + nanoBootsTravellerID = config.getItem("Nano Boots of the Traveller", 4022).getInt(); + quantumBootsTravellerID = config.getItem("Quantum Boots of the Traveller", 4023).getInt(); + electricScribingToolsID = config.getItem("Electric Scribing Tools", 4024).getInt(); + itemEMTItemID = config.getItem("EMT Items", 4025).getInt(); + electricHoeGrowthID = config.getItem("Electric Hoe of Growth", 4026).getInt(); + chargeFocusID = config.getItem("Wand Focus: Charge", 4027).getInt(); + + // Block IDs + + essentiaGensID = config.getBlock("Essentia Generators", 1500).getInt(); + shieldID = config.getBlock("Shield", 1501).getInt(); + emtMachinesID = config.getBlock("EMT Machines", 1502).getInt(); + emtSolarsID = config.getBlock("EMT Solars", 1503).getInt(); + emtSolars2ID = config.getBlock("EMT Solars 2", 1504).getInt(); + portableNodeID = config.getBlock("Portable Node", 1505).getInt(); + + // EU Yield/Consumption modifier + potentiaGenOutput = config.get("Numeric Values", "Potentia Generator EU Output", 3500, "This is the number you have to modify if you want to make the Potentia Generator yield " + "more or less EU per unit of essentia.").getDouble(potentiaGenOutput); + + arborGenOutput = config.get("Numeric Values", "Arbor Generator EU Output", 325, "This is the number you have to modify if you want to make the Arbor Generator yield " + "more or less EU per unit of essentia.").getDouble(arborGenOutput); + + auramGenOutput = config.get("Numeric Values", "Auram Generator EU Output", 3200, "This is the number you have to modify if you want to make the Auram Generator yield " + "more or less EU per unit of essentia.").getDouble(auramGenOutput); + + ignisGenOutput = config.get("Numeric Values", "Ignis Generator EU Output", 3200, "This is the number you have to modify if you want to make the Ignis Generator yield " + "more or less EU per unit of essentia.").getDouble(ignisGenOutput); + + saxumGenOutput = config.get("Numeric Values", "Saxum Generator Output", 350, "This is the number you have to modify if you want to make the Saxum Generator yield " + "more or less EU per unit of essentia.").getDouble(saxumGenOutput); + + wandChargerConsumption = config.get("Numeric Values", "Industrial Wand Charging Station EU Consumption", 50000, "This is the number you have to modify if you want to make the Industrial Wand Charging " + "Station use more or less EU to charge 1 unit of Vis on your wand.").getDouble(wandChargerConsumption); + + compressedSolarOutput = config.get("Numeric Values", "Compressed Solar Panel EU Output", 10, "This is the number you have to modify if you want to make the Compressed Solar Panel yield " + "more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(compressedSolarOutput); + + doubleCompressedSolarOutput = config.get("Numeric Values", "Double Compressed Solar Panel EU Output", 100, "This is the number you have to modify if you want to make the Double Compressed Solar Panel " + "yield more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(doubleCompressedSolarOutput); + + tripleCompressedSolarOutput = config.get("Numeric Values", "Triple Compressed Solar Panel EU Output", 1000, "This is the number you have to modify if you want to make the Triple Compressed Solar Panel " + "yield more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(tripleCompressedSolarOutput); + + essentiaGeneratorsDelay = config.get("Numeric Values", "Essentia Generators draw rate", 120, "The number of ticks the Essentia Generators wait before using 2 Essentia. " + "If you want them to be slower, increase the number.").getInt(essentiaGeneratorsDelay); + + nanoBootsSpeed = config.get("Numeric Values", "Speed of the Nano Boots of the Traveller", 0.25, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsSpeed); + + quantumBootsSpeed = config.get("Numeric Values", "Speed of the Quantum Boots of the Traveller", 0.5, "Watch out, that goes up REALLY quickly.").getDouble(quantumBootsSpeed); + + nanoBootsJump = config.get("Numeric Values", "Jump height for the Nano Boots of the Traveller", 0.6, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsJump); + + quantumBootsJump = config.get("Numeric Values", "Jump height for the Quantum Boots of the Traveller", 0.9, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsJump); + + etherealProcessorBaseSpeed = config.get("Numeric Values", "Base Time the Etheral Processor takes to process a single item in number of ticks.", 400).getInt(); + + etherealProcessorBonus = config.get("Numeric Values", "Ethereal Processor Bonus", 10, "This number is the chance of getting a Thaumium Ingot as a bonus when " + "processing an item in the machine. It is 1 out of the number you will enter. " + "The default is 1/10 chance.").getInt(); + + chargeFocusProduction = config.get("Numeric Values", "Wand Focus: Charge production in EU/T", 64).getInt(); + + // Disable Researches + thaumiumDrillResearch = config.get("Research", "Thaumium Drill", false).getBoolean(thaumiumDrillResearch); + + thaumiumChainsawResearch = config.get("Research", "Thaumium Chainsaw", false).getBoolean(thaumiumChainsawResearch); + + thaumiumDrillResearch = config.get("Research", "Thaumium Omnitool", false).getBoolean(thaumiumOmnitoolResearch); + + rockbreakerDrillResearch = config.get("Research", "Drill of the Rockbreaker", false).getBoolean(rockbreakerDrillResearch); + + streamChainsawResearch = config.get("Research", "Chainsaw of the Stream", false).getBoolean(streamChainsawResearch); + + electricGooglesResearch = config.get("Research", "Electric Googles of Revealing", false).getBoolean(electricGooglesResearch); + + nanoGooglesResearch = config.get("Research", "Nanosuit Googles of Revealing", false).getBoolean(nanoGooglesResearch); + + quantumGooglesResearch = config.get("Research", "Quantum Googles of Revealing", false).getBoolean(quantumGooglesResearch); + + ironOmnitoolResearch = config.get("Research", "Omnitool", false).getBoolean(ironOmnitoolResearch); + + diamondOmnitoolResearch = config.get("Research", "Diamond Omnitool", false).getBoolean(diamondOmnitoolResearch); + + explosionFocusResearch = config.get("Research", "Explosion Focus", false).getBoolean(explosionFocusResearch); + + christmasFocusResearch = config.get("Research", "Kris-tmas Focus", false).getBoolean(christmasFocusResearch); + + shieldFocusResearch = config.get("Research", "Shield Focus", false).getBoolean(shieldFocusResearch); + + shieldBlockResearch = config.get("Research", "Shield Block", false).getBoolean(shieldBlockResearch); + + potentiaGeneratorResearch = config.get("Research", "Potentia Generator", false).getBoolean(potentiaGeneratorResearch); + + ignisGeneratorResearch = config.get("Research", "Ignis Generator", false).getBoolean(ignisGeneratorResearch); + + auramGeneratorResearch = config.get("Research", "Auram Generator", false).getBoolean(auramGeneratorResearch); + + arborGeneratorResearch = config.get("Research", "Arbor Generator", false).getBoolean(arborGeneratorResearch); + + wandChargingSationResearch = config.get("Research", "Industrial Wand Charging Station", false).getBoolean(wandChargingSationResearch); + + tinyUraniumResearch = config.get("Research", "Tiny Piles of Uranium", false).getBoolean(tinyUraniumResearch); + + thorHammerResearch = config.get("Research", "Mjolnir", false).getBoolean(thorHammerResearch); + + superchargedThorHammerResearch = config.get("Research", "Supercharged Mjolnir", false).getBoolean(superchargedThorHammerResearch); + + compressedSolarsResearch = config.get("Research", "Compressed Solars", false).getBoolean(compressedSolarsResearch); + + solarHelmetResearch = config.get("Research", "Solar Helmet of Revealing", false).getBoolean(solarHelmetResearch); + + electricBootsResearch = config.get("Research", "Electric Boots of the Traveller", false).getBoolean(electricBootsResearch); + + nanoBootsResearch = config.get("Research", "Nano Boots of the Traveller", false).getBoolean(nanoBootsResearch); + + quantumBootsResearch = config.get("Research", "Quantum Boots of the Traveller", false).getBoolean(quantumBootsResearch); + + electricScribingToolsResearch = config.get("Research", "Electric Scribing Tools", false).getBoolean(electricScribingToolsResearch); + + etherealProcessorResearch = config.get("Research", "Ethereal Processor", false).getBoolean(etherealProcessorResearch); + + waterSolarsResearch = config.get("Research", "Water Solar Panels", false).getBoolean(waterSolarsResearch); + + darkSolarsResearch = config.get("Research", "Entropy Solar Panels", false).getBoolean(darkSolarsResearch); + + orderSolarsResearch = config.get("Research", "Order Solar Panels", false).getBoolean(orderSolarsResearch); + + fireSolarsResearch = config.get("Research", "Fire Solar Panels", false).getBoolean(fireSolarsResearch); + + airSolarsResearch = config.get("Research", "Air Solar Panels", false).getBoolean(airSolarsResearch); + + earthSolarsResearch = config.get("Research", "Earth Solar Panels", false).getBoolean(earthSolarsResearch); + + saxumGenResearch = config.get("Research", "Saxum Generator", false).getBoolean(saxumGenResearch); + + uuMInfusionResearch = config.get("Research", "UU-Mater Infusion", false).getBoolean(uuMInfusionResearch); + + portableNodeResarch = config.get("Research", "Portable Node", false).getBoolean(portableNodeResarch); + + electricHoeGrowthResearch = config.get("Research", "Electric Hoe of Growth", false).getBoolean(electricHoeGrowthResearch); + + chargeFocusResearch = config.get("Research", "Wand Focus: Charging", false).getBoolean(chargeFocusResearch); + + config.save(); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/CreativeTab.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/CreativeTab.java new file mode 100644 index 0000000..83fd246 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/CreativeTab.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.registry.LanguageRegistry; + +public class CreativeTab +{ + + public static void load() { + LanguageRegistry.instance().addStringLocalization("itemGroup.tabTombenpotter", "en_US", "Electro-Magic Tools"); + } + + public static CreativeTabs tabTombenpotter = new CreativeTabs("tabTombenpotter") + { + public ItemStack getIconItemStack() { + return new ItemStack(ItemRegistry.thaumiumDrill); + } + }; +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTCraftingHandler.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTCraftingHandler.java new file mode 100644 index 0000000..4fbe4b2 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTCraftingHandler.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; +import cpw.mods.fml.common.ICraftingHandler; + +public class EMTCraftingHandler implements ICraftingHandler +{ + + @SuppressWarnings("unused") + @Override + public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) { + + ItemStack taintedhammer = new ItemStack(ItemRegistry.taintedThorHammer).copy(); + + for (int i = 0; i < craftMatrix.getSizeInventory(); i++) + { + if (craftMatrix.getStackInSlot(i) != null) + { + ItemStack itemstack = craftMatrix.getStackInSlot(i); + if ((itemstack != null) && (itemstack.itemID == new ItemStack(ItemRegistry.taintedThorHammer, 1, OreDictionary.WILDCARD_VALUE).itemID)) + { + ItemStack newitemstack = new ItemStack(ItemRegistry.taintedThorHammer, 2, itemstack.getItemDamage() + 1); + if (newitemstack.getItemDamage() >= newitemstack.getMaxDamage()) + { + newitemstack.stackSize -= 1; + } + craftMatrix.setInventorySlotContents(i, newitemstack); + break; + } + } + } + + for (int i = 0; i < craftMatrix.getSizeInventory(); i++) + { + if (craftMatrix.getStackInSlot(i) != null) + { + ItemStack itemstack = craftMatrix.getStackInSlot(i); + if ((itemstack != null) && (itemstack.itemID == new ItemStack(ItemRegistry.thorHammer, 1, OreDictionary.WILDCARD_VALUE).itemID)) + { + ItemStack newitemstack = new ItemStack(ItemRegistry.thorHammer, 2, itemstack.getItemDamage() + 1); + if (newitemstack.getItemDamage() >= newitemstack.getMaxDamage()) + { + newitemstack.stackSize -= 1; + } + craftMatrix.setInventorySlotContents(i, newitemstack); + break; + } + } + } + + for (int i = 0; i < craftMatrix.getSizeInventory(); i++) + { + if (craftMatrix.getStackInSlot(i) != null) + { + ItemStack itemstack = craftMatrix.getStackInSlot(i); + if ((itemstack != null) && (itemstack.itemID == new ItemStack(ItemRegistry.electricThorHammer, 1, OreDictionary.WILDCARD_VALUE).itemID)) + { + ItemStack newitemstack = new ItemStack(ItemRegistry.electricThorHammer, 2, itemstack.getItemDamage() + 1); + if (newitemstack.getItemDamage() >= newitemstack.getMaxDamage()) + { + newitemstack.stackSize -= 1; + } + craftMatrix.setInventorySlotContents(i, newitemstack); + break; + } + } + } + } + + @Override + public void onSmelting(EntityPlayer player, ItemStack item) { + } + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTEntityRegistry.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTEntityRegistry.java new file mode 100644 index 0000000..f61abb7 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTEntityRegistry.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityEggInfo; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.entities.EntityArcher; +import electricMagicTools.tombenpotter.electricmagictools.common.entities.EntityLaser; + +public class EMTEntityRegistry +{ + + private static int startEID = 300; + private static int entityIDs = 0; + private static final Class ARCHER_CLASS = EntityArcher.class; + + private static int getUniqueEntityID() { + + do + { + startEID++; + } while (EntityList.getStringFromID(startEID) != null); + return startEID; + } + + @SuppressWarnings("unchecked") + public static void registerEntityEgg(Class entity, int colPrim, int colSec) { + int id = getUniqueEntityID(); + EntityList.IDtoClassMapping.put(id, entity); + EntityList.entityEggs.put(id, new EntityEggInfo(id, colPrim, colSec)); + return; + } + + public static void registerEMTEntities() { + + EntityRegistry.registerModEntity(EntityLaser.class, "entityLaser", entityIDs++, ElectricMagicTools.instance, 80, 3, true); + LanguageRegistry.instance().addStringLocalization("entity.Tombenpotter's Electro-Magic Tools.entityLaser.name", "Laser"); + EntityRegistry.registerModEntity(EntityArcher.class, "entityArcher", entityIDs++, ElectricMagicTools.instance, 80, 3, true); + LanguageRegistry.instance().addStringLocalization("entity.Tombenpotter's Electro-Magic Tools.entityArcher.name", "Guardian Snowman"); + + registerEntityEgg(ARCHER_CLASS, 0x99111F, 0xE5685); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTResearchItem.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTResearchItem.java new file mode 100644 index 0000000..28d1131 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EMTResearchItem.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + * + * Attention: this class originally belongs to the ThaumicTinkerer mod. + * All I did was modifying it to fulfill my needs. + * + * ThaumicTinkerer is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * http://www.minecraftforum.net/topic/1813058- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.research.ResearchItem; +import thaumcraft.api.research.ResearchPage; +import thaumcraft.api.research.ResearchPage.PageType; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class EMTResearchItem extends ResearchItem +{ + + public EMTResearchItem(String par1, String par2) + { + super(par1, par2); + } + + public EMTResearchItem(String par1, String par2, AspectList tags, int par3, int par4, int par5, ItemStack icon) + { + super(par1, par2, tags, par3, par4, par5, icon); + } + + public EMTResearchItem(String par1, String par2, AspectList tags, int par3, int par4, int par5, ResourceLocation icon) + { + super(par1, par2, tags, par3, par4, par5, icon); + } + + @Override + @SideOnly(Side.CLIENT) + public String getName() { + return StatCollector.translateToLocal(key); + } + + @Override + @SideOnly(Side.CLIENT) + public String getText() { + return StatCollector.translateToLocal("[EMT] ") + StatCollector.translateToLocal("emt.tag." + key); + } + + @Override + public ResearchItem setPages(ResearchPage... par) { + for (ResearchPage page : par) + { + if (page.type == PageType.TEXT) + page.text = "emt.text." + key; + + if (page.type == PageType.INFUSION_CRAFTING) + { + if (parentsHidden == null || parentsHidden.length == 0) + parentsHidden = new String[] { "INFUSION" }; + else + { + String[] newParents = new String[parentsHidden.length + 1]; + newParents[0] = "INFUSION"; + for (int i = 0; i < parentsHidden.length; i++) + newParents[i + 1] = parentsHidden[i]; + parentsHidden = newParents; + } + } + } + + return super.setPages(par); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ElectricMagicTools.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ElectricMagicTools.java new file mode 100644 index 0000000..26fdfcb --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ElectricMagicTools.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.MinecraftForge; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.SidedProxy; +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.NetworkMod; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; +import electricMagicTools.tombenpotter.electricmagictools.client.CapeEventHandler; +import electricMagicTools.tombenpotter.electricmagictools.common.recipes.EMTInitRecipes; +import electricMagicTools.tombenpotter.electricmagictools.common.recipes.EMTPostInitRecipes; +import electricMagicTools.tombenpotter.electricmagictools.common.recipes.UuMInfusionRecipes; + +@Mod(modid = ElectricMagicTools.modid, name = "Electro-Magic Tools", version = "1.0.9", dependencies = "required-after:Thaumcraft ; required-after:IC2") +@NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = { ElectricMagicTools.modid }) +public class ElectricMagicTools +{ + + @SidedProxy(clientSide = "electricMagicTools.tombenpotter.electricmagictools.client.ClientProxy", serverSide = "electricMagicTools.tombenpotter.electricmagictools.common.CommonProxy") + public static CommonProxy proxy; + @Instance(ElectricMagicTools.modid) + public static ElectricMagicTools instance; + + public static final String modid = "Tombenpotter's Electro-Magic Tools"; + + @EventHandler + public void preInit(FMLPreInitializationEvent event) { + /** Creating the config file **/ + Config.create(event); + + /** Registering the custom crafting handler --- UNUSED FOR NOW **/ + // GameRegistry.registerCraftingHandler(new EMTCraftingHandler()); + + System.out.println("[EMT] Electro-Magic Tools : Successful PreInit"); + } + + @EventHandler + public void load(FMLInitializationEvent event) { + /** Loading the proxies **/ + proxy.load(); + + /** Making mobs drop additional items **/ + MinecraftForge.EVENT_BUS.register(new EntityLivingHandler()); + + /** Making Creative Tab **/ + CreativeTab.load(); + + /** Items Registry **/ + ItemRegistry.registerEMTItems(); + + /** Blocks registry **/ + BlockRegistry.registerEMTBlocks(); + + /** Tile entities registry **/ + TileEntityRegistry.registerEMTTileEntites(); + + /** Generating in dungeon chests **/ + if (Config.thorHammerResearch == false) + { + ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ItemRegistry.taintedThorHammer), 1, 1, 5)); + } + + /** Adding the recipes that go in Init **/ + EMTInitRecipes.add(); + + /** Entities Registry **/ + EMTEntityRegistry.registerEMTEntities(); + + /** GUI Handler Registry **/ + NetworkRegistry.instance().registerGuiHandler(this, proxy); + + /** Adds Capes **/ + if (event.getSide() == Side.CLIENT && Config.capesOn == true) + { + MinecraftForge.EVENT_BUS.register(new CapeEventHandler()); + } + + System.out.println("[EMT] Electro-Magic Tools : Successful Init"); + } + + @EventHandler + public void postInit(FMLPostInitializationEvent event) { + /** Adding the recipes that go in PostInit **/ + EMTPostInitRecipes.add(); + + /** Adding the UU-Matter Infusion recipes **/ + UuMInfusionRecipes.add(); + + /** Adding the EMT research tab to the Thaumonomicon **/ + ThaumonomiconResearch.addResearchTab(); + + /** Adding the actual research to the game **/ + ThaumonomiconResearch.addResearch(); + + System.out.println("[EMT] Electro-Magic Tools : Successful PostInit"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EntityLivingHandler.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EntityLivingHandler.java new file mode 100644 index 0000000..19bbc62 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/EntityLivingHandler.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.living.LivingDeathEvent; + +public class EntityLivingHandler +{ + + @ForgeSubscribe + public void onEntityLivingDeath(LivingDeathEvent event) { + if (event.entityLiving instanceof EntityCreeper) + { + EntityCreeper creeper = (EntityCreeper) event.entityLiving; + if (creeper.getPowered()) + { + event.entityLiving.dropItem(ItemRegistry.lightningSummoner.itemID, 1); + } + } + } + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ItemRegistry.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ItemRegistry.java new file mode 100644 index 0000000..bebf7b7 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ItemRegistry.java @@ -0,0 +1,137 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.registry.LanguageRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.items.ItemEMTItems; +import electricMagicTools.tombenpotter.electricmagictools.common.items.ItemElectricScribingTools; +import electricMagicTools.tombenpotter.electricmagictools.common.items.ItemLightningSummoner; +import electricMagicTools.tombenpotter.electricmagictools.common.items.ItemThaumiumPlate; +import electricMagicTools.tombenpotter.electricmagictools.common.items.armor.ItemElectricBootsTraveller; +import electricMagicTools.tombenpotter.electricmagictools.common.items.armor.ItemElectricGoggles; +import electricMagicTools.tombenpotter.electricmagictools.common.items.armor.ItemNanoBootsTraveller; +import electricMagicTools.tombenpotter.electricmagictools.common.items.armor.ItemNanoThaumicHelmet; +import electricMagicTools.tombenpotter.electricmagictools.common.items.armor.ItemQuantumBootsTraveller; +import electricMagicTools.tombenpotter.electricmagictools.common.items.armor.ItemQuantumThaumicHelmet; +import electricMagicTools.tombenpotter.electricmagictools.common.items.armor.ItemSolarHelmetRevealing; +import electricMagicTools.tombenpotter.electricmagictools.common.items.foci.ItemChargeFocus; +import electricMagicTools.tombenpotter.electricmagictools.common.items.foci.ItemChristmasFocus; +import electricMagicTools.tombenpotter.electricmagictools.common.items.foci.ItemExplosionFocus; +import electricMagicTools.tombenpotter.electricmagictools.common.items.foci.ItemShieldFocus; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemDiamondChainsaw; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemElectricHoeGrowth; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemOmnitoolDiamond; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemOmnitoolIron; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemOmnitoolThaumium; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemRockbreakerDrill; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemStreamChainsaw; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemThaumiumChainsaw; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.ItemThaumiumDrill; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.hammer.ItemElectricThorHammer; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.hammer.ItemTaintedThorHammer; +import electricMagicTools.tombenpotter.electricmagictools.common.items.tools.hammer.ItemThorHammer; + +public class ItemRegistry +{ + + public static Item thaumiumDrill; + public static Item thaumiumChainsaw; + public static Item quantumThaumicHelmet; + public static Item diamondChainsaw; + public static Item ironOmnitool; + public static Item diamondOmnitool; + public static Item thaumiumOmnitool; + public static Item nanoThaumicHelmet; + public static Item explosionFocus; + public static Item christmasFocus; + public static Item shieldFocus; + public static Item electricGoggles; + public static Item streamChainsaw; + public static Item rockbreakerDrill; + public static Item thaumiumPlate; + public static Item solarHelmetRevealing; + public static Item thorHammer; + public static Item taintedThorHammer; + public static Item electricThorHammer; + public static Item lightningSummoner; + public static Item electricBootsTraveller; + public static Item quantumBootsTraveller; + public static Item nanoBootsTraveller; + public static Item electricScribingTools; + public static Item itemEMTItems; + public static Item electricHoeGrowth; + public static Item chargeFocus; + + public static void registerEMTItems() { + thaumiumDrill = new ItemThaumiumDrill(Config.thaumiumDrillID).setUnlocalizedName("thaumiumdrill"); + thaumiumChainsaw = new ItemThaumiumChainsaw(Config.thaumiumChainsawID).setUnlocalizedName("thaumiumchainsaw"); + quantumThaumicHelmet = new ItemQuantumThaumicHelmet(Config.quantumThaumicHelmetID, 3, 0).setUnlocalizedName("quantumthaumichelmet"); + diamondChainsaw = new ItemDiamondChainsaw(Config.diamondChainsawID).setUnlocalizedName("diamondchainsaw"); + ironOmnitool = new ItemOmnitoolIron(Config.ironOmnitoolID).setUnlocalizedName("ironomnitool"); + diamondOmnitool = new ItemOmnitoolDiamond(Config.diamondOmnitoolID).setUnlocalizedName("diamondomnitool"); + thaumiumOmnitool = new ItemOmnitoolThaumium(Config.thaumiumOmnitoolID).setUnlocalizedName("thaumiumomnitool"); + nanoThaumicHelmet = new ItemNanoThaumicHelmet(Config.nanoThaumicHelmetID, 3, 0).setUnlocalizedName("nanothaumichelmet"); + explosionFocus = new ItemExplosionFocus(Config.explosionFocusID).setUnlocalizedName("laserfocus"); + christmasFocus = new ItemChristmasFocus(Config.christmasFocusID).setUnlocalizedName("christmasfocus"); + shieldFocus = new ItemShieldFocus(Config.shieldFocusID).setUnlocalizedName("shieldfocus"); + electricGoggles = new ItemElectricGoggles(Config.electricGogglesID, 3, 0).setUnlocalizedName("electricgoggles"); + streamChainsaw = new ItemStreamChainsaw(Config.streamChainsawID).setUnlocalizedName("streamchainsaw"); + rockbreakerDrill = new ItemRockbreakerDrill(Config.rockbreakerDrillID).setUnlocalizedName("rockbreakerdrill"); + thaumiumPlate = new ItemThaumiumPlate(Config.thaumiumPlateID).setUnlocalizedName("thaumiumplate"); + solarHelmetRevealing = new ItemSolarHelmetRevealing(Config.solarHelmetRevealingID, 3, 0).setUnlocalizedName("solarhelmetrevealing"); + thorHammer = new ItemThorHammer(Config.thorHammerID).setUnlocalizedName("hammerthor"); + taintedThorHammer = new ItemTaintedThorHammer(Config.taintedThorHammerID).setUnlocalizedName("taintedthorhammer"); + lightningSummoner = new ItemLightningSummoner(Config.lightningSummonerID).setUnlocalizedName("lightningsummoner"); + electricThorHammer = new ItemElectricThorHammer(Config.electricThorHammerID).setUnlocalizedName("electricthorhammer"); + electricBootsTraveller = new ItemElectricBootsTraveller(Config.electricBootsTravellerID, 3, 3).setUnlocalizedName("electricboots"); + nanoBootsTraveller = new ItemNanoBootsTraveller(Config.nanoBootsTravellerID, 3, 3).setUnlocalizedName("nanobootstraveller"); + quantumBootsTraveller = new ItemQuantumBootsTraveller(Config.quantumBootsTravellerID, 3, 3).setUnlocalizedName("quantumbootstraveller"); + electricScribingTools = new ItemElectricScribingTools(Config.electricScribingToolsID).setUnlocalizedName("electricscribingtools"); + itemEMTItems = new ItemEMTItems(Config.itemEMTItemID).setUnlocalizedName("itememtitems"); + electricHoeGrowth = new ItemElectricHoeGrowth(Config.electricHoeGrowthID).setUnlocalizedName("electrichoeofgrowth"); + chargeFocus = new ItemChargeFocus(Config.chargeFocusID).setUnlocalizedName("chargefocus"); + + LanguageRegistry.addName(thaumiumDrill, "Thaumium Drill"); + LanguageRegistry.addName(thaumiumChainsaw, "Thaumium Chainsaw"); + LanguageRegistry.addName(quantumThaumicHelmet, "Quantum Goggles of Revealing"); + LanguageRegistry.addName(diamondChainsaw, "Diamond Chainsaw"); + LanguageRegistry.addName(ironOmnitool, "Omnitool"); + LanguageRegistry.addName(diamondOmnitool, "Diamond Omnitool"); + LanguageRegistry.addName(thaumiumOmnitool, "Thaumium Omnitool"); + LanguageRegistry.addName(nanoThaumicHelmet, "Nanosuit Goggles of Revealing"); + LanguageRegistry.addName(explosionFocus, "Wand Focus: Explosion"); + LanguageRegistry.addName(christmasFocus, "Wand Focus : Kris-tmas"); + LanguageRegistry.addName(shieldFocus, "Wand Focus : Shield"); + LanguageRegistry.addName(electricGoggles, "Electric Goggles of Revealing"); + LanguageRegistry.addName(streamChainsaw, "Chainsaw of the Stream"); + LanguageRegistry.addName(rockbreakerDrill, "Drill of the Rockbreaker"); + LanguageRegistry.addName(thaumiumPlate, "Thaumium Plate"); + LanguageRegistry.addName(solarHelmetRevealing, "Quantum Solar Helmet of Revealing"); + LanguageRegistry.addName(thorHammer, "Mjolnir"); + LanguageRegistry.addName(taintedThorHammer, "Broken Relic of Mjolnir"); + LanguageRegistry.addName(lightningSummoner, "Lightning Summoner"); + LanguageRegistry.addName(electricThorHammer, "Supercharged Mjolnir"); + LanguageRegistry.addName(electricBootsTraveller, "Electric Boots of the Traveller"); + LanguageRegistry.addName(nanoBootsTraveller, "Nano Boots of the Traveller"); + LanguageRegistry.addName(quantumBootsTraveller, "Quantum Boots of the Traveller"); + LanguageRegistry.addName(electricScribingTools, "Electric Scribing Tools"); + LanguageRegistry.addName(electricHoeGrowth, "Electric Hoe of Growth"); + LanguageRegistry.addName(chargeFocus, "Wand Focus: Charging"); + LanguageRegistry.addName(new ItemStack(itemEMTItems, 1, 0), "Native Uranium Cluster"); + LanguageRegistry.addName(new ItemStack(itemEMTItems, 1, 1), "Crushed Amber Ore"); + LanguageRegistry.addName(new ItemStack(itemEMTItems, 1, 2), "Purified Crushed Amber Ore"); + LanguageRegistry.addName(new ItemStack(itemEMTItems, 1, 3), "Crushed Cinnabar Ore"); + LanguageRegistry.addName(new ItemStack(itemEMTItems, 1, 4), "Purified Crushed Cinnabar Ore"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/State of things.txt b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/State of things.txt new file mode 100644 index 0000000..87adee6 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/State of things.txt @@ -0,0 +1,57 @@ +#------------------------------------------------------------------------------- +# Copyright (c) 2014 Tombenpotter. +# All rights reserved. +# +# This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 +# which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html +# +# This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. +# Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. +# http://www.minecraftforum.net/topic/1585216- +#------------------------------------------------------------------------------- +This .txt file is here so that I don't randomly forget to add stuff where it is needed. +Anyone that's not a modder or didn't come here on purpose just has to ignore that. +Consider this as a TODO list, that also register what's been done. + + +Items---------------------------------------------------------------------------------------------------- + +Thaumium Drill: Item is functional-Research is done +Thaumium Chainsaw: Item is functional-Research is done +Quantum Goggles of Revealing: Item is functional-Research is done +Diamond Chainsaw: Item is functional-Research is done +Omnitool: Item is functional-Research is done +Diamond Omnitool: Item is functional-Research is done +Thaumium Omnitool: Item is functional-Research is done +Nanosuit Goggles of Revealing: Item is functional-Research is done +Wand Focus: Explosion: Item is functional, but need to be ameliorated-Research is done +Wand Focus : Kris-tmas: Item is functional-Research is done +Wand Focus : Shield: Item is functional-Research is done +Electric Goggles of Revealing: Item is functional-Research is done +Chainsaw of the Stream: Item is functional-Research is done +Drill of the Rockbreaker: Item is functional-Research is done +Thaumium Plate: Item is functional (it does nothing)-Research is done +Quantum Solar Helmet of Revealing: Item is functional-Research is done +Mjolnir: Item is functional-Research is done +Broken Relic of Mjolnir: Item is functional-Research is done +Lightning Summoner: Item is functional-Research is done +Supercharged Mjolnir: Item is functional-Research is done +Electric Boots of the Traveller: Item is fully functional-Research is done +Nanosuit Boots of the Traveller: Item is fully functional-Research is done +Quantum Boots of the Traveller: Item is fully functional-Research is done + +Blocks--------------------------------------------------------------------------------------------------- +Potentia Generator: Block is functional-Research is done +Shield Block: Block is functional, but doesn't resist to a wither-Research is done +Ignis Generator: Block is functional-Research is done +Auram Generator: Block is functional-Research is done +Arbor Generator: Block is functional-Research is done +Industrial Wand Charging Station: Block is functional-Research is done +Compressed Solar Panel: Block is functional-Research is done +Double Compressed Solar Panel: Block is functional-Research is done +Ethereal Macerator : Block is functional-Research is done-Need to add a way to speed it up with essentia + +Entities------------------------------------------------------------------------------------------------- + +Laser: An explosion is created on landing-Texture/Model is all good +Guardian Snowman: Texture is all good diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ThaumonomiconResearch.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ThaumonomiconResearch.java new file mode 100644 index 0000000..861b1b5 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/ThaumonomiconResearch.java @@ -0,0 +1,418 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import ic2.api.item.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.research.ResearchCategories; +import thaumcraft.api.research.ResearchItem; +import thaumcraft.api.research.ResearchPage; +import cpw.mods.fml.common.registry.LanguageRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.lib.ResearchAspects; +import electricMagicTools.tombenpotter.electricmagictools.common.recipes.EMTInitRecipes; +import electricMagicTools.tombenpotter.electricmagictools.common.recipes.EMTPostInitRecipes; +import electricMagicTools.tombenpotter.electricmagictools.common.recipes.UuMInfusionRecipes; + +public class ThaumonomiconResearch +{ + + public static void addResearchTab() { + ResourceLocation background = new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png"); + ResearchCategories.registerCategory("EMT", new ResourceLocation("electricmagictools:textures/misc/emt.png"), background); + LanguageRegistry.instance().addStringLocalization("tc.research_category.EMT", "Electro-Magic Tools"); + } + + public static void addResearch() { + ResearchItem research; + String text; + // String text2; + + /** Research that can't be disabled **/ + text = "1"; + research = new EMTResearchItem("Electric Magic Tools", "EMT", new AspectList(), 0, 0, 0, new ResourceLocation("electricmagictools:textures/misc/emt.png")).setRound().setAutoUnlock().registerResearchItem(); + research.setPages(new ResearchPage(text)); + + text = "1"; + research = new EMTResearchItem("Diamond Chainsaw", "EMT", new AspectList(), 5, -6, 0, new ItemStack(ItemRegistry.diamondChainsaw)).setRound().setAutoUnlock().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTInitRecipes.diamondChainsaw)); + + text = "1"; + research = new EMTResearchItem("Thaumium Plate", "EMT", new AspectList(), 6, -6, 0, new ItemStack(ItemRegistry.thaumiumPlate)).setRound().setAutoUnlock().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.thaumiumPlate)); + + text = "1"; + research = new EMTResearchItem("Macerating Native Ore Clusters", "EMT", new AspectList(), 5, -7, 0, Items.getItem("smallGoldDust")).setRound().setAutoUnlock().registerResearchItem(); + research.setPages(new ResearchPage(text)); + + text = "1"; + research = new EMTResearchItem("The Legend", "EMT", new AspectList(), 5, -5, 0, new ItemStack(ItemRegistry.taintedThorHammer)).setRound().setAutoUnlock().registerResearchItem(); + research.setPages(new ResearchPage(text)); + + text = "1"; + research = new EMTResearchItem("Lightning Summoner", "EMT", new AspectList(), 6, -5, 0, new ItemStack(ItemRegistry.lightningSummoner)).setRound().setAutoUnlock().registerResearchItem(); + research.setPages(new ResearchPage(text)); + + /** Research that can be disabled **/ + if (Config.thaumiumDrillResearch == false) + { + text = "1"; + research = new EMTResearchItem("Thaumium Drill", "EMT", ResearchAspects.thaumiumDrillResearch, -1, -2, 1, new ItemStack(ItemRegistry.thaumiumDrill)).setSecondary().setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.thaumiumDrill)); + } + + if (Config.thaumiumChainsawResearch == false) + { + text = "1"; + research = new EMTResearchItem("Thaumium Chainsaw", "EMT", ResearchAspects.thaumiumChainsawResearch, -2, -2, 1, new ItemStack(ItemRegistry.thaumiumChainsaw)).setSecondary().setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.thaumiumChainsaw)); + } + + if (Config.electricGooglesResearch == false) + { + text = "1"; + research = new EMTResearchItem("Electric Goggles", "EMT", ResearchAspects.electricGogglesResearch, 1, -2, 1, new ItemStack(ItemRegistry.electricGoggles)).setSecondary().setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.electricGoggles)); + } + + if (Config.electricGooglesResearch == false) + { + if (Config.nanoGooglesResearch == false) + { + text = "1"; + research = new EMTResearchItem("Nanosuit Goggles of Revealing", "EMT", ResearchAspects.thaumicNanoHelmet, 2, -2, 2, new ItemStack(ItemRegistry.nanoThaumicHelmet)).setParents("Electric Goggles").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.thaumicNanoHelmet)); + } + } + + if (Config.electricGooglesResearch == false) + { + if (Config.nanoGooglesResearch == false) + { + if (Config.quantumGooglesResearch == false) + { + text = "1"; + research = new EMTResearchItem("Quantum Goggles of Revealing", "EMT", ResearchAspects.thaumicQuantumHelmet, 3, -2, 3, new ItemStack(ItemRegistry.quantumThaumicHelmet)).setParents("Nanosuit Goggles of Revealing").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.thaumicQuantumHelmet)); + } + } + } + + if (Config.ironOmnitoolResearch == false) + { + text = "1"; + research = new EMTResearchItem("Iron Omnitool", "EMT", new AspectList(), -2, 0, 0, new ItemStack(ItemRegistry.ironOmnitool)).setParents("Electric Magic Tools").setRound().setAutoUnlock().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTInitRecipes.ironOmnitool)); + } + + if (Config.ironOmnitoolResearch == false) + { + if (Config.diamondOmnitoolResearch == false) + { + text = "1"; + research = new EMTResearchItem("Diamond Omnitool", "EMT", ResearchAspects.diamondOmnitoolResearch, -4, 0, 1, new ItemStack(ItemRegistry.diamondOmnitool)).setSecondary().setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.diamondOmnitool), new ResearchPage(EMTPostInitRecipes.ironOmnitoolToDiamond)); + } + } + + if (Config.thaumiumDrillResearch == false && Config.thaumiumChainsawResearch == false) + { + if (Config.thaumiumOmnitoolResearch == false) + { + text = "1"; + research = new EMTResearchItem("Thaumium Omnitool", "EMT", ResearchAspects.thaumiumOmnitoolResearch, -6, 0, 2, new ItemStack(ItemRegistry.thaumiumOmnitool)).setParentsHidden("Thaumium Drill", "Thaumium Chainsaw").setParents("Diamond Omnitool").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.thaumiumOmnitool), new ResearchPage(EMTPostInitRecipes.diamondOmnitoolToThaumium)); + } + } + + if (Config.explosionFocusResearch == false) + { + text = "1"; + research = new EMTResearchItem("Explosion Focus", "EMT", ResearchAspects.laserFocusResearch, 2, 3, 2, new ItemStack(ItemRegistry.explosionFocus)).setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.explosionFocus)); + } + + if (Config.christmasFocusResearch == false) + { + text = "1"; + research = new EMTResearchItem("Kris-tmas Focus", "EMT", ResearchAspects.christmasFocusResearch, 3, 3, 1, new ItemStack(ItemRegistry.christmasFocus)).setSecondary().setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.christmasFocus)); + } + + if (Config.shieldFocusResearch == false) + { + text = "1"; + research = new EMTResearchItem("Shield Focus", "EMT", ResearchAspects.shieldFocusResearch, 4, 3, 2, new ItemStack(ItemRegistry.shieldFocus)).setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.shieldFocus)); + } + + if (Config.shieldFocusResearch == false) + { + if (Config.shieldBlockResearch == false) + { + text = "1"; + research = new EMTResearchItem("Shield Block", "EMT", ResearchAspects.shieldBlockResearch, 4, 5, 1, new ItemStack(BlockRegistry.shield)).setSecondary().setParents("Shield Focus").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.shieldBlock)); + } + } + + if (Config.potentiaGeneratorResearch == false) + { + text = "1"; + research = new EMTResearchItem("Potentia Generator", "EMT", ResearchAspects.potentiaGeneratorResearch, -2, 3, 3, new ItemStack(BlockRegistry.essentiaGens, 1, 0)).setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.potentiaGenerator)); + } + + if (Config.potentiaGeneratorResearch == false) + { + if (Config.ignisGeneratorResearch == false) + { + text = "1"; + research = new EMTResearchItem("Ignis Generator", "EMT", ResearchAspects.ignisGeneratorResearch, -3, 4, 1, new ItemStack(BlockRegistry.essentiaGens, 1, 1)).setSecondary().setParents("Potentia Generator").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.ignisGenerator)); + } + } + + if (Config.potentiaGeneratorResearch == false) + { + if (Config.auramGeneratorResearch == false) + { + text = "1"; + research = new EMTResearchItem("Auram Generator", "EMT", ResearchAspects.auramGeneratorResearch, -1, 4, 1, new ItemStack(BlockRegistry.essentiaGens, 1, 2)).setSecondary().setParents("Potentia Generator").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.auramGenerator)); + } + } + + if (Config.potentiaGeneratorResearch == false) + { + if (Config.arborGeneratorResearch == false) + { + text = "1"; + research = new EMTResearchItem("Arbor Generator", "EMT", ResearchAspects.arborGeneratorResearch, -2, 5, 1, new ItemStack(BlockRegistry.essentiaGens, 1, 3)).setSecondary().setParents("Potentia Generator").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.arborGenerator)); + } + } + + // if(Config.potentiaGeneratorResearch == false) { + // if(Config.wandChargingSationResearch = false) { + text = "1"; + research = new EMTResearchItem("Industrial Wand Charging Station", "EMT", ResearchAspects.wandCharger, -4, 2, 3, new ItemStack(BlockRegistry.emtMachines, 1, 0)).setParents("Potentia Generator").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.wandRecharger)); + // } + // } + + if (Config.thaumiumChainsawResearch == false) + { + if (Config.streamChainsawResearch == false) + { + text = "1"; + research = new EMTResearchItem("Chainsaw of the Stream", "EMT", ResearchAspects.streamChainsawResearch, -3, -4, 3, new ItemStack(ItemRegistry.streamChainsaw)).setParents("Thaumium Chainsaw").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.streamChainsaw)); + } + } + + if (Config.thaumiumDrillResearch == false) + { + if (Config.rockbreakerDrillResearch == false) + { + text = "1"; + research = new EMTResearchItem("Drill of the Rockbreaker", "EMT", ResearchAspects.rockbreakerDrillResearch, 0, -4, 3, new ItemStack(ItemRegistry.rockbreakerDrill)).setParents("Thaumium Drill").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.rockbreakerDrill)); + } + } + + if (Config.tinyUraniumResearch == false) + { + text = "1"; + research = new EMTResearchItem("Tiny Uranium", "EMT", ResearchAspects.tinyUraniumResearch, -5, -5, 1, Items.getItem("Uran238")).setSecondary().setParentsHidden("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.tinyUranium)); + } + + if (Config.thorHammerResearch == false) + { + text = "1"; + research = new EMTResearchItem("Mjolnir", "EMT", ResearchAspects.thorHammerResearch, -5, 5, 3, new ItemStack(ItemRegistry.thorHammer)).setParentsHidden("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.thorHammer)); + } + + if (Config.thorHammerResearch == false) + { + if (Config.superchargedThorHammerResearch == false) + { + text = "1"; + research = new EMTResearchItem("Supercharged Mjolnir", "EMT", ResearchAspects.superchargedThorHammerResearch, -6, 6, 3, new ItemStack(ItemRegistry.electricThorHammer)).setParents("Mjolnir").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.superchargedThorHammer)); + } + } + + if (Config.compressedSolarsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Compressed Solars", "EMT", ResearchAspects.compressedSolars, -4, -5, 2, new ItemStack(BlockRegistry.emtSolars)).setParentsHidden("Potentia Generator").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.compressedSolar), new ResearchPage(EMTPostInitRecipes.doubleCompressedSolar), new ResearchPage(EMTPostInitRecipes.tripleCompressedSolar)); + } + + if (Config.compressedSolarsResearch == false) + { + if (Config.solarHelmetResearch == false) + { + text = "1"; + research = new EMTResearchItem("Solar Helmet of Revealing", "EMT", ResearchAspects.solarHelmetRevealing, -2, -5, 1, new ItemStack(ItemRegistry.solarHelmetRevealing)).setSecondary().setParents("Compressed Solars").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.solarHelmetRevealing)); + } + } + + if (Config.electricBootsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Electric Boots of the Traveller", "EMT", ResearchAspects.electricBootsTravel, 2, 0, 1, new ItemStack(ItemRegistry.electricBootsTraveller)).setSecondary().setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.electricBootsTravel)); + } + + if (Config.electricBootsResearch == false) + { + if (Config.nanoBootsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Nano Boots of the Traveller", "EMT", ResearchAspects.nanoBootsTravel, 4, 0, 2, new ItemStack(ItemRegistry.nanoBootsTraveller)).setParents("Electric Boots of the Traveller").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.nanoBootsTravel)); + } + } + + if (Config.electricBootsResearch == false) + { + if (Config.nanoBootsResearch == false) + { + if (Config.quantumBootsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Quantum Boots of the Traveller", "EMT", ResearchAspects.quantumBootsTravel, 6, 0, 3, new ItemStack(ItemRegistry.quantumBootsTraveller)).setParents("Nano Boots of the Traveller").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.quantumBootsTravel)); + } + } + } + + if (Config.electricScribingToolsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Electric Scribing Tools", "EMT", ResearchAspects.electricScribingTools, -6, -5, 1, new ItemStack(ItemRegistry.electricScribingTools)).setSecondary().setParentsHidden("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.electricScribingTools)); + } + + if (Config.etherealProcessorResearch == false) + { + text = "1"; + research = new EMTResearchItem("Etheral Processor", "EMT", ResearchAspects.etherealProcessor, -1, 2, 2, new ItemStack(BlockRegistry.emtMachines, 1, 1)).setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.etheralProcessor)); + } + + if (Config.compressedSolarsResearch == false) + { + if (Config.waterSolarsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Water Infused Solar Panels", "EMT", ResearchAspects.waterSolars, -7, -7, 1, new ItemStack(BlockRegistry.emtSolars, 1, 3)).setSecondary().setParents("Compressed Solars").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.waterSolar), new ResearchPage(EMTPostInitRecipes.doubleWaterSolar), new ResearchPage(EMTPostInitRecipes.tripleWaterSolar)); + + } + } + + if (Config.compressedSolarsResearch == false) + { + if (Config.darkSolarsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Entropy Infused Solar Panels", "EMT", ResearchAspects.darkSolars, -8, -6, 1, new ItemStack(BlockRegistry.emtSolars, 1, 6)).setSecondary().setParents("Compressed Solars").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.darkSolar), new ResearchPage(EMTPostInitRecipes.doubleDarkSolar), new ResearchPage(EMTPostInitRecipes.tripleDarkSolar)); + } + } + + if (Config.compressedSolarsResearch == false) + { + if (Config.orderSolarsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Order Infused Solar Panels", "EMT", ResearchAspects.orderSolars, -6, -8, 1, new ItemStack(BlockRegistry.emtSolars, 1, 9)).setSecondary().setParents("Compressed Solars").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.orderSolar), new ResearchPage(EMTPostInitRecipes.doubleOrderSolar), new ResearchPage(EMTPostInitRecipes.tripleOrderSolar)); + } + } + + if (Config.compressedSolarsResearch == false) + { + if (Config.fireSolarsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Fire Infused Solar Panels", "EMT", ResearchAspects.fireSolars, -5, -7, 1, new ItemStack(BlockRegistry.emtSolars, 1, 12)).setSecondary().setParents("Compressed Solars").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.fireSolar), new ResearchPage(EMTPostInitRecipes.doubleFireSolar), new ResearchPage(EMTPostInitRecipes.tripleFireSolar)); + } + } + + if (Config.compressedSolarsResearch == false) + { + if (Config.airSolarsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Air Infused Solar Panels", "EMT", ResearchAspects.airSolars, -4, -6, 1, new ItemStack(BlockRegistry.emtSolars, 1, 15)).setSecondary().setParents("Compressed Solars").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.airSolar), new ResearchPage(EMTPostInitRecipes.doubleAirSolar), new ResearchPage(EMTPostInitRecipes.tripleAirSolar)); + } + } + + if (Config.compressedSolarsResearch == false) + { + if (Config.earthSolarsResearch == false) + { + text = "1"; + research = new EMTResearchItem("Earth Infused Solar Panels", "EMT", ResearchAspects.earthSolars, -6, -7, 1, new ItemStack(BlockRegistry.emtSolars2, 1, 2)).setSecondary().setParents("Compressed Solars").registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.earthSolar), new ResearchPage(EMTPostInitRecipes.doubleEarthSolar), new ResearchPage(EMTPostInitRecipes.tripleEarthSolar)); + } + } + + if (Config.potentiaGeneratorResearch == false) + { + if (Config.saxumGenResearch == false) + { + text = "1"; + research = new EMTResearchItem("Saxum Generator", "EMT", ResearchAspects.saxumGenerator, -3, 5, 1, new ItemStack(BlockRegistry.essentiaGens, 1, 4)).setSecondary().setParents("Potentia Generator").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.saxumGenerator)); + } + } + + if (Config.uuMInfusionResearch == false) + { + text = "1"; + research = new EMTResearchItem("UU-Matter Infusion", "EMT", ResearchAspects.uuMInfusion, 5, 5, 3, Items.getItem("UuMatterCell")).setParentsHidden("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(UuMInfusionRecipes.charcoalToCoal), new ResearchPage(UuMInfusionRecipes.glowstoneDustToBlock), new ResearchPage(UuMInfusionRecipes.stoneBricksToIronOre), new ResearchPage(UuMInfusionRecipes.arcaneStoneToCopperOre), new ResearchPage(UuMInfusionRecipes.arcaneStoneBricksToTinOre), new ResearchPage(UuMInfusionRecipes.amberBlockToLeadOre), new ResearchPage(UuMInfusionRecipes.shardToResin), new ResearchPage(UuMInfusionRecipes.shardToRedstone), new ResearchPage(UuMInfusionRecipes.shardToLapis), new ResearchPage(UuMInfusionRecipes.ironToGold), new ResearchPage(UuMInfusionRecipes.goldToDiamond), new ResearchPage(UuMInfusionRecipes.diamondToUranium), new ResearchPage(UuMInfusionRecipes.uraniumToIridium)); + } + + if (Config.portableNodeResarch == false) + { + text = "1"; + research = new EMTResearchItem("Portable Node", "EMT", ResearchAspects.portableNode, 2, 5, 3, new ItemStack(BlockRegistry.portableNode)).setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.portableNode)); + } + + if (Config.electricHoeGrowthResearch == false) + { + text = "1"; + research = new EMTResearchItem("Electric Hoe of Growth", "EMT", ResearchAspects.electricHoeGrowth, -1, -4, 2, new ItemStack(ItemRegistry.electricHoeGrowth)).setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.electricHoeGrowth)); + } + + if (Config.chargeFocusResearch == false) + { + text = "1"; + research = new EMTResearchItem("Wand Focus: Charging", "EMT", ResearchAspects.chargeFocus, 5, 3, 2, new ItemStack(ItemRegistry.chargeFocus)).setParents("Electric Magic Tools").setConcealed().registerResearchItem(); + research.setPages(new ResearchPage(text), new ResearchPage(EMTPostInitRecipes.chargeFocus)); + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/TileEntityRegistry.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/TileEntityRegistry.java new file mode 100644 index 0000000..4740b13 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/TileEntityRegistry.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common; + +import cpw.mods.fml.common.registry.GameRegistry; + +public class TileEntityRegistry +{ + + public static void registerEMTTileEntites() { + + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityPotentiaGenerator.class, "tileentityessentiagenerator"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIgnisGenerator.class, "tileentityignisgenerator"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityAuramGenerator.class, "tileentityauramgenerator"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityArborGenerator.class, "tileentityarborgenerator"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIndustrialWandRecharge.class, "tileentityindustrialwandrecharge"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityCompressedSolar.class, "tileentitycompressedsolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleCompressedSolar.class, "tileentitydoublecompressedsolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEtherealMacerator.class, "tileentityetherealmacerator"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityWaterSolar.class, "tileentitywatersolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleWaterSolar.class, "tileentitydoublewatersolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleWaterSolar.class, "tileentitytriplewatersolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDarkSolar.class, "tileentitydarksolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleDarkSolar.class, "tileentitydoubledarksolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleDarkSolar.class, "tileentitytripledarksolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityOrderSolar.class, "tileentityordersolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleOrderSolar.class, "tileentitydoubleordersolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleOrderSolar.class, "tileentitytripleordersolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityFireSolar.class, "tileentityfiresolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleFireSolar.class, "tileentitydoublefiresolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleFireSolar.class, "tileentitytriplefiresolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityAirSolar.class, "tileentityairsolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleAirSolar.class, "tileentitydoubleairsolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleAirSolar.class, "tileentitytripleairsolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEarthSolar.class, "tileentityearthsolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleEarthSolar.class, "tileentitydoubleearthsolar"); + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleEarthSolar.class, "tileentitytripleearthsolar"); + + GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityPortableNode.class, "tileentityportablenode"); + } + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTMachines.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTMachines.java new file mode 100644 index 0000000..f1184fe --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTMachines.java @@ -0,0 +1,190 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.blocks; + +import java.util.List; +import java.util.Random; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Icon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; +import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEtherealMacerator; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIndustrialWandRecharge; + +public class BlockEMTMachines extends BlockContainer +{ + + public Icon[] wandCharger = new Icon[4]; + public Icon[] etherealProcessor = new Icon[4]; + + public BlockEMTMachines(int id) + { + super(id, Material.iron); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setHardness(4.0F); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister ri) { + this.wandCharger[0] = ri.registerIcon("electricmagictools:machines/top"); + this.wandCharger[1] = ri.registerIcon("electricmagictools:machines/bottom"); + this.wandCharger[2] = ri.registerIcon("electricmagictools:machines/side"); + this.wandCharger[3] = ri.registerIcon("electricmagictools:machines/wandcharger"); + + this.etherealProcessor[0] = ri.registerIcon("electricmagictools:machines/etherealmaceratortop"); + this.etherealProcessor[1] = ri.registerIcon("electricmagictools:machines/etherealmacerator"); + this.etherealProcessor[2] = ri.registerIcon("electricmagictools:machines/etherealmaceratorfront"); + this.etherealProcessor[3] = ri.registerIcon("electricmagictools:machines/etherealmaceratorfrontactive"); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubBlocks(int id, CreativeTabs tab, List list) { + list.add(new ItemStack(id, 1, 0)); + list.add(new ItemStack(id, 1, 1)); + } + + @Override + public Icon getIcon(int side, int meta) { + if (meta == 0) + { + if (side <= 1) + { + return this.wandCharger[0]; + } + if (side > 1) + { + return this.wandCharger[3]; + } + } + + if (meta == 1) + { + if (side == 0) + { + return this.etherealProcessor[1]; + } + if (side == 1) + { + return this.etherealProcessor[0]; + } + if (side == 2) + { + return this.etherealProcessor[3]; + } + if (side == 3) + { + return this.etherealProcessor[3]; + } + } + return this.etherealProcessor[2]; + } + + @Override + public Icon getBlockTexture(IBlockAccess access, int i, int j, int k, int side) { + return super.getBlockTexture(access, i, j, k, side); + } + + @Override + public TileEntity createTileEntity(World world, int meta) { + if (meta == 0) + { + return new TileEntityIndustrialWandRecharge(); + } + if (meta == 1) + { + return new TileEntityEtherealMacerator(); + } + return super.createTileEntity(world, meta); + } + + @Override + public TileEntity createNewTileEntity(World world) { + return null; + } + + @Override + public int damageDropped(int meta) { + return meta; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { + if (!world.isRemote && world.getBlockTileEntity(x, y, z) instanceof TileEntityIndustrialWandRecharge) + { + player.openGui(ElectricMagicTools.instance, 0, world, x, y, z); + } else if (!world.isRemote && world.getBlockTileEntity(x, y, z) instanceof TileEntityEtherealMacerator) + { + player.openGui(ElectricMagicTools.instance, 1, world, x, y, z); + } + return true; + } + + @Override + public void breakBlock(World world, int x, int y, int z, int par5, int par6) { + dropItems(world, x, y, z); + world.removeBlockTileEntity(x, y, z); + super.breakBlock(world, x, y, z, par5, par6); + } + + private void dropItems(World world, int x, int y, int z) { + Random rand = new Random(); + + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + if (!(tileEntity instanceof IInventory)) + { + return; + } + IInventory inventory = (IInventory) tileEntity; + + for (int i = 0; i < inventory.getSizeInventory(); i++) + { + ItemStack item = inventory.getStackInSlot(i); + + if (item != null && item.stackSize > 0) + { + float rx = rand.nextFloat() * 0.8F + 0.1F; + float ry = rand.nextFloat() * 0.8F + 0.1F; + float rz = rand.nextFloat() * 0.8F + 0.1F; + + EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.itemID, item.stackSize, item.getItemDamage())); + + if (item.hasTagCompound()) + { + entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); + } + + float factor = 0.05F; + entityItem.motionX = rand.nextGaussian() * factor; + entityItem.motionY = rand.nextGaussian() * factor + 0.2F; + entityItem.motionZ = rand.nextGaussian() * factor; + world.spawnEntityInWorld(entityItem); + item.stackSize = 0; + } + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTSolars.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTSolars.java new file mode 100644 index 0000000..1b2e183 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTSolars.java @@ -0,0 +1,499 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.blocks; + +import java.util.List; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Icon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityAirSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityCompressedSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDarkSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleCompressedSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleDarkSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleFireSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleOrderSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleWaterSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityFireSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityOrderSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleCompressedSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleDarkSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleFireSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleOrderSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleWaterSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityWaterSolar; + +public class BlockEMTSolars extends BlockContainer +{ + + public Icon[] compressedSolar = new Icon[3]; + public Icon[] doubleCompressedSolar = new Icon[3]; + public Icon[] tripleCompressedSolar = new Icon[3]; + public Icon[] waterSolar = new Icon[3]; + public Icon[] doubleWaterSolar = new Icon[3]; + public Icon[] tripleWaterSolar = new Icon[3]; + public Icon[] darkSolar = new Icon[3]; + public Icon[] doubleDarkSolar = new Icon[3]; + public Icon[] tripleDarkSolar = new Icon[3]; + public Icon[] orderSolar = new Icon[3]; + public Icon[] doubleOrderSolar = new Icon[3]; + public Icon[] tripleOrderSolar = new Icon[3]; + public Icon[] fireSolar = new Icon[3]; + public Icon[] doubleFireSolar = new Icon[3]; + public Icon[] tripleFireSolar = new Icon[3]; + public Icon[] airSolar = new Icon[3]; + + public BlockEMTSolars(int id) + { + super(id, Material.iron); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setHardness(4.0F); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister ri) { + this.compressedSolar[0] = ri.registerIcon("electricmagictools:solars/solartop"); + this.compressedSolar[1] = ri.registerIcon("electricmagictools:solars/side"); + this.compressedSolar[2] = ri.registerIcon("electricmagictools:solars/bottom"); + + this.doubleCompressedSolar[0] = ri.registerIcon("electricmagictools:solars/doublesolartop"); + this.doubleCompressedSolar[1] = ri.registerIcon("electricmagictools:solars/side"); + this.doubleCompressedSolar[2] = ri.registerIcon("electricmagictools:solars/bottom"); + + this.tripleCompressedSolar[0] = ri.registerIcon("electricmagictools:solars/triplesolartop"); + this.tripleCompressedSolar[1] = ri.registerIcon("electricmagictools:solars/side"); + this.tripleCompressedSolar[2] = ri.registerIcon("electricmagictools:solars/bottom"); + + this.waterSolar[0] = ri.registerIcon("electricmagictools:solars/solartop"); + this.waterSolar[1] = ri.registerIcon("electricmagictools:solars/waterside"); + this.waterSolar[2] = ri.registerIcon("electricmagictools:solars/waterbottom"); + + this.doubleWaterSolar[0] = ri.registerIcon("electricmagictools:solars/doublesolartop"); + this.doubleWaterSolar[1] = ri.registerIcon("electricmagictools:solars/waterside"); + this.doubleWaterSolar[2] = ri.registerIcon("electricmagictools:solars/waterbottom"); + + this.tripleWaterSolar[0] = ri.registerIcon("electricmagictools:solars/triplesolartop"); + this.tripleWaterSolar[1] = ri.registerIcon("electricmagictools:solars/waterside"); + this.tripleWaterSolar[2] = ri.registerIcon("electricmagictools:solars/waterbottom"); + + this.darkSolar[0] = ri.registerIcon("electricmagictools:solars/solartop"); + this.darkSolar[1] = ri.registerIcon("electricmagictools:solars/darkside"); + this.darkSolar[2] = ri.registerIcon("electricmagictools:solars/darkbottom"); + + this.doubleDarkSolar[0] = ri.registerIcon("electricmagictools:solars/doublesolartop"); + this.doubleDarkSolar[1] = ri.registerIcon("electricmagictools:solars/darkside"); + this.doubleDarkSolar[2] = ri.registerIcon("electricmagictools:solars/darkbottom"); + + this.tripleDarkSolar[0] = ri.registerIcon("electricmagictools:solars/triplesolartop"); + this.tripleDarkSolar[1] = ri.registerIcon("electricmagictools:solars/darkside"); + this.tripleDarkSolar[2] = ri.registerIcon("electricmagictools:solars/darkbottom"); + + this.orderSolar[0] = ri.registerIcon("electricmagictools:solars/solartop"); + this.orderSolar[1] = ri.registerIcon("electricmagictools:solars/orderside"); + this.orderSolar[2] = ri.registerIcon("electricmagictools:solars/orderbottom"); + + this.doubleOrderSolar[0] = ri.registerIcon("electricmagictools:solars/doublesolartop"); + this.doubleOrderSolar[1] = ri.registerIcon("electricmagictools:solars/orderside"); + this.doubleOrderSolar[2] = ri.registerIcon("electricmagictools:solars/orderbottom"); + + this.tripleOrderSolar[0] = ri.registerIcon("electricmagictools:solars/triplesolartop"); + this.tripleOrderSolar[1] = ri.registerIcon("electricmagictools:solars/orderside"); + this.tripleOrderSolar[2] = ri.registerIcon("electricmagictools:solars/orderbottom"); + + this.fireSolar[0] = ri.registerIcon("electricmagictools:solars/solartop"); + this.fireSolar[1] = ri.registerIcon("electricmagictools:solars/fireside"); + this.fireSolar[2] = ri.registerIcon("electricmagictools:solars/firebottom"); + + this.doubleFireSolar[0] = ri.registerIcon("electricmagictools:solars/doublesolartop"); + this.doubleFireSolar[1] = ri.registerIcon("electricmagictools:solars/fireside"); + this.doubleFireSolar[2] = ri.registerIcon("electricmagictools:solars/firebottom"); + + this.tripleFireSolar[0] = ri.registerIcon("electricmagictools:solars/triplesolartop"); + this.tripleFireSolar[1] = ri.registerIcon("electricmagictools:solars/fireside"); + this.tripleFireSolar[2] = ri.registerIcon("electricmagictools:solars/firebottom"); + + this.airSolar[0] = ri.registerIcon("electricmagictools:solars/solartop"); + this.airSolar[1] = ri.registerIcon("electricmagictools:solars/airside"); + this.airSolar[2] = ri.registerIcon("electricmagictools:solars/airbottom"); + } + + @SideOnly(Side.CLIENT) + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void getSubBlocks(int id, CreativeTabs tab, List list) { + list.add(new ItemStack(id, 1, 0)); + list.add(new ItemStack(id, 1, 1)); + list.add(new ItemStack(id, 1, 2)); + list.add(new ItemStack(id, 1, 3)); + list.add(new ItemStack(id, 1, 4)); + list.add(new ItemStack(id, 1, 5)); + list.add(new ItemStack(id, 1, 6)); + list.add(new ItemStack(id, 1, 7)); + list.add(new ItemStack(id, 1, 8)); + list.add(new ItemStack(id, 1, 9)); + list.add(new ItemStack(id, 1, 10)); + list.add(new ItemStack(id, 1, 11)); + list.add(new ItemStack(id, 1, 12)); + list.add(new ItemStack(id, 1, 13)); + list.add(new ItemStack(id, 1, 14)); + list.add(new ItemStack(id, 1, 15)); + } + + @Override + public Icon getIcon(int side, int meta) { + if (meta == 0) + { + if (side == 1) + { + return this.compressedSolar[0]; + } + if (side > 1) + { + return this.compressedSolar[1]; + } + } + + if (meta == 1) + { + if (side == 1) + { + return this.doubleCompressedSolar[0]; + } + if (side > 1) + { + return this.doubleCompressedSolar[1]; + } + } + + if (meta == 2) + { + if (side == 1) + { + return this.tripleCompressedSolar[0]; + } + if (side > 1) + { + return this.tripleCompressedSolar[1]; + } + } + + if (meta == 3) + { + if (side == 0) + { + return this.waterSolar[2]; + } + if (side == 1) + { + return this.waterSolar[0]; + } + if (side > 1) + { + return this.waterSolar[1]; + } + } + + if (meta == 4) + { + if (side == 0) + { + return this.doubleWaterSolar[2]; + } + if (side == 1) + { + return this.doubleWaterSolar[0]; + } + if (side > 1) + { + return this.doubleWaterSolar[1]; + } + } + + if (meta == 5) + { + if (side == 0) + { + return this.tripleWaterSolar[2]; + } + if (side == 1) + { + return this.tripleWaterSolar[0]; + } + if (side > 1) + { + return this.tripleWaterSolar[1]; + } + } + + if (meta == 6) + { + if (side == 0) + { + return this.darkSolar[2]; + } + if (side == 1) + { + return this.darkSolar[0]; + } + if (side > 1) + { + return this.darkSolar[1]; + } + } + + if (meta == 7) + { + if (side == 0) + { + return this.doubleDarkSolar[2]; + } + if (side == 1) + { + return this.doubleDarkSolar[0]; + } + if (side > 1) + { + return this.doubleDarkSolar[1]; + } + } + + if (meta == 8) + { + if (side == 0) + { + return this.tripleDarkSolar[2]; + } + if (side == 1) + { + return this.tripleDarkSolar[0]; + } + if (side > 1) + { + return this.tripleDarkSolar[1]; + } + } + + if (meta == 9) + { + if (side == 0) + { + return this.orderSolar[2]; + } + if (side == 1) + { + return this.orderSolar[0]; + } + if (side > 1) + { + return this.orderSolar[1]; + } + } + + if (meta == 10) + { + if (side == 0) + { + return this.doubleOrderSolar[2]; + } + if (side == 1) + { + return this.doubleOrderSolar[0]; + } + if (side > 1) + { + return this.doubleOrderSolar[1]; + } + } + + if (meta == 11) + { + if (side == 0) + { + return this.tripleOrderSolar[2]; + } + if (side == 1) + { + return this.tripleOrderSolar[0]; + } + if (side > 1) + { + return this.tripleOrderSolar[1]; + } + } + + if (meta == 12) + { + if (side == 0) + { + return this.fireSolar[2]; + } + if (side == 1) + { + return this.fireSolar[0]; + } + if (side > 1) + { + return this.fireSolar[1]; + } + } + + if (meta == 13) + { + if (side == 0) + { + return this.doubleFireSolar[2]; + } + if (side == 1) + { + return this.doubleFireSolar[0]; + } + if (side > 1) + { + return this.doubleFireSolar[1]; + } + } + + if (meta == 14) + { + if (side == 0) + { + return this.tripleFireSolar[2]; + } + if (side == 1) + { + return this.tripleFireSolar[0]; + } + if (side > 1) + { + return this.tripleFireSolar[1]; + } + } + + if (meta == 15) + { + if (side == 0) + { + return this.airSolar[2]; + } + if (side == 1) + { + return this.airSolar[0]; + } + if (side > 1) + { + return this.airSolar[1]; + } + } + return this.compressedSolar[2]; + } + + @Override + public Icon getBlockTexture(IBlockAccess access, int i, int j, int k, int side) { + return super.getBlockTexture(access, i, j, k, side); + } + + @Override + public TileEntity createTileEntity(World world, int meta) { + if (meta == 0) + { + return new TileEntityCompressedSolar(); + } + if (meta == 1) + { + return new TileEntityDoubleCompressedSolar(); + } + if (meta == 2) + { + return new TileEntityTripleCompressedSolar(); + } + if (meta == 3) + { + return new TileEntityWaterSolar(); + } + if (meta == 4) + { + return new TileEntityDoubleWaterSolar(); + } + if (meta == 5) + { + return new TileEntityTripleWaterSolar(); + } + if (meta == 6) + { + return new TileEntityDarkSolar(); + } + if (meta == 7) + { + return new TileEntityDoubleDarkSolar(); + } + if (meta == 8) + { + return new TileEntityTripleDarkSolar(); + } + if (meta == 9) + { + return new TileEntityOrderSolar(); + } + if (meta == 10) + { + return new TileEntityDoubleOrderSolar(); + } + if (meta == 11) + { + return new TileEntityTripleOrderSolar(); + } + if (meta == 12) + { + return new TileEntityFireSolar(); + } + if (meta == 13) + { + return new TileEntityDoubleFireSolar(); + } + if (meta == 14) + { + return new TileEntityTripleFireSolar(); + } + if (meta == 15) + { + return new TileEntityAirSolar(); + } + + return super.createTileEntity(world, meta); + } + + @Override + public TileEntity createNewTileEntity(World world) { + return null; + } + + @Override + public void breakBlock(World world, int x, int y, int z, int par5, int par6) { + world.removeBlockTileEntity(x, y, z); + super.breakBlock(world, x, y, z, par5, par6); + } + + @Override + public int damageDropped(int meta) { + return meta; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTSolars2.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTSolars2.java new file mode 100644 index 0000000..206f21d --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEMTSolars2.java @@ -0,0 +1,199 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.blocks; + +import java.util.List; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Icon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleAirSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityDoubleEarthSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEarthSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleAirSolar; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityTripleEarthSolar; + +public class BlockEMTSolars2 extends BlockContainer +{ + + public Icon[] compressedSolar = new Icon[3]; + public Icon[] doubleAirSolar = new Icon[3]; + public Icon[] tripleAirSolar = new Icon[3]; + public Icon[] earthSolar = new Icon[3]; + public Icon[] doubleEarthSolar = new Icon[3]; + public Icon[] tripleEarthSolar = new Icon[3]; + + public BlockEMTSolars2(int id) + { + super(id, Material.iron); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setHardness(4.0F); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister ri) { + this.compressedSolar[0] = ri.registerIcon("electricmagictools:solars/solartop"); + this.compressedSolar[1] = ri.registerIcon("electricmagictools:solars/side"); + this.compressedSolar[2] = ri.registerIcon("electricmagictools:solars/bottom"); + + this.doubleAirSolar[0] = ri.registerIcon("electricmagictools:solars/doublesolartop"); + this.doubleAirSolar[1] = ri.registerIcon("electricmagictools:solars/airside"); + this.doubleAirSolar[2] = ri.registerIcon("electricmagictools:solars/airbottom"); + + this.tripleAirSolar[0] = ri.registerIcon("electricmagictools:solars/triplesolartop"); + this.tripleAirSolar[1] = ri.registerIcon("electricmagictools:solars/airside"); + this.tripleAirSolar[2] = ri.registerIcon("electricmagictools:solars/airbottom"); + + this.earthSolar[0] = ri.registerIcon("electricmagictools:solars/solartop"); + this.earthSolar[1] = ri.registerIcon("electricmagictools:solars/earthside"); + this.earthSolar[2] = ri.registerIcon("electricmagictools:solars/earthbottom"); + + this.doubleEarthSolar[0] = ri.registerIcon("electricmagictools:solars/doublesolartop"); + this.doubleEarthSolar[1] = ri.registerIcon("electricmagictools:solars/earthside"); + this.doubleEarthSolar[2] = ri.registerIcon("electricmagictools:solars/earthbottom"); + + this.tripleEarthSolar[0] = ri.registerIcon("electricmagictools:solars/triplesolartop"); + this.tripleEarthSolar[1] = ri.registerIcon("electricmagictools:solars/earthside"); + this.tripleEarthSolar[2] = ri.registerIcon("electricmagictools:solars/earthbottom"); + } + + @SideOnly(Side.CLIENT) + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void getSubBlocks(int id, CreativeTabs tab, List list) { + list.add(new ItemStack(id, 1, 0)); + list.add(new ItemStack(id, 1, 1)); + list.add(new ItemStack(id, 1, 2)); + list.add(new ItemStack(id, 1, 3)); + list.add(new ItemStack(id, 1, 4)); + + } + + @Override + public Icon getIcon(int side, int meta) { + if (meta == 0) + { + if (side == 1) + { + return this.doubleAirSolar[0]; + } + if (side > 1) + { + return this.doubleAirSolar[1]; + } + } + + if (meta == 1) + { + if (side == 1) + { + return this.tripleAirSolar[0]; + } + if (side > 1) + { + return this.tripleAirSolar[1]; + } + } + + if (meta == 2) + { + if (side == 1) + { + return this.earthSolar[0]; + } + if (side > 1) + { + return this.earthSolar[1]; + } + } + + if (meta == 3) + { + if (side == 1) + { + return this.doubleEarthSolar[0]; + } + if (side > 1) + { + return this.doubleEarthSolar[1]; + } + } + + if (meta == 4) + { + if (side == 1) + { + return this.tripleEarthSolar[0]; + } + if (side > 1) + { + return this.tripleEarthSolar[1]; + } + } + return this.compressedSolar[2]; + } + + @Override + public Icon getBlockTexture(IBlockAccess access, int i, int j, int k, int side) { + return super.getBlockTexture(access, i, j, k, side); + } + + @Override + public TileEntity createTileEntity(World world, int meta) { + if (meta == 0) + { + return new TileEntityDoubleAirSolar(); + } + if (meta == 1) + { + return new TileEntityTripleAirSolar(); + } + if (meta == 2) + { + return new TileEntityEarthSolar(); + } + if (meta == 3) + { + return new TileEntityDoubleEarthSolar(); + } + if (meta == 4) + { + return new TileEntityTripleEarthSolar(); + } + return super.createTileEntity(world, meta); + } + + @Override + public TileEntity createNewTileEntity(World world) { + return null; + } + + @Override + public void breakBlock(World world, int x, int y, int z, int par5, int par6) { + world.removeBlockTileEntity(x, y, z); + super.breakBlock(world, x, y, z, par5, par6); + } + + @Override + public int damageDropped(int meta) { + return meta; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEssentiaGenerators.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEssentiaGenerators.java new file mode 100644 index 0000000..033a877 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockEssentiaGenerators.java @@ -0,0 +1,197 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.blocks; + +import java.util.List; +import java.util.Random; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Icon; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityArborGenerator; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityAuramGenerator; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIgnisGenerator; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityPotentiaGenerator; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntitySaxumGenerator; + +public class BlockEssentiaGenerators extends BlockContainer +{ + + public Icon[] potentiaGen = new Icon[3]; + public Icon[] ignisGen = new Icon[3]; + public Icon[] auramGen = new Icon[3]; + public Icon[] arborGen = new Icon[3]; + public Icon[] saxumGen = new Icon[3]; + + public BlockEssentiaGenerators(int id) + { + super(id, Material.iron); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setHardness(4.0F); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister ri) { + this.potentiaGen[0] = ri.registerIcon("electricmagictools:essentiagenerator/potentiafront"); + this.potentiaGen[1] = ri.registerIcon("electricmagictools:essentiagenerator/side"); + this.potentiaGen[2] = ri.registerIcon("electricmagictools:essentiagenerator/top"); + + this.ignisGen[0] = ri.registerIcon("electricmagictools:essentiagenerator/ignisfront"); + this.ignisGen[1] = ri.registerIcon("electricmagictools:essentiagenerator/side"); + this.ignisGen[2] = ri.registerIcon("electricmagictools:essentiagenerator/top"); + + this.auramGen[0] = ri.registerIcon("electricmagictools:essentiagenerator/auramfront"); + this.auramGen[1] = ri.registerIcon("electricmagictools:essentiagenerator/side"); + this.auramGen[2] = ri.registerIcon("electricmagictools:essentiagenerator/top"); + + this.arborGen[0] = ri.registerIcon("electricmagictools:essentiagenerator/arborfront"); + this.arborGen[1] = ri.registerIcon("electricmagictools:essentiagenerator/side"); + this.arborGen[2] = ri.registerIcon("electricmagictools:essentiagenerator/top"); + + this.saxumGen[0] = ri.registerIcon("electricmagictools:essentiagenerator/saxumfront"); + this.saxumGen[1] = ri.registerIcon("electricmagictools:essentiagenerator/side"); + this.saxumGen[2] = ri.registerIcon("electricmagictools:essentiagenerator/top"); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @SideOnly(Side.CLIENT) + public void getSubBlocks(int id, CreativeTabs tab, List list) { + list.add(new ItemStack(id, 1, 0)); + list.add(new ItemStack(id, 1, 1)); + list.add(new ItemStack(id, 1, 2)); + list.add(new ItemStack(id, 1, 3)); + list.add(new ItemStack(id, 1, 4)); + } + + @Override + public Icon getIcon(int side, int meta) { + if (meta == 0) + { + if (side == 1) + { + return this.potentiaGen[2]; + } + if (side > 1) + { + return this.potentiaGen[0]; + } + } + + if (meta == 1) + { + if (side == 1) + { + return this.ignisGen[2]; + } + if (side > 1) + { + return this.ignisGen[0]; + } + } + + if (meta == 2) + { + if (side == 1) + { + return this.auramGen[2]; + } + if (side > 1) + { + return this.auramGen[0]; + } + } + + if (meta == 3) + { + if (side == 1) + { + return this.arborGen[2]; + } + if (side > 1) + { + return this.arborGen[0]; + } + } + + if (meta == 4) + { + if (side == 1) + { + return this.saxumGen[2]; + } + if (side > 1) + { + return this.saxumGen[0]; + } + } + return this.potentiaGen[1]; + } + + @Override + public TileEntity createTileEntity(World world, int meta) { + if (meta == 0) + { + return new TileEntityPotentiaGenerator(); + } + if (meta == 1) + { + return new TileEntityIgnisGenerator(); + } + if (meta == 2) + { + return new TileEntityAuramGenerator(); + } + if (meta == 3) + { + return new TileEntityArborGenerator(); + } + if (meta == 4) + { + return new TileEntitySaxumGenerator(); + } + + return super.createTileEntity(world, meta); + } + + @Override + public TileEntity createNewTileEntity(World world) { + return null; + } + + @Override + public void breakBlock(World world, int x, int y, int z, int par5, int par6) { + world.removeBlockTileEntity(x, y, z); + super.breakBlock(world, x, y, z, par5, par6); + } + + @Override + public int damageDropped(int par1) { + return par1; + } + + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { + float f = (float) par2 + 0.5F; + float f1 = (float) par3 + 1.0F; + float f2 = (float) par4 + 0.5F; + par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockPortableNode.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockPortableNode.java new file mode 100644 index 0000000..95bf13c --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockPortableNode.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.blocks; + +import java.util.List; +import java.util.Random; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Icon; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import thaumcraft.common.blocks.BlockAiry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityPortableNode; + +public class BlockPortableNode extends BlockAiry +{ + + public Icon[] texture = new Icon[1]; + + public BlockPortableNode(int id) + { + super(id); + this.setCreativeTab(CreativeTab.tabTombenpotter); + setBlockUnbreakable(); + } + + @Override + public TileEntity createTileEntity(World world, int meta) { + return new TileEntityPortableNode(); + } + + @Override + public int quantityDropped(Random par1Random) { + return 0; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + protected boolean canSilkHarvest() { + return false; + } + + public boolean canEntityDestroy(World world, int x, int y, int z, Entity entity) { + return false; + } + + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { + } + + public boolean canDragonDestroy(World world, int x, int y, int z) { + return false; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister ri) { + this.texture[0] = ri.registerIcon("electricmagictools:portablenode"); + } + + @SideOnly(Side.CLIENT) + public Icon getIcon(int side, int meta) { + return this.texture[0]; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubBlocks(int id, CreativeTabs tab, List list) { + list.add(new ItemStack(id, 1, 0)); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { + if (!world.isRemote && player.isSneaking() && player.getHeldItem() == null) + { + world.setBlockToAir(x, y, z); + world.removeBlockTileEntity(x, y, z); + } + return true; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockShield.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockShield.java new file mode 100644 index 0000000..4c6c6d6 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/blocks/BlockShield.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.blocks; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class BlockShield extends Block +{ + + public BlockShield(int id) + { + super(id, Material.rock); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setHardness(1F); + this.setResistance(200000000F); + } + + @Override + public int quantityDropped(Random par1Random) { + return 0; + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 0; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.blockIcon = iconRegister.registerIcon("electricmagictools:shield"); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + protected boolean canSilkHarvest() { + return false; + } + + public boolean canEntityDestroy(World world, int x, int y, int z, Entity entity) { + return false; + } + + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { + } + + public boolean canDragonDestroy(World world, int x, int y, int z) { + return false; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/EntityArcher.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/EntityArcher.java new file mode 100644 index 0000000..4924722 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/EntityArcher.java @@ -0,0 +1,120 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.entities; + +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; + +public class EntityArcher extends EntitySnowman +{ + + public EntityArcher(World par1World) + { + super(par1World); + this.isImmuneToFire = true; + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, true, false, IMob.mobSelector)); + this.tasks.addTask(4, new EntityAIWander(this, 0.30D)); + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.30D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(40.0D); + } + + @Override + public void onDeath(DamageSource par1DamageSource) { + super.onDeath(par1DamageSource); + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1, true); + this.setDead(); + } + + @Override + protected int getDropItemId() { + return Item.arrow.itemID; + } + + @Override + protected void dropFewItems(boolean par1, int par2) { + int j; + int k; + + j = this.rand.nextInt(3 + par2); + + for (k = 0; k < j; ++k) + { + this.dropItem(Item.arrow.itemID, 1); + } + j = this.rand.nextInt(3 + par2); + + for (k = 0; k < j; ++k) + { + this.dropItem(Item.bone.itemID, 1); + } + } + + @Override + protected void dropRareDrop(int par1) { + this.entityDropItem(new ItemStack(Block.web.blockID, 1, 1), 0.0F); + } + + protected void addRandomArmor() { + super.addRandomArmor(); + this.setCurrentItemOrArmor(0, new ItemStack(Item.bow)); + } + + @Override + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 1.6F, (float) (14 - this.worldObj.difficultySetting * 4)); + int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); + int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); + entityarrow.setDamage((double) (par2 * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.difficultySetting * 0.11F)); + + if (i > 0) + { + entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); + } + + if (j > 0) + { + entityarrow.setKnockbackStrength(j); + } + + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0) + { + entityarrow.setFire(100); + } + + this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(entityarrow); + } + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/EntityLaser.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/EntityLaser.java new file mode 100644 index 0000000..d60409c --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/EntityLaser.java @@ -0,0 +1,369 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.entities; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class EntityLaser extends Entity implements IProjectile +{ + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private int inTile; + private int inData; + private boolean inGround; + + public Entity shootingEntity; + private int ticksInGround; + private int ticksInAir; + + public EntityLaser(World par1World) + { + super(par1World); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + } + + public EntityLaser(World par1World, double par2, double par4, double par6) + { + super(par1World); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + this.setPosition(par2, par4, par6); + this.yOffset = 0.0F; + } + + public EntityLaser(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5) + { + super(par1World); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = par2EntityLivingBase; + + this.posY = par2EntityLivingBase.posY + (double) par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D; + double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX; + double d1 = par3EntityLivingBase.boundingBox.minY + (double) (par3EntityLivingBase.height / 3.0F) - this.posY; + double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ; + double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2); + + if (d3 >= 1.0E-7D) + { + float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; + float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI)); + double d4 = d0 / d3; + double d5 = d2 / d3; + this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3); + this.yOffset = 0.0F; + float f4 = (float) d3 * 0.2F; + this.setThrowableHeading(d0, d1 + (double) f4, d2, par4, par5); + } + } + + public EntityLaser(World par1World, EntityLivingBase par2EntityLivingBase, float par3) + { + super(par1World); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = par2EntityLivingBase; + + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + (double) par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch); + this.posX -= (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F); + this.posY -= 0.10000000149011612D; + this.posZ -= (double) (MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); + this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); + this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); + this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F); + } + + protected void entityInit() { + this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); + } + + public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) { + float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); + par1 /= (double) f2; + par3 /= (double) f2; + par5 /= (double) f2; + par1 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8; + par3 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8; + par5 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8; + par1 *= (double) par7; + par3 *= (double) par7; + par5 *= (double) par7; + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f3) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + @SideOnly(Side.CLIENT) + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { + this.setPosition(par1, par3, par5); + this.setRotation(par7, par8); + } + + @SideOnly(Side.CLIENT) + public void setVelocity(double par1, double par3, double par5) { + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(par1 + par5); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) / Math.PI); + this.prevRotationPitch = this.rotationPitch; + this.prevRotationYaw = this.rotationYaw; + this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + this.ticksInGround = 0; + } + } + + @SuppressWarnings("rawtypes") + public void onUpdate() { + super.onUpdate(); + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI); + } + + int i = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + + if (i > 0) + { + Block.blocksList[i].setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile); + AxisAlignedBB axisalignedbb = Block.blocksList[i].getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile); + + if (axisalignedbb != null && axisalignedbb.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ))) + { + this.inGround = true; + } + } + + if (this.inGround) + { + int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 3, true); + this.setDead(); + if (j == this.inTile && k == this.inData) + { + ++this.ticksInGround; + + if (this.ticksInGround == 1200) + { + this.setDead(); + } + } else + { + this.inGround = false; + this.motionX *= (double) (this.rand.nextFloat() * 0.2F); + this.motionY *= (double) (this.rand.nextFloat() * 0.2F); + this.motionZ *= (double) (this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + } else + { + ++this.ticksInAir; + Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, false, true); + vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (movingobjectposition != null) + { + vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } + + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + int l; + float f1; + + for (l = 0; l < list.size(); ++l) + { + Entity entity1 = (Entity) list.get(l); + + if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) + { + f1 = 0.3F; + AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) f1, (double) f1, (double) f1); + MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31); + + if (movingobjectposition1 != null) + { + double d1 = vec3.distanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) + { + entity = entity1; + d0 = d1; + } + } + } + } + + if (entity != null) + { + movingobjectposition = new MovingObjectPosition(entity); + } + + if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; + + if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) + { + movingobjectposition = null; + } + } + + float f2; + float f3; + + if (movingobjectposition != null) + { + if (movingobjectposition.entityHit != null) + { + f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + { + this.motionX *= -0.10000000149011612D; + this.motionY *= -0.10000000149011612D; + this.motionZ *= -0.10000000149011612D; + this.rotationYaw += 180.0F; + this.prevRotationYaw += 180.0F; + this.ticksInAir = 0; + } + } else + { + this.xTile = movingobjectposition.blockX; + this.yTile = movingobjectposition.blockY; + this.zTile = movingobjectposition.blockZ; + this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + this.motionX = (double) ((float) (movingobjectposition.hitVec.xCoord - this.posX)); + this.motionY = (double) ((float) (movingobjectposition.hitVec.yCoord - this.posY)); + this.motionZ = (double) ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); + f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / (double) f2 * 0.05000000074505806D; + this.posY -= this.motionY / (double) f2 * 0.05000000074505806D; + this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D; + this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.inGround = true; + + if (this.inTile != 0) + { + Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); + } + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float f4 = 0.99F; + f1 = 0.05F; + + if (this.isInWater()) + { + for (int j1 = 0; j1 < 4; ++j1) + { + f3 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double) f3, this.posY - this.motionY * (double) f3, this.posZ - this.motionZ * (double) f3, this.motionX, this.motionY, this.motionZ); + } + + f4 = 0.8F; + } + + this.motionX *= (double) f4; + this.motionY *= (double) f4; + this.motionZ *= (double) f4; + this.motionY -= (double) f1; + this.setPosition(this.posX, this.posY, this.posZ); + this.doBlockCollisions(); + } + } + + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { + par1NBTTagCompound.setShort("xTile", (short) this.xTile); + par1NBTTagCompound.setShort("yTile", (short) this.yTile); + par1NBTTagCompound.setShort("zTile", (short) this.zTile); + par1NBTTagCompound.setByte("inTile", (byte) this.inTile); + par1NBTTagCompound.setByte("inData", (byte) this.inData); + par1NBTTagCompound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); + } + + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { + this.xTile = par1NBTTagCompound.getShort("xTile"); + this.yTile = par1NBTTagCompound.getShort("yTile"); + this.zTile = par1NBTTagCompound.getShort("zTile"); + this.inTile = par1NBTTagCompound.getByte("inTile") & 255; + this.inData = par1NBTTagCompound.getByte("inData") & 255; + this.inGround = par1NBTTagCompound.getByte("inGround") == 1; + } + + @SideOnly(Side.CLIENT) + public float getShadowSize() { + return 0.0F; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/RenderArcher.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/RenderArcher.java new file mode 100644 index 0000000..a649131 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/RenderArcher.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.entities; + +import net.minecraft.client.renderer.entity.RenderSnowMan; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderArcher extends RenderSnowMan +{ +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/RenderLaser.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/RenderLaser.java new file mode 100644 index 0000000..aeb0243 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/entities/RenderLaser.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.entities; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderLaser extends Render +{ + + private static final ResourceLocation laserTexture = new ResourceLocation("electricmagictools:textures/models/lasermodel.png"); + + public void renderArrow(EntityLaser entityLaser, double par2, double par4, double par6, float par8, float par9) { + + this.bindEntityTexture(entityLaser); + GL11.glPushMatrix(); + GL11.glTranslatef((float) par2, (float) par4, (float) par6); + GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); + Tessellator tessellator = Tessellator.instance; + byte b0 = 0; + float f2 = 0.4F; + float f3 = 0.7F; + float f4 = (float) (0 + b0 * 10) / 32.0F; + float f5 = (float) (5 + b0 * 10) / 32.0F; + float f6 = 0.0F; + float f7 = 0.15625F; + float f8 = (float) (5 + b0 * 10) / 32.0F; + float f9 = (float) (10 + b0 * 10) / 32.0F; + float f10 = 0.05625F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + + GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); + GL11.glScalef(f10, f10, f10); + GL11.glTranslatef(-4.0F, 0.0F, 0.0F); + GL11.glNormal3f(f10, 0.0F, 0.0F); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); + tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); + tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); + tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); + tessellator.draw(); + GL11.glNormal3f(-f10, 0.0F, 0.0F); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); + tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); + tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); + tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); + tessellator.draw(); + + for (int i = 0; i < 4; ++i) + { + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + GL11.glNormal3f(0.0F, 0.0F, f10); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); + tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); + tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); + tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); + tessellator.draw(); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + + protected ResourceLocation getArrowTextures(EntityLaser entityLaser) { + return laserTexture; + } + + protected ResourceLocation getEntityTexture(Entity par1Entity) { + return this.getArrowTextures((EntityLaser) par1Entity); + } + + public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { + this.renderArrow((EntityLaser) par1Entity, par2, par4, par6, par8, par9); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTMachines.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTMachines.java new file mode 100644 index 0000000..049ede1 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTMachines.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items; + +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBlockEMTMachines extends ItemBlock +{ + + public ItemBlockEMTMachines(int par1) + { + super(par1); + setHasSubtypes(true); + } + + @Override + public String getUnlocalizedName(ItemStack itemstack) { + String name = ""; + switch (itemstack.getItemDamage()) + { + case 0: + { + name = "wandrecharge"; + break; + } + case 1: + { + name = "etheralprocessor"; + break; + } + default: + name = "nothing"; + } + return getUnlocalizedName() + "." + name; + } + + @Override + public int getMetadata(int par1) { + return par1; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTSolars.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTSolars.java new file mode 100644 index 0000000..6894cc1 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTSolars.java @@ -0,0 +1,225 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class ItemBlockEMTSolars extends ItemBlock +{ + + public ItemBlockEMTSolars(int par1) + { + super(par1); + setHasSubtypes(true); + } + + @Override + public String getUnlocalizedName(ItemStack itemstack) { + String name = ""; + switch (itemstack.getItemDamage()) + { + case 0: + { + name = "compressed"; + break; + } + case 1: + { + name = "doublecompressed"; + break; + } + case 2: + { + name = "triplecompressed"; + break; + } + case 3: + { + name = "water"; + break; + } + case 4: + { + name = "doublewater"; + break; + } + case 5: + { + name = "triplewater"; + break; + } + case 6: + { + name = "dark"; + break; + } + case 7: + { + name = "doubledark"; + break; + } + case 8: + { + name = "tripledark"; + break; + } + case 9: + { + name = "order"; + break; + } + case 10: + { + name = "doubleorder"; + break; + } + case 11: + { + name = "tripleorder"; + break; + } + case 12: + { + name = "fire"; + break; + } + case 13: + { + name = "doublefire"; + break; + } + case 14: + { + name = "triplefire"; + break; + } + case 15: + { + name = "air"; + break; + } + default: + name = "nothing"; + break; + } + return getUnlocalizedName() + "." + name; + } + + @Override + public int getMetadata(int par1) { + return par1; + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4) { + switch (itemstack.getItemDamage()) + { + case 0: + { + list.add(Config.compressedSolarOutput + " EU/T"); + break; + } + case 1: + { + list.add(Config.doubleCompressedSolarOutput + " EU/T"); + break; + } + case 2: + { + list.add(Config.tripleCompressedSolarOutput + " EU/T"); + break; + } + case 3: + { + list.add("Special Effect: " + Config.compressedSolarOutput + " EU/T when raining"); + break; + } + case 4: + { + list.add("Special Effect: " + Config.doubleCompressedSolarOutput + " EU/T when raining"); + break; + } + case 5: + { + list.add("Special Effect: " + Config.tripleCompressedSolarOutput + " EU/T when raining"); + break; + } + case 6: + { + list.add("Special Effect: " + Config.compressedSolarOutput + " EU/T at night"); + break; + } + case 7: + { + list.add("Special Effect: " + Config.doubleCompressedSolarOutput + " EU/T at night"); + break; + } + case 8: + { + list.add("Special Effect: " + Config.tripleCompressedSolarOutput + " EU/T at night"); + break; + } + case 9: + { + list.add("Normal Conditions: " + Config.compressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 3"); + break; + } + case 10: + { + list.add("Normal Conditions: " + Config.doubleCompressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 3"); + break; + } + + case 11: + { + list.add("Normal Conditions: " + Config.tripleCompressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 3"); + break; + } + case 12: + { + list.add("Normal Conditions: " + Config.compressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2 when located in the nether"); + break; + } + case 13: + { + list.add("Normal Conditions: " + Config.doubleCompressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2 when located in the nether"); + break; + } + case 14: + { + list.add("Normal Conditions: " + Config.tripleCompressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2 when lava is on top"); + list.add("Special Effect: Output multiplied by 2 when located in the nether"); + } + case 15: + { + list.add("Normal Conditions: " + Config.compressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2.5 when the block is over Y = 160"); + break; + } + default: + list.add("Didn't I forget a tooltip?"); + break; + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTSolars2.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTSolars2.java new file mode 100644 index 0000000..65473d8 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEMTSolars2.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class ItemBlockEMTSolars2 extends ItemBlock +{ + + public ItemBlockEMTSolars2(int par1) + { + super(par1); + setHasSubtypes(true); + } + + @Override + public String getUnlocalizedName(ItemStack itemstack) { + String name = ""; + switch (itemstack.getItemDamage()) + { + case 0: + { + name = "doubleair"; + break; + } + case 1: + { + name = "tripleair"; + break; + } + case 2: + { + name = "earth"; + break; + } + case 3: + { + name = "doubleearth"; + break; + } + case 4: + { + name = "tripleearth"; + break; + } + default: + name = "nothing"; + break; + } + return getUnlocalizedName() + "." + name; + } + + @Override + public int getMetadata(int par1) { + return par1; + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4) { + switch (itemstack.getItemDamage()) + { + case 0: + { + list.add("Normal Conditions: " + Config.doubleCompressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2.5 when the block is over Y = 160"); + break; + } + case 1: + { + list.add("Normal Conditions: " + Config.tripleCompressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2.5 when the block is over Y = 160"); + break; + } + case 2: + { + list.add("Normal Conditions: " + Config.compressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2.5 when the block is under Y = 10"); + break; + } + case 3: + { + list.add("Normal Conditions: " + Config.doubleCompressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2.5 when the block is under Y = 10"); + break; + } + case 4: + { + list.add("Normal Conditions: " + Config.tripleCompressedSolarOutput + " EU/T"); + list.add("Special Effect: Output multiplied by 2.5 when the block is under Y = 10"); + break; + } + default: + list.add("Didn't I forget a tooltip?"); + break; + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEssentiaGenerators.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEssentiaGenerators.java new file mode 100644 index 0000000..28828e1 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemBlockEssentiaGenerators.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items; + +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBlockEssentiaGenerators extends ItemBlock +{ + + public ItemBlockEssentiaGenerators(int par1) + { + super(par1); + setHasSubtypes(true); + } + + @Override + public String getUnlocalizedName(ItemStack itemstack) { + String name = ""; + switch (itemstack.getItemDamage()) + { + case 0: + { + name = "potentia"; + break; + } + case 1: + { + name = "ignis"; + break; + } + case 2: + { + name = "auram"; + break; + } + case 3: + { + name = "arbor"; + break; + } + case 4: + { + name = "saxum"; + break; + } + default: + name = "nothing"; + } + return getUnlocalizedName() + "." + name; + } + + @Override + public int getMetadata(int par1) { + return par1; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemEMTItems.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemEMTItems.java new file mode 100644 index 0000000..f75a5e4 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemEMTItems.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemEMTItems extends Item +{ + + public Icon[] icon = new Icon[16]; + + public ItemEMTItems(int id) + { + super(id); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(0); + this.setMaxStackSize(64); + setHasSubtypes(true); + } + + @Override + public String getUnlocalizedName(ItemStack itemstack) { + String name = ""; + switch (itemstack.getItemDamage()) + { + case 0: + { + name = "oreClusterUranium"; + break; + } + case 1: + { + name = "crushedOreAmber"; + break; + } + case 2: + { + name = "purifiedOreAmber"; + break; + } + case 3: + { + name = "crushedOreCinnabar"; + break; + } + case 4: + { + name = "purifiedOreCinnabar"; + break; + } + default: + name = "nothing"; + break; + } + return getUnlocalizedName() + "." + name; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister ri) { + this.icon[0] = ri.registerIcon("electricmagictools:clusteruranium"); + this.icon[1] = ri.registerIcon("electricmagictools:crushedamber"); + this.icon[2] = ri.registerIcon("electricmagictools:purifiedamber"); + this.icon[3] = ri.registerIcon("electricmagictools:crushedcinnabar"); + this.icon[4] = ri.registerIcon("electricmagictools:purifiedcinnabar"); + } + + @SideOnly(Side.CLIENT) + public Icon getIconFromDamage(int meta) { + return this.icon[meta]; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int id, CreativeTabs tabs, List list) { + // list.add(new ItemStack(this, 1, 0)); + list.add(new ItemStack(this, 1, 1)); + list.add(new ItemStack(this, 1, 2)); + list.add(new ItemStack(this, 1, 3)); + list.add(new ItemStack(this, 1, 4)); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemElectricScribingTools.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemElectricScribingTools.java new file mode 100644 index 0000000..8818f9b --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemElectricScribingTools.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import thaumcraft.api.IScribeTools; +import thaumcraft.common.items.ItemInkwell; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemElectricScribingTools extends ItemInkwell implements IElectricItem, IScribeTools +{ + + public static int maxCharge = 400; + + public ItemElectricScribingTools(int id) + { + super(id); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(400); + this.setMaxStackSize(1); + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 1; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 5; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemLightningSummoner.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemLightningSummoner.java new file mode 100644 index 0000000..8e5f364 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemLightningSummoner.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumMovingObjectType; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemLightningSummoner extends Item +{ + + public ItemLightningSummoner(int id) + { + super(id); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(1); + this.setMaxStackSize(64); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:lightningsummoner"); + } + + @Override + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { + player.swingItem(); + float f = 1.0F; + float f1 = player.prevRotationPitch + ((player.rotationPitch - player.prevRotationPitch) * f); + float f2 = player.prevRotationYaw + ((player.rotationYaw - player.prevRotationYaw) * f); + double d = player.prevPosX + ((player.posX - player.prevPosX) * f); + double d1 = (player.prevPosY + ((player.posY - player.prevPosY) * f) + 1.6200000000000001D) - player.yOffset; + double d2 = player.prevPosZ + ((player.posZ - player.prevPosZ) * f); + Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2); + float f3 = MathHelper.cos((-f2 * 0.01745329F) - 3.141593F); + float f4 = MathHelper.sin((-f2 * 0.01745329F) - 3.141593F); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f8 = f6; + float f9 = f3 * f5; + double d3 = 5000D; + Vec3 vec3d1 = vec3d.addVector(f7 * d3, f8 * d3, f9 * d3); + MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vec3d, vec3d1, false, true); + if (movingobjectposition == null) + { + return itemstack; + } + if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) + { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); + } else if (movingobjectposition.typeOfHit == EnumMovingObjectType.ENTITY) + { + Entity entityhit = movingobjectposition.entityHit; + double x = entityhit.posX; + double y = entityhit.posY; + double z = entityhit.posZ; + world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); + } + if (player.capabilities.isCreativeMode) + { + return itemstack; + } else + { + itemstack.damageItem(2, player); + return itemstack; + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemThaumiumPlate.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemThaumiumPlate.java new file mode 100644 index 0000000..539966a --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/ItemThaumiumPlate.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.item.Item; +import net.minecraftforge.oredict.OreDictionary; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemThaumiumPlate extends Item +{ + + public ItemThaumiumPlate(int id) + { + super(id); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(0); + this.setMaxStackSize(64); + OreDictionary.registerOre("plateThaumium", this); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:thaumiumplate"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemElectricBootsTraveller.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemElectricBootsTraveller.java new file mode 100644 index 0000000..431d639 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemElectricBootsTraveller.java @@ -0,0 +1,276 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + * + * Attention: this class originally belongs to the ThaumicTinkerer mod. + * All I did was modifying it to fulfill my needs. + * + * ThaumicTinkerer is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * http://www.minecraftforum.net/topic/1813058- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.armor; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.item.IMetalArmor; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumArmorMaterial; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.EventPriority; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import thaumcraft.api.IVisDiscountGear; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.Thaumcraft; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemElectricBootsTraveller extends ItemArmor implements IElectricItem, IVisDiscountGear, IMetalArmor, ISpecialArmor +{ + + public int maxCharge = 10000; + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static List playersWith1Step = new ArrayList(); + + public ItemElectricBootsTraveller(int id, int par3, int par4) + { + super(id, EnumArmorMaterial.DIAMOND, par3, par4); + this.setMaxDamage(27); + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTab.tabTombenpotter); + if (ticks()) + MinecraftForge.EVENT_BUS.register(this); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:electricboots"); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) { + return "electricmagictools:textures/models/electricboots.png"; + } + + boolean ticks() { + return true; + } + + @ForgeSubscribe + public void onEntityUpdate(LivingUpdateEvent event) { + if (event.entityLiving instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + ItemStack armor = player.getCurrentArmor(3 - armorType); + if (armor != null && armor.getItem() == this) + tickPlayer(player); + } + } + + void tickPlayer(EntityPlayer player) { + if (player.worldObj.isRemote) + player.stepHeight = player.isSneaking() ? 0.5F : 1F; + if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F) + player.moveFlying(0F, 1F, player.capabilities.isFlying ? 0.075F : 0.15F); + player.jumpMovementFactor = player.isSprinting() ? 0.05F : 0.04F; + player.fallDistance = 0F; + } + + @ForgeSubscribe + public void onPlayerJump(LivingJumpEvent event) { + if (event.entityLiving instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).itemID == itemID; + + if (hasArmor) + player.motionY += 0.3; + } + } + + @ForgeSubscribe(priority = EventPriority.HIGH) + public void onLivingUpdate(LivingUpdateEvent event) { + if (event.entityLiving instanceof EntityPlayer && event.entityLiving.worldObj.isRemote) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + + boolean highStepListed = playersWith1Step.contains(player.username); + boolean hasHighStep = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).itemID == itemID; + + if (hasHighStep && !highStepListed) + playersWith1Step.add(player.username); + + if (!hasHighStep && highStepListed) + { + playersWith1Step.remove(player.username); + player.stepHeight = 0.5F; + } + } + } + + @Override + public boolean isMetalArmor(ItemStack itemstack, EntityPlayer player) { + return true; + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 2; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 100; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } + + public int getEnergyPerDamage() { + return 100; + } + + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + if (source.isUnblockable()) + { + return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 3); + } else + { + double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio(); + int energyPerDamage = getEnergyPerDamage(); + int damageLimit = energyPerDamage <= 0 ? 0 : (25 * ElectricItem.manager.getCharge(armor)) / energyPerDamage; + return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(3, absorptionRatio, damageLimit); + } + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage()) + { + return (int) Math.round(20D * getBaseAbsorptionRatio() * getDamageAbsorptionRatio()); + } else + { + return 0; + } + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(), 0x7fffffff, true, false); + } + + public double getDamageAbsorptionRatio() { + return 1.1000000000000001D; + } + + private double getBaseAbsorptionRatio() { + return 0.14999999999999999D; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("Vis discount: 2%"); + } + + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return 2; + } + + @Override + public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { + if (Config.smoke == false && player.onGround == false) + { + int miny = (int) (player.boundingBox.minY - 2.0D); + Thaumcraft.proxy.smokeSpiral(player.worldObj, player.posX, player.boundingBox.minY + player.height / 2.0F, player.posZ, 1.5F, player.worldObj.rand.nextInt(620), miny); + } + } + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemElectricGoggles.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemElectricGoggles.java new file mode 100644 index 0000000..595c9ec --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemElectricGoggles.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.armor; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemElectricGoggles extends ItemQuantumThaumicHelmet +{ + + public int maxCharge = 10000; + + public ItemElectricGoggles(int id, int par3, int par4) + { + super(id, par3, par4); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:electricgoggles"); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) { + return "electricmagictools:textures/models/electricgoggles.png"; + } + + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return 5; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + public int getEnergyPerDamage() { + return 100; + } + + @Override + public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 10; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("Vis discount: 5%"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemNanoBootsTraveller.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemNanoBootsTraveller.java new file mode 100644 index 0000000..eda94ed --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemNanoBootsTraveller.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + * + * Attention: this class originally belongs to the ThaumicTinkerer mod. + * All I did was modifying it to fulfill my needs. + * + * ThaumicTinkerer is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * http://www.minecraftforum.net/topic/1813058- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.armor; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; +import thaumcraft.api.aspects.Aspect; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class ItemNanoBootsTraveller extends ItemElectricBootsTraveller +{ + + public int maxCharge = 500000; + + public ItemNanoBootsTraveller(int id, int par3, int par4) + { + super(id, par3, par4); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:nanobootstravel"); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) { + return "electricmagictools:textures/models/nanobootstravel.png"; + } + + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return 4; + } + + @Override + void tickPlayer(EntityPlayer player) { + if (player.worldObj.isRemote) + player.stepHeight = player.isSneaking() ? 0.5F : 1F; + if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F) + player.moveFlying(0F, 1F, (float) (player.capabilities.isFlying ? 0.075F : Config.nanoBootsSpeed)); + player.jumpMovementFactor = player.isSprinting() ? 0.05F : 0.04F; + player.fallDistance = 0F; + } + + @ForgeSubscribe + @Override + public void onPlayerJump(LivingJumpEvent event) { + if (event.entityLiving instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).itemID == itemID; + + if (hasArmor) + { + player.motionY += Config.nanoBootsJump; + } + } + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 1000; + } + + public int getEnergyPerDamage() { + return 200; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("Vis discount: 4%"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemNanoThaumicHelmet.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemNanoThaumicHelmet.java new file mode 100644 index 0000000..623e5de --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemNanoThaumicHelmet.java @@ -0,0 +1,102 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.armor; + +import ic2.api.item.ElectricItem; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemNanoThaumicHelmet extends ItemQuantumThaumicHelmet +{ + + public int maxCharge = 100000; + + public ItemNanoThaumicHelmet(int id, int par3, int par4) + { + super(id, par3, par4); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(27); + this.setMaxStackSize(1); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:nanothaumichelmet"); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) { + return "electricmagictools:textures/models/thaumicnanohelmet.png"; + } + + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return 6; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + public int getEnergyPerDamage() { + return 1000; + } + + @Override + public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { + if (Config.nightVisionOff == false) + { + if (ElectricItem.manager.canUse(itemStack, 1 / 1000)) + { + + int x = MathHelper.floor_double(player.posX); + int z = MathHelper.floor_double(player.posZ); + int y = MathHelper.floor_double(player.posY); + + int lightlevel = player.worldObj.getBlockLightValue(x, y, z); + if (lightlevel >= 0) + player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 300, -3)); + ElectricItem.manager.use(itemStack, 1 / 1000, player); + } else + { + player.addPotionEffect(new PotionEffect(Potion.blindness.id, 300, 0, true)); + } + } + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 100; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("Vis discount: 6%"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemQuantumBootsTraveller.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemQuantumBootsTraveller.java new file mode 100644 index 0000000..196c02c --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemQuantumBootsTraveller.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + * + * Attention: this class originally belongs to the ThaumicTinkerer mod. + * All I did was modifying it to fulfill my needs. + * + * ThaumicTinkerer is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * http://www.minecraftforum.net/topic/1813058- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.armor; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; +import thaumcraft.api.aspects.Aspect; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class ItemQuantumBootsTraveller extends ItemElectricBootsTraveller +{ + + public int maxCharge = 1000000; + + public ItemQuantumBootsTraveller(int id, int par3, int par4) + { + super(id, par3, par4); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:quantumbootstravel"); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) { + return "electricmagictools:textures/models/quantumbootstravel.png"; + } + + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return 5; + } + + @Override + void tickPlayer(EntityPlayer player) { + if (player.worldObj.isRemote) + player.stepHeight = player.isSneaking() ? 0.5F : 1F; + if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F) + player.moveFlying(0F, 1F, (float) (player.capabilities.isFlying ? 0.075F : Config.quantumBootsSpeed)); + player.jumpMovementFactor = player.isSprinting() ? 0.05F : 0.04F; + player.fallDistance = 0F; + } + + @ForgeSubscribe + @Override + public void onPlayerJump(LivingJumpEvent event) { + if (event.entityLiving instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).itemID == itemID; + + if (hasArmor) + { + player.motionY += Config.quantumBootsJump; + } + } + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 1000; + } + + public int getEnergyPerDamage() { + return 200; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("Vis discount: 5%"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemQuantumThaumicHelmet.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemQuantumThaumicHelmet.java new file mode 100644 index 0000000..e1b3aaa --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemQuantumThaumicHelmet.java @@ -0,0 +1,270 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.armor; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.item.IMetalArmor; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumArmorMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor; +import thaumcraft.api.IGoggles; +import thaumcraft.api.IVisDiscountGear; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.nodes.IRevealer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemQuantumThaumicHelmet extends ItemArmor implements IElectricItem, IVisDiscountGear, IGoggles, IRevealer, IMetalArmor, ISpecialArmor +{ + @SuppressWarnings({ "unchecked", "rawtypes" }) + private static final Map potionCost = new HashMap(); + + public ItemQuantumThaumicHelmet(int id, int par3, int par4) + { + super(id, EnumArmorMaterial.DIAMOND, par3, par4); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(27); + this.setMaxStackSize(1); + + potionCost.put(Integer.valueOf(Potion.poison.id), Integer.valueOf(10000)); + potionCost.put(Integer.valueOf(Potion.wither.id), Integer.valueOf(15000)); + potionCost.put(Integer.valueOf(Potion.confusion.id), Integer.valueOf(5000)); + } + + public int maxCharge = 10000000; + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:quantumthaumichelmet"); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) { + return "electricmagictools:textures/models/thaumicquantumhelmet.png"; + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 2; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { + int refill = player.getAir(); + if (ElectricItem.manager.canUse(itemStack, 1000) && refill < 100) + { + player.setAir(refill + 200); + ElectricItem.manager.use(itemStack, 1000, null); + } + + Iterator i$ = (new LinkedList(player.getActivePotionEffects())).iterator(); + do + { + if (!i$.hasNext()) + { + break; + } + { + PotionEffect effect = (PotionEffect) i$.next(); + int id = effect.getPotionID(); + Integer cost = (Integer) potionCost.get(Integer.valueOf(id)); + if (cost != null) + { + cost = Integer.valueOf(cost.intValue() * (effect.getAmplifier() + 1)); + if (ElectricItem.manager.canUse(itemStack, cost.intValue())) + { + ElectricItem.manager.use(itemStack, cost.intValue(), null); + ItemStack milk = (new ItemStack(Item.bucketMilk)); + player.curePotionEffects(milk); + } + } + } + } while (true); + + if (Config.nightVisionOff == false) + { + if (ElectricItem.manager.canUse(itemStack, 1 / 1000)) + { + int x = MathHelper.floor_double(player.posX); + int z = MathHelper.floor_double(player.posZ); + int y = MathHelper.floor_double(player.posY); + int lightlevel = player.worldObj.getBlockLightValue(x, y, z); + if (lightlevel >= 0) + player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 300, -3)); + ElectricItem.manager.use(itemStack, 1 / 1000, player); + } else + { + player.addPotionEffect(new PotionEffect(Potion.blindness.id, 300, 0, true)); + } + } + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 10000; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("Vis discount: 8%"); + } + + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return 8; + } + + @Override + public boolean showNodes(ItemStack itemstack, EntityLivingBase player) { + return true; + } + + @Override + public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) { + return true; + } + + @Override + public boolean isMetalArmor(ItemStack itemstack, EntityPlayer player) { + return true; + } + + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + if (source.isUnblockable()) + { + return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 0); + } else + { + double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio(); + int energyPerDamage = getEnergyPerDamage(); + int damageLimit = energyPerDamage <= 0 ? 0 : (25 * ElectricItem.manager.getCharge(armor)) / energyPerDamage; + return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, absorptionRatio, damageLimit); + } + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage()) + { + return (int) Math.round(20D * getBaseAbsorptionRatio() * getDamageAbsorptionRatio()); + } else + { + return 0; + } + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(), 0x7fffffff, true, false); + } + + public double getDamageAbsorptionRatio() { + return 1.1000000000000001D; + } + + public int getEnergyPerDamage() { + return 10000; + } + + private double getBaseAbsorptionRatio() { + return 0.14999999999999999D; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemSolarHelmetRevealing.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemSolarHelmetRevealing.java new file mode 100644 index 0000000..82c4ba8 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/armor/ItemSolarHelmetRevealing.java @@ -0,0 +1,356 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.armor; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumArmorMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor; +import thaumcraft.api.IGoggles; +import thaumcraft.api.IVisDiscountGear; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.nodes.IRevealer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemSolarHelmetRevealing extends ItemArmor implements ISpecialArmor, IRevealer, IVisDiscountGear, IGoggles, IElectricItem +{ + + public int maxCharge = 10000000; + private int ticker; + private int generating; + private int genDay; + private int genNight; + private boolean sunIsUp; + private boolean skyIsVisible; + private boolean noSunWorld; + private boolean dampPlace; + + @SuppressWarnings("rawtypes") + private static final Map potionCost = new HashMap(); + + @SuppressWarnings("unchecked") + public ItemSolarHelmetRevealing(int id, int par3, int par4) + { + super(id, EnumArmorMaterial.IRON, par3, par4); + this.setMaxDamage(27); + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.maxCharge = 1000000; + this.genDay = 256; + this.genNight = 128; + + potionCost.put(Integer.valueOf(Potion.poison.id), Integer.valueOf(10000)); + potionCost.put(Integer.valueOf(Potion.wither.id), Integer.valueOf(15000)); + potionCost.put(Integer.valueOf(Potion.confusion.id), Integer.valueOf(5000)); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layerType) { + return "electricmagictools:textures/models/solarrevealinghelmet.png"; + } + + @SuppressWarnings("unchecked") + @Override + public void onArmorTickUpdate(World worldObj, EntityPlayer player, ItemStack itemStack) { + if (Config.nightVisionOff == false) + { + if (ElectricItem.manager.canUse(itemStack, 1 / 1000)) + { + + int x = MathHelper.floor_double(player.posX); + int z = MathHelper.floor_double(player.posZ); + int y = MathHelper.floor_double(player.posY); + + int lightlevel = player.worldObj.getBlockLightValue(x, y, z); + if (lightlevel >= 0) + player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 300, -3)); + ElectricItem.manager.use(itemStack, 1 / 1000, player); + } else + { + player.addPotionEffect(new PotionEffect(Potion.blindness.id, 300, 0, true)); + } + } + + int refill = player.getAir(); + if (ElectricItem.manager.canUse(itemStack, 1000) && refill < 100) + { + player.setAir(refill + 200); + ElectricItem.manager.use(itemStack, 1000, null); + } + + @SuppressWarnings("rawtypes") + Iterator i$ = (new LinkedList(player.getActivePotionEffects())).iterator(); + do + { + if (!i$.hasNext()) + { + break; + } + { + PotionEffect effect = (PotionEffect) i$.next(); + int id = effect.getPotionID(); + Integer cost = (Integer) potionCost.get(Integer.valueOf(id)); + if (cost != null) + { + cost = Integer.valueOf(cost.intValue() * (effect.getAmplifier() + 1)); + if (ElectricItem.manager.canUse(itemStack, cost.intValue())) + { + ElectricItem.manager.use(itemStack, cost.intValue(), null); + ItemStack milk = (new ItemStack(Item.bucketMilk)); + player.curePotionEffects(milk); + } + } + } + } while (true); + + if (worldObj.isRemote) + { + return; + } + checkForSun(player); + if (this.generating > 0) + { + int energyLeft = this.generating; + for (int i = 0; i < player.inventory.armorInventory.length; i++) + { + if (energyLeft > 0) + { + if ((player.inventory.armorInventory[i] != null) && ((Item.itemsList[player.inventory.armorInventory[i].itemID] instanceof IElectricItem))) + { + int sentPacket = ElectricItem.manager.charge(player.inventory.armorInventory[i], energyLeft, 4, false, false); + energyLeft -= sentPacket; + } + } else + { + return; + } + } + for (int j = 0; j < player.inventory.mainInventory.length; j++) + { + if (energyLeft > 0) + { + if ((player.inventory.mainInventory[j] != null) && ((Item.itemsList[player.inventory.mainInventory[j].itemID] instanceof IElectricItem))) + { + int sentPacket = ElectricItem.manager.charge(player.inventory.mainInventory[j], energyLeft, 4, false, false); + energyLeft -= sentPacket; + } + } else + { + return; + } + } + } + } + + public int checkForSun(EntityPlayer player) { + if (this.ticker++ % tickRate() == 0) + { + updateVisibility(player); + } + if ((this.sunIsUp) && (this.skyIsVisible)) + { + this.generating = (0 + this.genDay); + return this.generating; + } + if (this.skyIsVisible) + { + this.generating = (0 + this.genNight); + return this.generating; + } + this.generating = 0; + return this.generating; + } + + public void updateVisibility(EntityPlayer player) { + this.dampPlace = (player.worldObj.getWorldChunkManager().getBiomeGenAt((int) player.posX, (int) player.posZ).getIntRainfall() > 0); + this.noSunWorld = player.worldObj.provider.hasNoSky; + Boolean rainWeather = Boolean.valueOf((this.dampPlace) && ((player.worldObj.isRaining()) || (player.worldObj.isThundering()))); + if ((!player.worldObj.isDaytime()) || (rainWeather.booleanValue())) + { + this.sunIsUp = false; + } else + { + this.sunIsUp = true; + } + if ((!player.worldObj.canBlockSeeTheSky((int) player.posX, (int) player.posY + 1, (int) player.posZ)) || (this.noSunWorld)) + { + this.skyIsVisible = false; + } else + { + this.skyIsVisible = true; + } + } + + public static int tickRate() { + return 128; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:solarrevealinghelmet"); + } + + @Override + public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) { + return true; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("Vis discount: 7%"); + } + + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return 7; + } + + @Override + public boolean showNodes(ItemStack itemstack, EntityLivingBase player) { + return true; + } + + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + if (source.isUnblockable()) + { + return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 0); + } else + { + double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio(); + int energyPerDamage = getEnergyPerDamage(); + int damageLimit = energyPerDamage <= 0 ? 0 : (25 * ElectricItem.manager.getCharge(armor)) / energyPerDamage; + return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, absorptionRatio, damageLimit); + } + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage()) + { + return (int) Math.round(20D * getBaseAbsorptionRatio() * getDamageAbsorptionRatio()); + } else + { + return 0; + } + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(), 0x7fffffff, true, false); + } + + public double getDamageAbsorptionRatio() { + return 1.1000000000000001D; + } + + public int getEnergyPerDamage() { + return 10000; + } + + private double getBaseAbsorptionRatio() { + return 0.14999999999999999D; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return true; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 1; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 1000; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemBaseFocus.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemBaseFocus.java new file mode 100644 index 0000000..0558ccd --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemBaseFocus.java @@ -0,0 +1,145 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.foci; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.wands.IWandFocus; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public abstract class ItemBaseFocus extends Item implements IWandFocus +{ + + private Icon ornament, depth; + + public ItemBaseFocus(int id) + { + super(id); + this.setMaxDamage(1); + this.setNoRepair(); + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTab.tabTombenpotter); + } + + boolean hasOrnament() { + return false; + } + + boolean hasDepth() { + return false; + } + + @Override + public int getFocusColor() { + return 0; + } + + @Override + public boolean isItemTool(ItemStack par1ItemStack) { + return true; + } + + @Override + public EnumRarity getRarity(ItemStack itemstack) { + return EnumRarity.rare; + } + + @Override + public Icon getFocusDepthLayerIcon() { + return depth; + } + + @Override + public Icon getOrnament() { + return ornament; + } + + @Override + public WandFocusAnimation getAnimation() { + return WandFocusAnimation.WAVE; + } + + @Override + public AspectList getVisCost() { + return null; + } + + public boolean isUseItem() { + return isVisCostPerTick(); + } + + @Override + public boolean isVisCostPerTick() { + return false; + } + + @Override + public ItemStack onFocusRightClick(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, MovingObjectPosition paramMovingObjectPosition) { + if (isUseItem()) + paramEntityPlayer.setItemInUse(paramItemStack, Integer.MAX_VALUE); + return paramItemStack; + } + + @Override + public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int count) { + + } + + @Override + public void onPlayerStoppedUsingFocus(ItemStack itemstack, World world, EntityPlayer player, int count) { + } + + @Override + public String getSortingHelper(ItemStack itemstack) { + return "00"; + } + + @Override + public boolean onFocusBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) { + return false; + } + + @Override + public boolean acceptsEnchant(int id) { + return false; + } + + @Override + public int getItemEnchantability() { + return 5; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + AspectList cost = getVisCost(); + if (cost != null && cost.size() > 0) + { + list.add(StatCollector.translateToLocal(isVisCostPerTick() ? "item.Focus.cost2" : "item.Focus.cost1")); + for (Aspect aspect : cost.getAspectsSorted()) + { + float amount = cost.getAmount(aspect) / 100.0F; + list.add(" " + '\u00a7' + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + amount); + } + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemChargeFocus.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemChargeFocus.java new file mode 100644 index 0000000..f15baec --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemChargeFocus.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.foci; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.items.wands.ItemWandCasting; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class ItemChargeFocus extends ItemBaseFocus +{ + + private static final AspectList visCost = new AspectList().add(Aspect.FIRE, 10).add(Aspect.WATER, 10).add(Aspect.AIR, 10).add(Aspect.EARTH, 10).add(Aspect.ORDER, 10).add(Aspect.ENTROPY, 10); + + public ItemChargeFocus(int id) + { + super(id); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:chargefocus"); + } + + @Override + public int getFocusColor() { + return 0xFFFF00; + } + + @Override + public AspectList getVisCost() { + return visCost; + } + + @Override + public String getSortingHelper(ItemStack itemstack) { + return "CHARGING"; + } + + @Override + public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { + ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); + if (wand.consumeAllVis(itemstack, player, getVisCost(), true)) + { + if (!world.isRemote) + { + + int energyLeft = Config.chargeFocusProduction; + for (int i = 0; i < player.inventory.armorInventory.length; i++) + { + if (energyLeft > 0) + { + if ((player.inventory.armorInventory[i] != null) && ((Item.itemsList[player.inventory.armorInventory[i].itemID] instanceof IElectricItem))) + { + int sentPacket = ElectricItem.manager.charge(player.inventory.armorInventory[i], energyLeft, 4, false, false); + energyLeft -= sentPacket; + } + } else + { + return itemstack; + } + } + for (int j = 0; j < player.inventory.mainInventory.length; j++) + { + if (energyLeft > 0) + { + if ((player.inventory.mainInventory[j] != null) && ((Item.itemsList[player.inventory.mainInventory[j].itemID] instanceof IElectricItem))) + { + int sentPacket = ElectricItem.manager.charge(player.inventory.mainInventory[j], energyLeft, 4, false, false); + energyLeft -= sentPacket; + } + } else + { + return itemstack; + } + } + } + } + return itemstack; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemChristmasFocus.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemChristmasFocus.java new file mode 100644 index 0000000..460353a --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemChristmasFocus.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.foci; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.items.wands.ItemWandCasting; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemChristmasFocus extends ItemBaseFocus +{ + + private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 500).add(Aspect.AIR, 500); + + public ItemChristmasFocus(int id) + { + super(id); + } + + @Override + public int getFocusColor() { + return 99999999; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:christmasfocus"); + } + + @Override + public AspectList getVisCost() { + return visCost; + } + + @Override + public String getSortingHelper(ItemStack itemstack) { + return "CHRISTMAS"; + } + + @Override + public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { + ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); + if (wand.consumeAllVis(itemstack, player, getVisCost(), true)) + { + if (!world.isRemote) + { + EntitySnowman snowman; + snowman = new EntitySnowman(world); + snowman.setPosition(player.posX + 2, player.posY + 1, player.posZ + 2); + world.spawnEntityInWorld(snowman); + } + } + return itemstack; + } + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemExplosionFocus.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemExplosionFocus.java new file mode 100644 index 0000000..57d4ffa --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemExplosionFocus.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.foci; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.items.wands.ItemWandCasting; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.entities.EntityLaser; + +public class ItemExplosionFocus extends ItemBaseFocus +{ + + private static final AspectList visCost = new AspectList().add(Aspect.FIRE, 200).add(Aspect.ENTROPY, 200); + + public ItemExplosionFocus(int id) + { + super(id); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:explosionfocus"); + } + + @Override + public int getFocusColor() { + return 9990; + } + + @Override + public AspectList getVisCost() { + return visCost; + } + + @Override + public String getSortingHelper(ItemStack itemstack) { + return "EXPLOSION"; + } + + @Override + public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { + ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); + if (wand.consumeAllVis(itemstack, player, getVisCost(), true)) + { + if (!world.isRemote) + { + EntityLaser laser; + laser = new EntityLaser(world, player, 2); + world.spawnEntityInWorld(laser); + } + } + return itemstack; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemShieldFocus.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemShieldFocus.java new file mode 100644 index 0000000..7cbeb3f --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/foci/ItemShieldFocus.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.foci; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.items.wands.ItemWandCasting; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; + +public class ItemShieldFocus extends ItemBaseFocus +{ + + private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 10).add(Aspect.WATER, 10).add(Aspect.AIR, 10); + + public ItemShieldFocus(int id) + { + super(id); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:shieldfocus"); + } + + @Override + public int getFocusColor() { + return 555555555; + } + + @Override + public boolean isUseItem() { + return true; + } + + @Override + public AspectList getVisCost() { + return visCost; + } + + @Override + public String getSortingHelper(ItemStack itemstack) { + return "SHIELD"; + } + + @Override + public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int time) { + player.motionX = 0.0D; + player.motionY = 0.0D; + player.motionZ = 0.0D; + + ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); + if (wand.consumeAllVis(itemstack, player, getVisCost(), true)) + { + int x = MathHelper.floor_double(player.posX); + int y = MathHelper.floor_double(player.posY); + int z = MathHelper.floor_double(player.posZ); + + if (wand.consumeAllVis(itemstack, player, getVisCost(), true)) + { + // Player Level + if (player.worldObj.isAirBlock(x + 1, y, z) && player.worldObj.isAirBlock(x - 1, y, z) && player.worldObj.isAirBlock(x, y, z + 1) && player.worldObj.isAirBlock(x, y, z - 1)) + { + player.worldObj.setBlock(x + 1, y, z, BlockRegistry.shield.blockID); + player.worldObj.setBlock(x - 1, y, z, BlockRegistry.shield.blockID); + player.worldObj.setBlock(x, y, z + 1, BlockRegistry.shield.blockID); + player.worldObj.setBlock(x, y, z - 1, BlockRegistry.shield.blockID); + } + + // Above the player + if (player.worldObj.isAirBlock(x + 1, y + 1, z) && player.worldObj.isAirBlock(x - 1, y + 1, z) && player.worldObj.isAirBlock(x, y + 1, z + 1) && player.worldObj.isAirBlock(x, y + 1, z - 1)) + { + player.worldObj.setBlock(x + 1, y + 1, z, BlockRegistry.shield.blockID); + player.worldObj.setBlock(x - 1, y + 1, z, BlockRegistry.shield.blockID); + player.worldObj.setBlock(x, y + 1, z + 1, BlockRegistry.shield.blockID); + player.worldObj.setBlock(x, y + 1, z - 1, BlockRegistry.shield.blockID); + } + } + + } + } + + @Override + public void onPlayerStoppedUsingFocus(ItemStack itemstack, World world, EntityPlayer player, int count) { + int x = MathHelper.floor_double(player.posX); + int y = MathHelper.floor_double(player.posY); + int z = MathHelper.floor_double(player.posZ); + + // Player Level + if ((player.worldObj.getBlockId(x + 1, y, z) == BlockRegistry.shield.blockID) && (player.worldObj.getBlockId(x - 1, y, z) == BlockRegistry.shield.blockID) && (player.worldObj.getBlockId(x, y, z + 1) == BlockRegistry.shield.blockID) && (player.worldObj.getBlockId(x, y, z - 1) == BlockRegistry.shield.blockID)) + { + player.worldObj.setBlock(x + 1, y, z, 0); + player.worldObj.setBlock(x - 1, y, z, 0); + player.worldObj.setBlock(x, y, z + 1, 0); + player.worldObj.setBlock(x, y, z - 1, 0); + } + + // Above the player + if ((player.worldObj.getBlockId(x + 1, y + 1, z) == BlockRegistry.shield.blockID) && (player.worldObj.getBlockId(x - 1, y + 1, z) == BlockRegistry.shield.blockID) && (player.worldObj.getBlockId(x, y + 1, z + 1) == BlockRegistry.shield.blockID) && (player.worldObj.getBlockId(x, y + 1, z - 1) == BlockRegistry.shield.blockID)) + { + player.worldObj.setBlock(x + 1, y + 1, z, 0); + player.worldObj.setBlock(x - 1, y + 1, z, 0); + player.worldObj.setBlock(x, y + 1, z + 1, 0); + player.worldObj.setBlock(x, y + 1, z - 1, 0); + } + + ItemStack milk = (new ItemStack(Item.bucketMilk)); + player.curePotionEffects(milk); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemDiamondChainsaw.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemDiamondChainsaw.java new file mode 100644 index 0000000..4900927 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemDiamondChainsaw.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemDiamondChainsaw extends ItemThaumiumChainsaw +{ + + public int maxCharge = 40000; + private final int cost = 200; + private final int hitCost = 300; + + public ItemDiamondChainsaw(int id) + { + super(id); + this.efficiencyOnProperMaterial = 16F; + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(27); + this.setMaxStackSize(1); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:diamondchainsaw"); + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 300; + } + + @Override + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { + ElectricItem.manager.use(par1ItemStack, cost, par7EntityLivingBase); + return true; + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return Item.axeDiamond.canHarvestBlock(block) || Item.swordDiamond.canHarvestBlock(block); + } + + @Override + public float getStrVsBlock(ItemStack stack, Block block, int meta) { + if (!ElectricItem.manager.canUse(stack, cost)) + { + return 1.0F; + } + + if (Item.axeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.swordWood.getStrVsBlock(stack, block, meta) > 1.0F) + { + return efficiencyOnProperMaterial; + } else + { + return super.getStrVsBlock(stack, block, meta); + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + if (ElectricItem.manager.use(itemstack, hitCost, attacker)) + { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F); + } + return false; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemElectricHoeGrowth.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemElectricHoeGrowth.java new file mode 100644 index 0000000..24901b2 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemElectricHoeGrowth.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import thaumcraft.common.items.equipment.ItemElementalHoe; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemElectricHoeGrowth extends ItemElementalHoe implements IElectricItem +{ + + public Icon icon; + public int maxCharge = 1000000; + public int growthCost = 1000; + public int tillCost = 100; + + public ItemElectricHoeGrowth(int id) + { + super(id, EnumToolMaterial.EMERALD); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxStackSize(1); + } + + /** + * @SideOnly(Side.CLIENT) + * @Override public void registerIcons(IconRegister iconRegister) { this.icon = iconRegister .registerIcon("electricmagictools:electrichoegrowth"); } + **/ + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return this.itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return this.itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 3; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 1000; + } + + @Override + public boolean isRepairable() { + return false; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolDiamond.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolDiamond.java new file mode 100644 index 0000000..97f59f9 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolDiamond.java @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemOmnitoolDiamond extends ItemOmnitoolIron +{ + + public int maxCharge = 70000; + private int cost; + private final int hitCost = 250; + + public ItemOmnitoolDiamond(int id) + { + super(id); + this.efficiencyOnProperMaterial = 16F; + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxStackSize(1); + if (Config.toolsInBore == false) + { + this.setMaxDamage(27); + } else + { + this.setMaxDamage(350); + } + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:diamondomnitool"); + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 400; + } + + @Override + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { + if (Config.toolsInBore == false) + { + cost = 200; + } else + { + cost = 1; + } + ElectricItem.manager.use(par1ItemStack, cost, par7EntityLivingBase); + return true; + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return Item.axeDiamond.canHarvestBlock(block) || Item.swordDiamond.canHarvestBlock(block) || Item.pickaxeDiamond.canHarvestBlock(block) || Item.shovelDiamond.canHarvestBlock(block) || Item.shears.canHarvestBlock(block); + } + + @Override + public float getStrVsBlock(ItemStack stack, Block block, int meta) { + if (!ElectricItem.manager.canUse(stack, cost)) + { + return 1.0F; + } + + if (Item.axeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.swordWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.pickaxeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.shovelWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.shears.getStrVsBlock(stack, block, meta) > 1.0F) + { + return efficiencyOnProperMaterial; + } else + { + return super.getStrVsBlock(stack, block, meta); + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + if (ElectricItem.manager.use(itemstack, hitCost, attacker)) + { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 10F); + } + return false; + } + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolIron.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolIron.java new file mode 100644 index 0000000..ffbed4e --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolIron.java @@ -0,0 +1,215 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemPickaxe; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import net.minecraftforge.event.ForgeEventFactory; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemOmnitoolIron extends ItemPickaxe implements IElectricItem +{ + + public int maxCharge = 20000; + private int cost; + private final int hitCost = 125; + + public ItemOmnitoolIron(int id) + { + super(id, EnumToolMaterial.EMERALD); + this.efficiencyOnProperMaterial = 13F; + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxStackSize(1); + if (Config.toolsInBore == false) + { + this.setMaxDamage(27); + } else + { + this.setMaxDamage(200); + } + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:ironomnitool"); + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return this.itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return this.itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 2; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 200; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @Override + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { + if (Config.toolsInBore == false) + { + cost = 100; + } else + { + cost = 1; + } + ElectricItem.manager.use(par1ItemStack, cost, par7EntityLivingBase); + return true; + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return Item.axeIron.canHarvestBlock(block) || Item.swordIron.canHarvestBlock(block) || Item.pickaxeIron.canHarvestBlock(block) || Item.shovelIron.canHarvestBlock(block) || Item.shears.canHarvestBlock(block); + } + + @Override + public float getStrVsBlock(ItemStack stack, Block block, int meta) { + if (!ElectricItem.manager.canUse(stack, cost)) + { + return 1.0F; + } + + if (Item.axeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.swordWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.pickaxeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.shovelWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.shears.getStrVsBlock(stack, block, meta) > 1.0F) + { + return efficiencyOnProperMaterial; + } else + { + return super.getStrVsBlock(stack, block, meta); + } + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + if (ElectricItem.manager.use(itemstack, hitCost, attacker)) + { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F); + } + return false; + } + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { + for (int i = 0; i < player.inventory.mainInventory.length; i++) + { + ItemStack torchStack = player.inventory.mainInventory[i]; + if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) + { + continue; + } + Item item = torchStack.getItem(); + if (!(item instanceof ItemBlock)) + { + continue; + } + int oldMeta = torchStack.getItemDamage(); + int oldSize = torchStack.stackSize; + boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset); + if (player.capabilities.isCreativeMode) + { + torchStack.setItemDamage(oldMeta); + torchStack.stackSize = oldSize; + } else if (torchStack.stackSize <= 0) + { + ForgeEventFactory.onPlayerDestroyItem(player, torchStack); + player.inventory.mainInventory[i] = null; + } + if (result) + { + return true; + } + } + + return super.onItemUse(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolThaumium.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolThaumium.java new file mode 100644 index 0000000..49d28cd --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemOmnitoolThaumium.java @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemOmnitoolThaumium extends ItemOmnitoolDiamond +{ + + public int maxCharge = 140000; + private int cost; + private final int hitCost = 650; + + public ItemOmnitoolThaumium(int id) + { + super(id); + this.efficiencyOnProperMaterial = 21F; + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxStackSize(1); + if (Config.toolsInBore == false) + { + this.setMaxDamage(27); + } else + { + this.setMaxDamage(467); + } + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:thaumiumomnitool"); + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 800; + } + + @Override + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { + if (Config.toolsInBore == false) + { + cost = 300; + } else + { + cost = 1; + } + ElectricItem.manager.use(par1ItemStack, cost, par7EntityLivingBase); + return true; + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return Item.axeDiamond.canHarvestBlock(block) || Item.swordDiamond.canHarvestBlock(block) || Item.pickaxeDiamond.canHarvestBlock(block) || Item.shovelDiamond.canHarvestBlock(block) || Item.shears.canHarvestBlock(block); + } + + @Override + public float getStrVsBlock(ItemStack stack, Block block, int meta) { + if (!ElectricItem.manager.canUse(stack, cost)) + { + return 1.0F; + } + + if (Item.axeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.swordWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.pickaxeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.shovelWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.shears.getStrVsBlock(stack, block, meta) > 1.0F) + { + return efficiencyOnProperMaterial; + } else + { + return super.getStrVsBlock(stack, block, meta); + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + if (ElectricItem.manager.use(itemstack, hitCost, attacker)) + { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 10F); + } + return false; + } + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemRockbreakerDrill.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemRockbreakerDrill.java new file mode 100644 index 0000000..fc26333 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemRockbreakerDrill.java @@ -0,0 +1,355 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + * + * This class originally belongs to Azanor, but with his permission I took it, and modified it to make it work as I wanted to. + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemPickaxe; +import net.minecraft.item.ItemSpade; +import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumMovingObjectType; +import net.minecraft.util.Icon; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.event.ForgeEventFactory; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.entities.EntityFollowingItem; +import thaumcraft.common.lib.Utils; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemRockbreakerDrill extends ItemPickaxe implements IElectricItem +{ + + public Icon icon; + int side; + + public ItemRockbreakerDrill(int id) + { + super(id, EnumToolMaterial.EMERALD); + side = 0; + setCreativeTab(CreativeTab.tabTombenpotter); + this.efficiencyOnProperMaterial = 25F; + this.setMaxStackSize(1); + if (Config.toolsInBore == false) + { + this.setMaxDamage(27); + } else + { + this.setMaxDamage(2571); + } + } + + public int maxCharge = 900000; + private int cost; + private final int searchCost = 1000; + private final int hitCost = 400; + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:rockbreakerdrill"); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @SuppressWarnings("unused") + private boolean isEffectiveAgainst(Block block) { + label0: + { + int var3 = 0; + do + { + ItemRockbreakerDrill _tmp = this; + if (var3 >= ItemPickaxe.blocksEffectiveAgainst.length && var3 >= ItemSpade.blocksEffectiveAgainst.length) + { + break label0; + } + ItemRockbreakerDrill _tmp1 = this; + if (ItemPickaxe.blocksEffectiveAgainst[var3] == block) + { + return true; + } + var3++; + } while (true); + } + return false; + } + + @Override + public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) { + MovingObjectPosition movingobjectposition = Utils.getTargetBlock(((Entity) (player)).worldObj, player, true); + if (movingobjectposition != null && movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) + { + side = movingobjectposition.sideHit; + } + return super.onBlockStartBreak(itemstack, X, Y, Z, player); + } + + @SuppressWarnings("rawtypes") + @Override + public boolean onBlockDestroyed(ItemStack stack, World world, int bi, int x, int y, int z, EntityLivingBase ent) { + if (Config.toolsInBore == false) + { + cost = 350; + } else + { + cost = 1; + } + if (ent.isSneaking()) + { + return super.onBlockDestroyed(stack, world, bi, x, y, z, ent); + } + int md = world.getBlockMetadata(x, y, z); + if (ForgeHooks.isToolEffective(stack, Block.blocksList[bi], md) || isEffectiveAgainst(Block.blocksList[bi])) + { + for (int aa = -1; aa <= 1; aa++) + { + for (int bb = -1; bb <= 1; bb++) + { + int xx = 0; + int yy = 0; + int zz = 0; + if (side <= 1) + { + xx = aa; + zz = bb; + } else if (side <= 3) + { + xx = aa; + yy = bb; + } else + { + zz = aa; + yy = bb; + } + int bl = world.getBlockId(x + xx, y + yy, z + zz); + md = world.getBlockMetadata(x + xx, y + yy, z + zz); + if (!ForgeHooks.isToolEffective(stack, Block.blocksList[bl], md) && !isEffectiveAgainst(Block.blocksList[bl])) + { + continue; + } + if (ElectricItem.manager.canUse(stack, cost)) + { + ElectricItem.manager.use(stack, cost, ent); + } + if (((Entity) (ent)).worldObj.isRemote) + { + world.playAuxSFX(2001, x + xx, y + yy, z + zz, bl + (md << 12)); + } + int fortune = EnchantmentHelper.getFortuneModifier(ent); + world.setBlock(x + xx, y + yy, z + zz, 0, 0, 3); + ArrayList ret = Block.blocksList[bl].getBlockDropped(world, x + xx, y + yy, z + zz, md, fortune); + boolean creative = false; + if ((ent instanceof EntityPlayer) && ((EntityPlayer) ent).capabilities.isCreativeMode) + { + creative = true; + } + if (ret.size() <= 0 || creative || ((Entity) (ent)).worldObj.isRemote) + { + continue; + } + ItemStack is; + for (Iterator i$ = ret.iterator(); i$.hasNext(); world.spawnEntityInWorld(new EntityFollowingItem(world, (double) x + (double) xx + 0.5D, (double) y + (double) yy + 0.5D, (double) z + (double) zz + 0.5D, is, ent, 3))) + { + is = (ItemStack) i$.next(); + } + } + } + } + return true; + } + + @SuppressWarnings("unused") + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { + if (!player.isSneaking()) + { + for (int i = 0; i < player.inventory.mainInventory.length; i++) + { + ItemStack torchStack = player.inventory.mainInventory[i]; + if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) + { + continue; + } + Item item = torchStack.getItem(); + if (!(item instanceof ItemBlock)) + { + continue; + } + int oldMeta = torchStack.getItemDamage(); + int oldSize = torchStack.stackSize; + boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset); + if (player.capabilities.isCreativeMode) + { + torchStack.setItemDamage(oldMeta); + torchStack.stackSize = oldSize; + } else if (torchStack.stackSize <= 0) + { + ForgeEventFactory.onPlayerDestroyItem(player, torchStack); + player.inventory.mainInventory[i] = null; + } + if (result) + { + return true; + } + } + } else + { + ElectricItem.manager.use(stack, searchCost, player); + if (!world.isRemote) + { + world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "thaumcraft:wandfail", 0.2F, 0.2F + world.rand.nextFloat() * 0.2F); + return super.onItemUse(stack, player, world, x, y, z, side, xOffset, xOffset, zOffset); + } + Minecraft mc = Minecraft.getMinecraft(); + Thaumcraft.instance.renderEventHandler.startScan(player, x, y, z, System.currentTimeMillis() + 5000L); + + player.swingItem(); + return super.onItemUse(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); + } + + return super.onItemUse(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); + } + + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { + if (!((Entity) (player)).worldObj.isRemote && (!(entity instanceof EntityPlayer) || MinecraftServer.getServer().isPVPEnabled())) + { + entity.setFire(2); + } + return super.onLeftClickEntity(stack, player, entity); + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + if (ElectricItem.manager.use(itemstack, hitCost, attacker)) + { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F); + } + return false; + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 3; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 900; + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return Item.pickaxeDiamond.canHarvestBlock(block) || Item.shovelDiamond.canHarvestBlock(block); + } + + @Override + public float getStrVsBlock(ItemStack stack, Block block, int meta) { + if (!ElectricItem.manager.canUse(stack, cost)) + { + return 1.0F; + } + + if (Item.pickaxeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.shovelWood.getStrVsBlock(stack, block, meta) > 1.0F) + { + return efficiencyOnProperMaterial; + } else + { + return super.getStrVsBlock(stack, block, meta); + } + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemStreamChainsaw.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemStreamChainsaw.java new file mode 100644 index 0000000..3dc3223 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemStreamChainsaw.java @@ -0,0 +1,221 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + * + * This class originally belongs to Azanor, but with his permission I took it, and modified it to make it work as I wanted to. + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemAxe; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import thaumcraft.common.lib.PacketHandler; +import thaumcraft.common.lib.Utils; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemStreamChainsaw extends ItemAxe implements IElectricItem +{ + + boolean alternateServer; + boolean alternateClient; + @SuppressWarnings("rawtypes") + public static ArrayList oreDictLogs = new ArrayList(); + public int maxCharge = 900000; + private final int cost = 400; + private final int hitCost = 500; + + public ItemStreamChainsaw(int id) + { + super(id, EnumToolMaterial.EMERALD); + this.efficiencyOnProperMaterial = 25F; + alternateServer = false; + alternateClient = false; + setCreativeTab(CreativeTab.tabTombenpotter); + this.maxStackSize = 1; + this.setMaxDamage(27); + } + + public EnumAction getItemUseAction(ItemStack itemstack) { + return EnumAction.bow; + } + + public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) { + int brokenID = world.getBlockId(x, y, z); + if (!player.isSneaking() && brokenID > 0 && Utils.isWoodLog(world, x, y, z)) + { + if (!world.isRemote) + { + Utils.breakFurthestBlock(world, x, y, z, brokenID, player); + world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F); + ElectricItem.manager.use(itemstack, cost, player); + alternateServer = !alternateServer; + } else + { + player.swingItem(); + ElectricItem.manager.use(itemstack, cost, player); + alternateClient = !alternateClient; + } + } + return super.onItemUse(itemstack, player, world, x, y, z, par7, par8, par9, par10); + } + + @Override + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { + ElectricItem.manager.use(par1ItemStack, cost, par7EntityLivingBase); + return true; + } + + public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) { + World world = ((Entity) (player)).worldObj; + int brokenID = world.getBlockId(x, y, z); + if (!player.isSneaking() && brokenID > 0 && Utils.isWoodLog(world, x, y, z)) + { + if (!world.isRemote) + { + Utils.breakFurthestBlock(world, x, y, z, brokenID, player); + PacketHandler.sendBlockBoilFXPacket(x, y, z, 0.33F, 0.33F, 1.0F, player); + world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F); + } + ElectricItem.manager.use(itemstack, cost, player); + return true; + } else + { + return super.onBlockStartBreak(itemstack, x, y, z, player); + } + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 3; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 900; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:streamchainsaw"); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return Item.axeDiamond.canHarvestBlock(block) || Item.swordDiamond.canHarvestBlock(block); + } + + @Override + public float getStrVsBlock(ItemStack stack, Block block, int meta) { + if (!ElectricItem.manager.canUse(stack, cost)) + { + return 1.0F; + } + + if (Item.axeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.swordWood.getStrVsBlock(stack, block, meta) > 1.0F) + { + return efficiencyOnProperMaterial; + } else + { + return super.getStrVsBlock(stack, block, meta); + } + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + if (ElectricItem.manager.use(itemstack, hitCost, attacker)) + { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F); + } + return false; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemThaumiumChainsaw.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemThaumiumChainsaw.java new file mode 100644 index 0000000..9e5b398 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemThaumiumChainsaw.java @@ -0,0 +1,202 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemAxe; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import net.minecraftforge.event.ForgeEventFactory; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemThaumiumChainsaw extends ItemAxe implements IElectricItem +{ + + public int maxCharge = 60000; + private final int cost = 250; + private final int hitCost = 350; + + public ItemThaumiumChainsaw(int id) + { + super(id, EnumToolMaterial.EMERALD); + this.efficiencyOnProperMaterial = 21F; + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(27); + this.setMaxStackSize(1); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:thaumiumchainsaw"); + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return this.itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return this.itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 2; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 600; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @Override + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { + ElectricItem.manager.use(par1ItemStack, cost, par7EntityLivingBase); + return true; + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return Item.axeDiamond.canHarvestBlock(block) || Item.swordDiamond.canHarvestBlock(block); + } + + @Override + public float getStrVsBlock(ItemStack stack, Block block, int meta) { + if (!ElectricItem.manager.canUse(stack, cost)) + { + return 1.0F; + } + + if (Item.axeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.swordWood.getStrVsBlock(stack, block, meta) > 1.0F) + { + return efficiencyOnProperMaterial; + } else + { + return super.getStrVsBlock(stack, block, meta); + } + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + if (ElectricItem.manager.use(itemstack, hitCost, attacker)) + { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F); + } + return false; + } + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { + for (int i = 0; i < player.inventory.mainInventory.length; i++) + { + ItemStack torchStack = player.inventory.mainInventory[i]; + if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) + { + continue; + } + Item item = torchStack.getItem(); + if (!(item instanceof ItemBlock)) + { + continue; + } + int oldMeta = torchStack.getItemDamage(); + int oldSize = torchStack.stackSize; + boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset); + if (player.capabilities.isCreativeMode) + { + torchStack.setItemDamage(oldMeta); + torchStack.stackSize = oldSize; + } else if (torchStack.stackSize <= 0) + { + ForgeEventFactory.onPlayerDestroyItem(player, torchStack); + player.inventory.mainInventory[i] = null; + } + if (result) + { + return true; + } + } + + return super.onItemUse(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemThaumiumDrill.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemThaumiumDrill.java new file mode 100644 index 0000000..d5ebb0e --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/ItemThaumiumDrill.java @@ -0,0 +1,209 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemPickaxe; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.event.ForgeEventFactory; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemThaumiumDrill extends ItemPickaxe implements IElectricItem +{ + + public ItemThaumiumDrill(int id) + { + super(id, EnumToolMaterial.EMERALD); + this.efficiencyOnProperMaterial = 20F; + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxStackSize(1); + if (Config.toolsInBore == false) + { + this.setMaxDamage(27); + } else + { + this.setMaxDamage(240); + } + } + + public int maxCharge = 60000; + private int cost; + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:thaumiumdrill"); + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return this.itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return this.itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 2; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 100; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @Override + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { + if (Config.toolsInBore == false) + { + cost = 250; + } else + { + cost = 1; + } + ElectricItem.manager.use(par1ItemStack, cost, par7EntityLivingBase); + return true; + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return Item.pickaxeDiamond.canHarvestBlock(block) || Item.shovelDiamond.canHarvestBlock(block); + } + + @Override + public float getStrVsBlock(ItemStack stack, Block block, int meta) { + if (!ElectricItem.manager.canUse(stack, cost)) + { + return 1.0F; + } + + if (Item.pickaxeWood.getStrVsBlock(stack, block, meta) > 1.0F || Item.shovelWood.getStrVsBlock(stack, block, meta) > 1.0F) + { + return efficiencyOnProperMaterial; + } else + { + return super.getStrVsBlock(stack, block, meta); + } + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) { + return true; + } + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { + for (int i = 0; i < player.inventory.mainInventory.length; i++) + { + ItemStack torchStack = player.inventory.mainInventory[i]; + if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) + { + continue; + } + Item item = torchStack.getItem(); + if (!(item instanceof ItemBlock)) + { + continue; + } + int oldMeta = torchStack.getItemDamage(); + int oldSize = torchStack.stackSize; + boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset); + if (player.capabilities.isCreativeMode) + { + torchStack.setItemDamage(oldMeta); + torchStack.stackSize = oldSize; + } else if (torchStack.stackSize <= 0) + { + ForgeEventFactory.onPlayerDestroyItem(player, torchStack); + player.inventory.mainInventory[i] = null; + } + if (result) + { + return true; + } + } + + return super.onItemUse(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemElectricThorHammer.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemElectricThorHammer.java new file mode 100644 index 0000000..f101a92 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemElectricThorHammer.java @@ -0,0 +1,216 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools.hammer; + +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; +import electricMagicTools.tombenpotter.electricmagictools.common.entities.EntityArcher; + +public class ItemElectricThorHammer extends ItemSword implements IElectricItem +{ + + public int maxCharge = 1000000; + private final int hitCost = 5000; + private final int lightningCost = 75000; + + public ItemElectricThorHammer(int id) + { + super(id, EnumToolMaterial.EMERALD); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxDamage(27); + this.setMaxStackSize(1); + // OreDictionary.registerOre("craftingToolForgeHammer", this); + } + + @Override + public boolean canProvideEnergy(ItemStack itemStack) { + return false; + } + + @Override + public int getChargedItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getEmptyItemId(ItemStack itemStack) { + return itemID; + } + + @Override + public int getMaxCharge(ItemStack itemStack) { + return maxCharge; + } + + @Override + public int getTier(ItemStack itemStack) { + return 2; + } + + @Override + public int getTransferLimit(ItemStack itemStack) { + return 100; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:hammer/electricthorhammer"); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + + if (getChargedItemId(itemStack) == this.itemID) + { + ItemStack charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); + itemList.add(charged); + } + + if (getEmptyItemId(itemStack) == this.itemID) + itemList.add(new ItemStack(this, 1, getMaxDamage())); + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public int getItemEnchantability() { + if (Config.enchanting == false) + { + return 0; + } else + { + return 4; + } + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { + if (Config.enchanting == false) + { + return false; + } else + { + return true; + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + if (ElectricItem.manager.use(itemstack, hitCost, attacker)) + { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 19F); + } + return false; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + list.add(player.username + "'s Hammer"); + } + + @Override + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { + if (player.capabilities.isCreativeMode) + { + return itemstack; + } else if (ElectricItem.manager.canUse(itemstack, lightningCost)) + { + player.swingItem(); + // Corners + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 8, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 8, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 8, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 8, player.posY, player.posZ + 8)); + + // Fronts + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 8, player.posY, player.posZ)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 8, player.posY, player.posZ)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX, player.posY, player.posZ + 8)); + + // Others + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 8, player.posY, player.posZ + 1)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 8, player.posY, player.posZ + 2)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 8, player.posY, player.posZ + 3)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 8, player.posY, player.posZ + 4)); + + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 8, player.posY, player.posZ - 1)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 8, player.posY, player.posZ - 2)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 8, player.posY, player.posZ - 3)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 8, player.posY, player.posZ - 4)); + + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 1, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 2, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 3, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX + 4, player.posY, player.posZ - 8)); + + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 1, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 2, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 3, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX - 4, player.posY, player.posZ - 8)); + + EntityArcher archer; + archer = new EntityArcher(world); + archer.setPosition(player.posX + 8, player.posY + 2, player.posZ - 8); + world.spawnEntityInWorld(archer); + + EntityArcher archer1; + archer1 = new EntityArcher(world); + archer1.setPosition(player.posX - 8, player.posY + 2, player.posZ + 8); + world.spawnEntityInWorld(archer1); + + EntityArcher archer2; + archer2 = new EntityArcher(world); + archer2.setPosition(player.posX - 8, player.posY + 2, player.posZ - 8); + world.spawnEntityInWorld(archer2); + + EntityArcher archer3; + archer3 = new EntityArcher(world); + archer3.setPosition(player.posX + 8, player.posY + 2, player.posZ + 8); + world.spawnEntityInWorld(archer3); + ElectricItem.manager.use(itemstack, lightningCost, player); + return itemstack; + } else + { + world.spawnEntityInWorld(new EntityLightningBolt(world, player.posX, player.posY, player.posZ)); + player.addPotionEffect(new PotionEffect(Potion.harm.getId(), 1, 1)); + return itemstack; + } + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemTaintedThorHammer.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemTaintedThorHammer.java new file mode 100644 index 0000000..b9dad57 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemTaintedThorHammer.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools.hammer; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import thaumcraft.common.entities.projectile.EntityAlumentum; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemTaintedThorHammer extends ItemThorHammer +{ + + public ItemTaintedThorHammer(int id) + { + super(id); + this.setMaxDamage(1000); + // OreDictionary.registerOre("craftingToolForgeHammer", this); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:hammer/taintedthorhammer"); + } + + @Override + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { + player.swingItem(); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX + 8, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX - 8, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX - 8, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX + 8, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 4, player.posZ)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 8, player.posZ)); + + if (player.capabilities.isCreativeMode) + { + return itemstack; + } else + { + itemstack.damageItem(40, player); + return itemstack; + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 2F); + itemstack.damageItem(1, attacker); + return true; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("It was, once the Hammer of Thor."); + list.add("It is now very dangerous."); + list.add("Do NOT right-click."); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemThorHammer.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemThorHammer.java new file mode 100644 index 0000000..5968598 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/items/tools/hammer/ItemThorHammer.java @@ -0,0 +1,113 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.items.tools.hammer; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumMovingObjectType; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import thaumcraft.api.IRepairable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab; + +public class ItemThorHammer extends ItemSword implements IRepairable +{ + + public ItemThorHammer(int id) + { + super(id, EnumToolMaterial.EMERALD); + this.setCreativeTab(CreativeTab.tabTombenpotter); + this.setMaxStackSize(1); + this.setMaxDamage(2000); + // OreDictionary.registerOre("craftingToolForgeHammer", this); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("electricmagictools:hammer/thorhammer"); + } + + @Override + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { + player.swingItem(); + float f = 1.0F; + float f1 = player.prevRotationPitch + ((player.rotationPitch - player.prevRotationPitch) * f); + float f2 = player.prevRotationYaw + ((player.rotationYaw - player.prevRotationYaw) * f); + double d = player.prevPosX + ((player.posX - player.prevPosX) * f); + double d1 = (player.prevPosY + ((player.posY - player.prevPosY) * f) + 1.6200000000000001D) - player.yOffset; + double d2 = player.prevPosZ + ((player.posZ - player.prevPosZ) * f); + Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2); + float f3 = MathHelper.cos((-f2 * 0.01745329F) - 3.141593F); + float f4 = MathHelper.sin((-f2 * 0.01745329F) - 3.141593F); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f8 = f6; + float f9 = f3 * f5; + double d3 = 5000D; + Vec3 vec3d1 = vec3d.addVector(f7 * d3, f8 * d3, f9 * d3); + MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vec3d, vec3d1, false, true); + if (movingobjectposition == null) + { + return itemstack; + } + if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) + { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); + } else if (movingobjectposition.typeOfHit == EnumMovingObjectType.ENTITY) + { + Entity entityhit = movingobjectposition.entityHit; + double x = entityhit.posX; + double y = entityhit.posY; + double z = entityhit.posZ; + world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); + } + if (player.capabilities.isCreativeMode) + { + return itemstack; + } else + { + itemstack.damageItem(20, player); + return itemstack; + } + } + + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F); + itemstack.damageItem(1, attacker); + return true; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("The Hammer of Thor"); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/lib/CraftingAspects.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/lib/CraftingAspects.java new file mode 100644 index 0000000..fba493b --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/lib/CraftingAspects.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.lib; + +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; + +public class CraftingAspects +{ + + public static AspectList thaumiumDrillCrafting = new AspectList().add(Aspect.TOOL, 16).add(Aspect.MINE, 16).add(Aspect.ENERGY, 16); + public static AspectList thaumiumChainsawCrafting = new AspectList().add(Aspect.TOOL, 16).add(Aspect.WEAPON, 16).add(Aspect.ENERGY, 16); + public static AspectList thaumicQuantumHelmetCrafting = new AspectList().add(Aspect.ARMOR, 25).add(Aspect.SENSES, 25).add(Aspect.ENERGY, 25); + public static AspectList diamondOmnitoolCrafting = new AspectList().add(Aspect.ORDER, 15).add(Aspect.AIR, 15); + public static AspectList thaumiumOmnitoolCrafting = new AspectList().add(Aspect.TOOL, 25).add(Aspect.MINE, 25).add(Aspect.ENERGY, 25).add(Aspect.WEAPON, 25); + public static AspectList thaumicNanoHelmetCrafting = new AspectList().add(Aspect.ARMOR, 16).add(Aspect.SENSES, 16).add(Aspect.ENERGY, 16); + public static AspectList laserFocusCrafting = new AspectList().add(Aspect.FIRE, 30).add(Aspect.MOTION, 16).add(Aspect.WEAPON, 30).add(Aspect.DEATH, 16); + public static AspectList christmasFocusCrafting = new AspectList().add(Aspect.ORDER, 20).add(Aspect.AIR, 20); + public static AspectList shieldFocusCrafting = new AspectList().add(Aspect.AIR, 16).add(Aspect.ARMOR, 20).add(Aspect.CRYSTAL, 16).add(Aspect.TRAP, 20).add(Aspect.LIFE, 16); + public static AspectList electricGogglesCrafting = new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 20).add(Aspect.WATER, 20); + public static AspectList potentiaGeneratorCrafting = new AspectList().add(Aspect.ENERGY, 32).add(Aspect.MAGIC, 32).add(Aspect.METAL, 32).add(Aspect.EXCHANGE, 32); + public static AspectList ignisGeneratorCrafting = new AspectList().add(Aspect.FIRE, 16).add(Aspect.EXCHANGE, 8); + public static AspectList auramGeneratorCrafting = new AspectList().add(Aspect.AURA, 16).add(Aspect.EXCHANGE, 8); + public static AspectList arborGeneratorCrafting = new AspectList().add(Aspect.TREE, 16).add(Aspect.EXCHANGE, 8); + public static AspectList saxumGenerator = new AspectList().add(Aspect.STONE, 16).add(Aspect.EXCHANGE, 8); + public static AspectList streamChaisnawCrafting = new AspectList().add(Aspect.ENERGY, 48).add(Aspect.TREE, 48).add(Aspect.TOOL, 32).add(Aspect.WATER, 32); + public static AspectList rockbreakerDrillCrafting = new AspectList().add(Aspect.TOOL, 32).add(Aspect.STONE, 48).add(Aspect.ENERGY, 48).add(Aspect.MINE, 32); + public static AspectList shieldBlockCrafting = new AspectList().add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1); + public static AspectList tinyUraniumCrafting = new AspectList().add(Aspect.FIRE, 1).add(Aspect.WATER, 1).add(Aspect.AIR, 1).add(Aspect.EARTH, 1).add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1); + public static AspectList thorHammerCrafting = new AspectList().add(Aspect.WEAPON, 48).add(Aspect.WEATHER, 48).add(Aspect.ELDRITCH, 32); + public static AspectList superchargedThorHammerCrafting = new AspectList().add(Aspect.WEAPON, 48).add(Aspect.ENERGY, 64).add(Aspect.BEAST, 32); + public static AspectList wandCharger = new AspectList().add(Aspect.ENERGY, 322).add(Aspect.CRAFT, 48).add(Aspect.EXCHANGE, 48).add(Aspect.GREED, 64); + public static AspectList compressedSolars = new AspectList().add(Aspect.FIRE, 8).add(Aspect.WATER, 8).add(Aspect.AIR, 8).add(Aspect.EARTH, 8).add(Aspect.ORDER, 8).add(Aspect.ENTROPY, 8); + public static AspectList solarHelmetRevealing = new AspectList().add(Aspect.ENERGY, 32).add(Aspect.AIR, 32).add(Aspect.LIGHT, 25); + public static AspectList electricBootsTravel = new AspectList().add(Aspect.ENERGY, 16).add(Aspect.ARMOR, 32).add(Aspect.MOTION, 32); + public static AspectList nanoBootsTravel = new AspectList().add(Aspect.ENERGY, 25).add(Aspect.ARMOR, 32).add(Aspect.MOTION, 48); + public static AspectList quantumBootsTravel = new AspectList().add(Aspect.ENERGY, 32).add(Aspect.ARMOR, 32).add(Aspect.MOTION, 64); + public static AspectList electricScribingTools = new AspectList().add(Aspect.AIR, 16).add(Aspect.ORDER, 16).add(Aspect.ENTROPY, 16); + public static AspectList etherealProcessor = new AspectList().add(Aspect.MECHANISM, 16).add(Aspect.MAGIC, 16).add(Aspect.CRAFT, 16); + public static AspectList waterSolars = new AspectList().add(Aspect.WATER, 16).add(Aspect.MAGIC, 16).add(Aspect.EXCHANGE, 16); + public static AspectList darkSolars = new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.MAGIC, 16).add(Aspect.EXCHANGE, 16); + public static AspectList orderSolars = new AspectList().add(Aspect.ORDER, 16).add(Aspect.MAGIC, 16).add(Aspect.EXCHANGE, 16); + public static AspectList fireSolars = new AspectList().add(Aspect.FIRE, 16).add(Aspect.MAGIC, 16).add(Aspect.EXCHANGE, 16); + public static AspectList airSolars = new AspectList().add(Aspect.AIR, 16).add(Aspect.MAGIC, 16).add(Aspect.EXCHANGE, 16); + public static AspectList earthSolars = new AspectList().add(Aspect.EARTH, 16).add(Aspect.MAGIC, 16).add(Aspect.EXCHANGE, 16); + public static AspectList uuMatterInfusions = new AspectList().add(Aspect.FIRE, 32).add(Aspect.WATER, 32).add(Aspect.AIR, 32).add(Aspect.EARTH, 32).add(Aspect.ORDER, 32).add(Aspect.ENTROPY, 32); + public static AspectList lesserUUMInfusions = new AspectList().add(Aspect.FIRE, 16).add(Aspect.WATER, 16).add(Aspect.AIR, 16).add(Aspect.EARTH, 16).add(Aspect.ORDER, 16).add(Aspect.ENTROPY, 16); + public static AspectList cheapUUMInfusions = new AspectList().add(Aspect.FIRE, 8).add(Aspect.WATER, 8).add(Aspect.AIR, 8).add(Aspect.EARTH, 8).add(Aspect.ORDER, 8).add(Aspect.ENTROPY, 8); + public static AspectList cheapestUUMInfusions = new AspectList().add(Aspect.FIRE, 4).add(Aspect.WATER, 4).add(Aspect.AIR, 4).add(Aspect.EARTH, 4).add(Aspect.ORDER, 4).add(Aspect.ENTROPY, 4); + public static AspectList portableNode = new AspectList().add(Aspect.MAGIC, 32).add(Aspect.AURA, 32).add(Aspect.GREED, 32); + public static AspectList electricHoeGrowth = new AspectList().add(Aspect.ENERGY, 32).add(Aspect.PLANT, 25).add(Aspect.CROP, 32).add(Aspect.MAGIC, 48); + public static AspectList chargeFocus = new AspectList().add(Aspect.EXCHANGE, 25).add(Aspect.ENERGY, 32).add(Aspect.MECHANISM, 32); + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/lib/ResearchAspects.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/lib/ResearchAspects.java new file mode 100644 index 0000000..43dd80c --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/lib/ResearchAspects.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.lib; + +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; + +public class ResearchAspects +{ + + public static AspectList thaumiumDrillResearch = new AspectList().add(Aspect.ENERGY, 5).add(Aspect.TOOL, 6).add(Aspect.MINE, 4); + public static AspectList thaumiumChainsawResearch = new AspectList().add(Aspect.ENERGY, 5).add(Aspect.WEAPON, 6).add(Aspect.TOOL, 4); + public static AspectList thaumicQuantumHelmet = new AspectList().add(Aspect.ARMOR, 8).add(Aspect.ENERGY, 4).add(Aspect.SENSES, 6); + public static AspectList diamondOmnitoolResearch = new AspectList().add(Aspect.ENERGY, 2).add(Aspect.TOOL, 3).add(Aspect.MINE, 2).add(Aspect.WEAPON, 2); + public static AspectList thaumiumOmnitoolResearch = new AspectList().add(Aspect.ENERGY, 5).add(Aspect.TOOL, 6).add(Aspect.MINE, 4).add(Aspect.WEAPON, 6); + public static AspectList thaumicNanoHelmet = new AspectList().add(Aspect.ENERGY, 5).add(Aspect.SENSES, 8).add(Aspect.ARMOR, 6); + public static AspectList laserFocusResearch = new AspectList().add(Aspect.FIRE, 3).add(Aspect.DEATH, 2).add(Aspect.WEAPON, 3); + public static AspectList christmasFocusResearch = new AspectList().add(Aspect.ICE, 2).add(Aspect.BEAST, 5).add(Aspect.LIFE, 6); + public static AspectList shieldFocusResearch = new AspectList().add(Aspect.ARMOR, 5).add(Aspect.AIR, 2).add(Aspect.CRYSTAL, 3).add(Aspect.TRAP, 2); + public static AspectList electricGogglesResearch = new AspectList().add(Aspect.ARMOR, 8).add(Aspect.ENERGY, 5).add(Aspect.SENSES, 6); + public static AspectList potentiaGeneratorResearch = new AspectList().add(Aspect.ENERGY, 4).add(Aspect.EXCHANGE, 4).add(Aspect.METAL, 3); + public static AspectList ignisGeneratorResearch = new AspectList().add(Aspect.EXCHANGE, 4).add(Aspect.FIRE, 3); + public static AspectList auramGeneratorResearch = new AspectList().add(Aspect.EXCHANGE, 4).add(Aspect.AURA, 3); + public static AspectList arborGeneratorResearch = new AspectList().add(Aspect.EXCHANGE, 4).add(Aspect.TREE, 3); + public static AspectList saxumGenerator = new AspectList().add(Aspect.EXCHANGE, 4).add(Aspect.STONE, 3); + public static AspectList streamChainsawResearch = new AspectList().add(Aspect.TOOL, 3).add(Aspect.TREE, 3).add(Aspect.WATER, 6).add(Aspect.ENERGY, 4); + public static AspectList rockbreakerDrillResearch = new AspectList().add(Aspect.STONE, 2).add(Aspect.ENERGY, 3).add(Aspect.FIRE, 2).add(Aspect.MINE, 3); + public static AspectList shieldBlockResearch = new AspectList().add(Aspect.ARMOR, 3).add(Aspect.STONE, 2).add(Aspect.TRAP, 2); + public static AspectList tinyUraniumResearch = new AspectList().add(Aspect.POISON, 4).add(Aspect.DEATH, 3).add(Aspect.EXCHANGE, 3); + public static AspectList thorHammerResearch = new AspectList().add(Aspect.WEAPON, 3).add(Aspect.WEATHER, 4).add(Aspect.ELDRITCH, 3); + public static AspectList superchargedThorHammerResearch = new AspectList().add(Aspect.WEAPON, 4).add(Aspect.ENERGY, 6).add(Aspect.BEAST, 4); + public static AspectList wandCharger = new AspectList().add(Aspect.ENERGY, 4).add(Aspect.CRAFT, 2).add(Aspect.EXCHANGE, 3).add(Aspect.GREED, 5); + public static AspectList compressedSolars = new AspectList().add(Aspect.ENERGY, 4).add(Aspect.LIGHT, 3).add(Aspect.METAL, 2); + public static AspectList solarHelmetRevealing = new AspectList().add(Aspect.ENERGY, 5).add(Aspect.AIR, 2).add(Aspect.LIGHT, 4); + public static AspectList electricBootsTravel = new AspectList().add(Aspect.ENERGY, 2).add(Aspect.ARMOR, 5).add(Aspect.MOTION, 2); + public static AspectList nanoBootsTravel = new AspectList().add(Aspect.ENERGY, 3).add(Aspect.ARMOR, 5).add(Aspect.MOTION, 3); + public static AspectList quantumBootsTravel = new AspectList().add(Aspect.ENERGY, 4).add(Aspect.ARMOR, 5).add(Aspect.MOTION, 4); + public static AspectList electricScribingTools = new AspectList().add(Aspect.ENERGY, 5).add(Aspect.DARKNESS, 3).add(Aspect.CRAFT, 1); + public static AspectList etherealProcessor = new AspectList().add(Aspect.MECHANISM, 3).add(Aspect.MAGIC, 4).add(Aspect.CRAFT, 5); + public static AspectList waterSolars = new AspectList().add(Aspect.WATER, 4).add(Aspect.MAGIC, 3).add(Aspect.ENERGY, 4); + public static AspectList darkSolars = new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.MAGIC, 3).add(Aspect.ENERGY, 4); + public static AspectList orderSolars = new AspectList().add(Aspect.ORDER, 4).add(Aspect.MAGIC, 3).add(Aspect.ENERGY, 4); + public static AspectList fireSolars = new AspectList().add(Aspect.FIRE, 4).add(Aspect.MAGIC, 3).add(Aspect.ENERGY, 4); + public static AspectList airSolars = new AspectList().add(Aspect.AIR, 4).add(Aspect.MAGIC, 3).add(Aspect.ENERGY, 4); + public static AspectList earthSolars = new AspectList().add(Aspect.EARTH, 4).add(Aspect.MAGIC, 3).add(Aspect.ENERGY, 4); + public static AspectList uuMInfusion = new AspectList().add(Aspect.ELDRITCH, 4).add(Aspect.MAGIC, 4).add(Aspect.CRAFT, 5); + public static AspectList portableNode = new AspectList().add(Aspect.MAGIC, 5).add(Aspect.AURA, 5).add(Aspect.GREED, 5); + public static AspectList electricHoeGrowth = new AspectList().add(Aspect.ENERGY, 4).add(Aspect.PLANT, 4).add(Aspect.CROP, 5).add(Aspect.MAGIC, 4); + public static AspectList chargeFocus = new AspectList().add(Aspect.EXCHANGE, 4).add(Aspect.ENERGY, 5).add(Aspect.MECHANISM, 4); + +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/EMTInitRecipes.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/EMTInitRecipes.java new file mode 100644 index 0000000..a0b37d7 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/EMTInitRecipes.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.recipes; + +import ic2.api.item.Items; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.item.crafting.IRecipe; +import net.minecraftforge.oredict.OreDictionary; +import thaumcraft.common.config.ConfigItems; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.ItemRegistry; + +public class EMTInitRecipes +{ + + public static void add() { + + /** Crafting Recipes **/ + ironOmnitool = GameRegistry.addShapedRecipe(new ItemStack(ItemRegistry.ironOmnitool), "X", "Z", "Y", 'X', new ItemStack(Items.getItem("chainsaw").getItem(), 1, OreDictionary.WILDCARD_VALUE), 'Y', new ItemStack(Items.getItem("miningDrill").getItem(), 1, OreDictionary.WILDCARD_VALUE), 'Z', Items.getItem("plateiron")); + + diamondChainsaw = GameRegistry.addShapedRecipe(new ItemStack(ItemRegistry.diamondChainsaw), " X ", "XYX", 'X', new ItemStack(Item.diamond), 'Y', new ItemStack(Items.getItem("chainsaw").getItem(), 1, OreDictionary.WILDCARD_VALUE)); + + if (Loader.isModLoaded("gregtech_addon") == false) + { + GameRegistry.addShapedRecipe(Items.getItem("diamondDrill"), " Y ", "YXY", 'Y', new ItemStack(Item.diamond), 'X', new ItemStack(Items.getItem("miningDrill").getItem(), 1, OreDictionary.WILDCARD_VALUE)); + } else + { + System.out.println("[EMT] Gregtech Addon detected. Disabling the fix for the Diamond Drill recipe."); + } + + GameRegistry.addRecipe(Items.getItem("nanoHelmet"), "XYX", "XZX", 'X', Items.getItem("carbonPlate"), 'Y', new ItemStack(Items.getItem("energyCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), 'Z', new ItemStack(Items.getItem("nightvisionGoggles").getItem(), 1, OreDictionary.WILDCARD_VALUE)); + + GameRegistry.addShapedRecipe(Items.getItem("generator"), "X", "Y", "Z", 'X', new ItemStack(Items.getItem("chargedReBattery").getItem(), 1, OreDictionary.WILDCARD_VALUE), 'Y', Items.getItem("machine"), 'Z', new ItemStack(Block.furnaceIdle)); + + GameRegistry.addShapedRecipe(Items.getItem("generator"), "X", "Y", "Z", 'X', Items.getItem("reBattery"), 'Y', Items.getItem("machine"), 'Z', new ItemStack(Block.furnaceIdle)); + + /** Smelting Recipes **/ + FurnaceRecipes.smelting().addSmelting(ItemRegistry.itemEMTItems.itemID, 1, new ItemStack(ConfigItems.itemResource, 1, 6), 0.0F); + FurnaceRecipes.smelting().addSmelting(ItemRegistry.itemEMTItems.itemID, 2, new ItemStack(ConfigItems.itemResource, 1, 6), 0.0F); + FurnaceRecipes.smelting().addSmelting(ItemRegistry.itemEMTItems.itemID, 3, new ItemStack(ConfigItems.itemResource, 1, 3), 0.0F); + FurnaceRecipes.smelting().addSmelting(ItemRegistry.itemEMTItems.itemID, 4, new ItemStack(ConfigItems.itemResource, 1, 3), 0.0F); + + } + + public static IRecipe ironOmnitool; + public static IRecipe diamondChainsaw; +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/EMTPostInitRecipes.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/EMTPostInitRecipes.java new file mode 100644 index 0000000..844380a --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/EMTPostInitRecipes.java @@ -0,0 +1,267 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.recipes; + +import ic2.api.item.Items; +import ic2.api.recipe.RecipeInputItemStack; +import ic2.api.recipe.Recipes; +import ic2.core.Ic2Items; +import ic2.core.util.StackUtil; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.oredict.OreDictionary; +import thaumcraft.api.ThaumcraftApi; +import thaumcraft.api.crafting.CrucibleRecipe; +import thaumcraft.api.crafting.InfusionRecipe; +import thaumcraft.api.crafting.ShapedArcaneRecipe; +import thaumcraft.api.crafting.ShapelessArcaneRecipe; +import thaumcraft.common.config.ConfigBlocks; +import thaumcraft.common.config.ConfigItems; +import cpw.mods.fml.common.registry.GameRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.ItemRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.lib.CraftingAspects; + +public class EMTPostInitRecipes +{ + + public static void add() { + + /** Infusion Recipes **/ + + thaumiumDrill = ThaumcraftApi.addInfusionCraftingRecipe("Thaumium Drill", new ItemStack(ItemRegistry.thaumiumDrill), 5, CraftingAspects.thaumiumDrillCrafting, new ItemStack(Items.getItem("diamondDrill").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Item.diamond), new ItemStack(Item.diamond), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), Items.getItem("denseplateiron") }); + + thaumiumChainsaw = ThaumcraftApi.addInfusionCraftingRecipe("Thaumium Chainsaw", new ItemStack(ItemRegistry.thaumiumChainsaw), 5, CraftingAspects.thaumiumChainsawCrafting, new ItemStack(ItemRegistry.diamondChainsaw, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Item.diamond), new ItemStack(Item.diamond), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), Items.getItem("denseplateiron") }); + + thaumicQuantumHelmet = ThaumcraftApi.addInfusionCraftingRecipe("Quantum Goggles of Revealing", new ItemStack(ItemRegistry.quantumThaumicHelmet), 6, CraftingAspects.thaumicQuantumHelmetCrafting, new ItemStack(ItemRegistry.nanoThaumicHelmet, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Item.diamond), new ItemStack(Item.bucketMilk), new ItemStack(Items.getItem("quantumHelmet").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), Items.getItem("iridiumPlate"), Items.getItem("advancedCircuit") }); + + thaumicNanoHelmet = ThaumcraftApi.addInfusionCraftingRecipe("Nanosuit Goggles of Revealing", new ItemStack(ItemRegistry.nanoThaumicHelmet), 5, CraftingAspects.thaumicNanoHelmetCrafting, new ItemStack(ItemRegistry.electricGoggles, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Item.diamond), new ItemStack(Item.ingotGold), new ItemStack(Items.getItem("nanoHelmet").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), Items.getItem("carbonPlate"), Items.getItem("electronicCircuit") }); + + thaumiumOmnitool = ThaumcraftApi.addInfusionCraftingRecipe("Thaumium Omnitool", new ItemStack(ItemRegistry.thaumiumOmnitool), 6, CraftingAspects.thaumiumOmnitoolCrafting, new ItemStack(ItemRegistry.thaumiumChainsaw, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(ItemRegistry.thaumiumDrill, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), Items.getItem("carbonPlate"), Items.getItem("plateobsidian") }); + + diamondOmnitoolToThaumium = ThaumcraftApi.addInfusionCraftingRecipe("Thaumium Omnitool", new ItemStack(ItemRegistry.thaumiumOmnitool), 6, CraftingAspects.thaumiumOmnitoolCrafting, new ItemStack(ItemRegistry.diamondOmnitool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Block.blockDiamond), new ItemStack(ConfigBlocks.blockMetalDevice, 1, 9), new ItemStack(ConfigBlocks.blockMetalDevice, 1, 9), new ItemStack(Items.getItem("energyCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), Items.getItem("carbonPlate"), Items.getItem("advancedCircuit") }); + + explosionFocus = ThaumcraftApi.addInfusionCraftingRecipe("Explosion Focus", new ItemStack(ItemRegistry.explosionFocus), 6, CraftingAspects.laserFocusCrafting, new ItemStack(ConfigItems.itemFocusHellbat, 1), new ItemStack[] { new ItemStack(Items.getItem("miningLaser").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Item.arrow), new ItemStack(Item.gunpowder), new ItemStack(Item.fireworkCharge), new ItemStack(ConfigItems.itemResource, 1, 1), new ItemStack(ConfigItems.itemWispEssence, 1) }); + + shieldFocus = ThaumcraftApi.addInfusionCraftingRecipe("Shield Focus", new ItemStack(ItemRegistry.shieldFocus), 4, CraftingAspects.shieldFocusCrafting, new ItemStack(ConfigItems.itemFocusPortableHole, 1), new ItemStack[] { Items.getItem("reinforcedStone"), Items.getItem("reinforcedGlass"), Items.getItem("reinforcedStone"), Items.getItem("reinforcedGlass"), new ItemStack(Block.slowSand), new ItemStack(Block.obsidian), new ItemStack(Block.obsidian) }); + + potentiaGenerator = ThaumcraftApi.addInfusionCraftingRecipe("Potentia Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 0), 6, CraftingAspects.potentiaGeneratorCrafting, Items.getItem("semifluidGenerator"), new ItemStack[] { new ItemStack(Item.diamond), new ItemStack(ConfigItems.itemFocusTrade), new ItemStack(Block.hopperBlock), new ItemStack(ConfigBlocks.blockJar), Items.getItem("mvTransformer"), Items.getItem("advancedMachine"), Items.getItem("orewashingplant"), Items.getItem("scrap") }); + + streamChainsaw = ThaumcraftApi.addInfusionCraftingRecipe("Chainsaw of the Stream", new ItemStack(ItemRegistry.streamChainsaw), 6, CraftingAspects.streamChaisnawCrafting, new ItemStack(ItemRegistry.thaumiumChainsaw, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Item.bucketWater), new ItemStack(ConfigItems.itemAxeElemental), new ItemStack(ConfigBlocks.blockMagicalLog), new ItemStack(Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), Items.getItem("compressedPlantBall"), Items.getItem("iridiumPlate"), Items.getItem("overclockerUpgrade") }); + + rockbreakerDrill = ThaumcraftApi.addInfusionCraftingRecipe("Drill of the Rockbreaker", new ItemStack(ItemRegistry.rockbreakerDrill), 6, CraftingAspects.rockbreakerDrillCrafting, new ItemStack(ItemRegistry.thaumiumDrill, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Item.flintAndSteel), new ItemStack(Item.fireballCharge), new ItemStack(ConfigItems.itemPickElemental), new ItemStack(ConfigItems.itemShovelElemental), new ItemStack(Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), Items.getItem("reinforcedStone"), Items.getItem("iridiumPlate"), Items.getItem("overclockerUpgrade") }); + + thorHammer = ThaumcraftApi.addInfusionCraftingRecipe("Mjolnir", new ItemStack(ItemRegistry.thorHammer), 7, CraftingAspects.thorHammerCrafting, new ItemStack(ItemRegistry.taintedThorHammer, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(ItemRegistry.lightningSummoner), new ItemStack(ItemRegistry.lightningSummoner), new ItemStack(ConfigItems.itemSwordElemental), new ItemStack(ConfigItems.itemResource, 1, 1), new ItemStack(ConfigItems.itemFocusShock), Items.getItem("rubber") }); + + superchargedThorHammer = ThaumcraftApi.addInfusionCraftingRecipe("Supercharged Mjolnir", new ItemStack(ItemRegistry.electricThorHammer), 10, CraftingAspects.superchargedThorHammerCrafting, new ItemStack(ItemRegistry.thorHammer, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(ItemRegistry.lightningSummoner), new ItemStack(ItemRegistry.lightningSummoner), new ItemStack(Block.web), new ItemStack(ConfigItems.itemFocusHellbat), new ItemStack(ConfigItems.itemSwordElemental), new ItemStack(Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), Items.getItem("iridiumPlate"), Items.getItem("iridiumPlate"), new ItemStack(Items.getItem("nanoSaber").getItem(), 1, OreDictionary.WILDCARD_VALUE) }); + + wandRecharger = ThaumcraftApi.addInfusionCraftingRecipe("Industrial Wand Charging Station", new ItemStack(BlockRegistry.emtMachines, 1, 0), 6, CraftingAspects.wandCharger, new ItemStack(ConfigBlocks.blockStoneDevice, 1, 5), new ItemStack[] { Items.getItem("replicator"), Items.getItem("iridiumPlate"), new ItemStack(Block.blockDiamond), new ItemStack(ConfigItems.itemShard, 1, 5), new ItemStack(ConfigBlocks.blockJar) }); + + solarHelmetRevealing = ThaumcraftApi.addInfusionCraftingRecipe("Solar Helmet of Revealing", new ItemStack(ItemRegistry.solarHelmetRevealing), 5, CraftingAspects.solarHelmetRevealing, new ItemStack(ItemRegistry.quantumThaumicHelmet, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(BlockRegistry.emtSolars, 1, 1), Items.getItem("glassFiberCableItem"), new ItemStack(Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ConfigItems.itemShard, 1, 4) }); + + electricBootsTravel = ThaumcraftApi.addInfusionCraftingRecipe("Electric Boots of the Traveller", new ItemStack(ItemRegistry.electricBootsTraveller), 2, CraftingAspects.electricBootsTravel, new ItemStack(ConfigItems.itemBootsTraveller), new ItemStack[] { new ItemStack(Item.diamond), Items.getItem("elemotor"), Items.getItem("coil"), Items.getItem("hazmatBoots"), new ItemStack(Items.getItem("advBattery").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ConfigItems.itemWispEssence) }); + + nanoBootsTravel = ThaumcraftApi.addInfusionCraftingRecipe("Nano Boots of the Traveller", new ItemStack(ItemRegistry.nanoBootsTraveller), 2, CraftingAspects.nanoBootsTravel, new ItemStack(ItemRegistry.electricBootsTraveller, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Item.diamond), new ItemStack(Items.getItem("nanoBoots").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.getItem("energyCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ConfigItems.itemWispEssence), new ItemStack(ConfigItems.itemWispEssence) }); + + quantumBootsTravel = ThaumcraftApi.addInfusionCraftingRecipe("Quantum Boots of the Traveller", new ItemStack(ItemRegistry.quantumBootsTraveller), 2, CraftingAspects.quantumBootsTravel, new ItemStack(ItemRegistry.nanoBootsTraveller, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { new ItemStack(Block.blockDiamond), new ItemStack(Items.getItem("quantumBoots").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), Items.getItem("iridiumPlate"), new ItemStack(ConfigItems.itemWispEssence), new ItemStack(ConfigItems.itemWispEssence), new ItemStack(ConfigItems.itemWispEssence) }); + + etheralProcessor = ThaumcraftApi.addInfusionCraftingRecipe("Etheral Processor", new ItemStack(BlockRegistry.emtMachines, 1, 1), 3, CraftingAspects.etherealProcessor, Items.getItem("macerator"), new ItemStack[] { Items.getItem("electroFurnace"), new ItemStack(ConfigBlocks.blockMetalDevice, 1, 9), new ItemStack(Block.whiteStone), new ItemStack(Block.whiteStone), new ItemStack(Block.blockIron), new ItemStack(Block.blockIron), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate) }); + + tripleCompressedSolar = ThaumcraftApi.addInfusionCraftingRecipe("Compressed Solars", new ItemStack(BlockRegistry.emtSolars, 1, 2), 2, CraftingAspects.compressedSolars, new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack[] { new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1) }); + + electricHoeGrowth = ThaumcraftApi.addInfusionCraftingRecipe("Electric Hoe of Growth", new ItemStack(ItemRegistry.electricHoeGrowth), 4, CraftingAspects.electricHoeGrowth, new ItemStack(ConfigItems.itemHoeElemental), new ItemStack[] { new ItemStack(Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.getItem("electricHoe").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Item.dyePowder, 1, 15), Items.getItem("elemotor"), Items.getItem("coil"), new ItemStack(Block.sapling, 1, OreDictionary.WILDCARD_VALUE) }); + + chargeFocus = ThaumcraftApi.addInfusionCraftingRecipe("Wand Focus: Charging", new ItemStack(ItemRegistry.chargeFocus), 4, CraftingAspects.chargeFocus, new ItemStack(Items.getItem("advBattery").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { Items.getItem("generator"), Items.getItem("batBox"), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ItemRegistry.thaumiumPlate), new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE) }); + + /** Arcane Worktable Recipes **/ + + diamondOmnitool = ThaumcraftApi.addShapelessArcaneCraftingRecipe("Diamond Omnitool", new ItemStack(ItemRegistry.diamondOmnitool), CraftingAspects.diamondOmnitoolCrafting, new ItemStack(ItemRegistry.diamondChainsaw, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.getItem("diamondDrill").getItem(), 1, OreDictionary.WILDCARD_VALUE)); + + ironOmnitoolToDiamond = ThaumcraftApi.addArcaneCraftingRecipe("Diamond Omnitool", new ItemStack(ItemRegistry.diamondOmnitool), CraftingAspects.diamondOmnitoolCrafting, "XAX", "XBX", "XAX", 'X', new ItemStack(Item.diamond), 'A', Items.getItem("advancedCircuit"), 'B', new ItemStack(ItemRegistry.ironOmnitool, 1, OreDictionary.WILDCARD_VALUE)); + + christmasFocus = ThaumcraftApi.addArcaneCraftingRecipe("Kris-tmas Focus", new ItemStack(ItemRegistry.christmasFocus), CraftingAspects.christmasFocusCrafting, "XYX", "YZY", "XYX", 'X', new ItemStack(Block.blockSnow), 'Y', new ItemStack(Block.pumpkin), 'Z', new ItemStack(ConfigItems.itemFocusFrost)); + + electricGoggles = ThaumcraftApi.addArcaneCraftingRecipe("Electric Goggles", new ItemStack(ItemRegistry.electricGoggles), CraftingAspects.electricGogglesCrafting, " Y ", "AZA", "BXB", 'Z', new ItemStack(ConfigItems.itemGoggles), 'X', Items.getItem("electronicCircuit"), 'Y', new ItemStack(Item.helmetDiamond), 'A', new ItemStack(Items.getItem("chargedReBattery").getItem(), 1, OreDictionary.WILDCARD_VALUE), 'B', Item.redstoneRepeater); + + shieldBlock = ThaumcraftApi.addArcaneCraftingRecipe("Shield Block", new ItemStack(BlockRegistry.shield, 8), CraftingAspects.shieldBlockCrafting, "XYX", "X X", "XYX", 'X', new ItemStack(Block.glass), 'Y', new ItemStack(Block.obsidian)); + + tinyUranium = ThaumcraftApi.addShapelessArcaneCraftingRecipe("Tiny Uranium", new ItemStack(Items.getItem("smallUran235").getItem(), 7), CraftingAspects.tinyUraniumCrafting, Items.getItem("Uran238")); + + compressedSolar = ThaumcraftApi.addArcaneCraftingRecipe("Compressed Solars", new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.compressedSolars, "XXX", "XXX", "XXX", 'X', Items.getItem("solarPanel")); + + doubleCompressedSolar = ThaumcraftApi.addArcaneCraftingRecipe("Compressed Solars", new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.compressedSolars, "XXX", "XXX", "XXX", 'X', new ItemStack(BlockRegistry.emtSolars, 1, 0)); + + electricScribingTools = ThaumcraftApi.addArcaneCraftingRecipe("Electric Scribing Tools", new ItemStack(ItemRegistry.electricScribingTools), CraftingAspects.electricScribingTools, "YXY", "XZX", "YXY", 'Y', Items.getItem("electronicCircuit"), 'X', new ItemStack(ConfigItems.itemInkwell), 'Z', new ItemStack(Items.getItem("energyCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE)); + + /** Crucible Recipes **/ + + ignisGenerator = ThaumcraftApi.addCrucibleRecipe("Ignis Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 1), new ItemStack(BlockRegistry.essentiaGens, 1, 0), CraftingAspects.ignisGeneratorCrafting); + + auramGenerator = ThaumcraftApi.addCrucibleRecipe("Auram Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 2), new ItemStack(BlockRegistry.essentiaGens, 1, 0), CraftingAspects.auramGeneratorCrafting); + + arborGenerator = ThaumcraftApi.addCrucibleRecipe("Arbor Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 3), new ItemStack(BlockRegistry.essentiaGens, 1, 0), CraftingAspects.arborGeneratorCrafting); + + saxumGenerator = ThaumcraftApi.addCrucibleRecipe("Saxum Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 4), new ItemStack(BlockRegistry.essentiaGens, 1, 0), CraftingAspects.saxumGenerator); + + waterSolar = ThaumcraftApi.addCrucibleRecipe("Water Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 3), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.waterSolars); + + doubleWaterSolar = ThaumcraftApi.addCrucibleRecipe("Water Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 4), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.waterSolars); + + tripleWaterSolar = ThaumcraftApi.addCrucibleRecipe("Water Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 5), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.waterSolars); + + darkSolar = ThaumcraftApi.addCrucibleRecipe("Entropy Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 6), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.darkSolars); + + doubleDarkSolar = ThaumcraftApi.addCrucibleRecipe("Entropy Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 7), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.darkSolars); + + tripleDarkSolar = ThaumcraftApi.addCrucibleRecipe("Entropy Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 8), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.darkSolars); + + orderSolar = ThaumcraftApi.addCrucibleRecipe("Order Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 9), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.orderSolars); + + doubleOrderSolar = ThaumcraftApi.addCrucibleRecipe("Order Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 10), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.orderSolars); + + tripleOrderSolar = ThaumcraftApi.addCrucibleRecipe("Order Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 11), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.orderSolars); + + fireSolar = ThaumcraftApi.addCrucibleRecipe("Fire Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 12), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.fireSolars); + + doubleFireSolar = ThaumcraftApi.addCrucibleRecipe("Fire Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 13), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.fireSolars); + + tripleFireSolar = ThaumcraftApi.addCrucibleRecipe("Fire Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 14), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.fireSolars); + + airSolar = ThaumcraftApi.addCrucibleRecipe("Air Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 15), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.airSolars); + + doubleAirSolar = ThaumcraftApi.addCrucibleRecipe("Air Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 0), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.airSolars); + + tripleAirSolar = ThaumcraftApi.addCrucibleRecipe("Air Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.airSolars); + + earthSolar = ThaumcraftApi.addCrucibleRecipe("Earth Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 2), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.earthSolars); + + doubleEarthSolar = ThaumcraftApi.addCrucibleRecipe("Earth Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 3), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.earthSolars); + + tripleEarthSolar = ThaumcraftApi.addCrucibleRecipe("Earth Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 4), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.earthSolars); + + portableNode = ThaumcraftApi.addCrucibleRecipe("Portable Node", new ItemStack(BlockRegistry.portableNode), new ItemStack(ConfigItems.itemJarFilled), CraftingAspects.portableNode); + + /** IC2 Stuff related recipes **/ + + /* Ore Clusters Macerator Recipes */ + ItemStack ironClusterRecipe = Items.getItem("smallIronDust").copy(); + ironClusterRecipe.stackSize = 22; + Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 16)), null, ironClusterRecipe); + + ItemStack goldClusterRecipe = Items.getItem("smallGoldDust").copy(); + goldClusterRecipe.stackSize = 22; + Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 31)), null, goldClusterRecipe); + + ItemStack copperClusterRecipe = Items.getItem("smallCopperDust").copy(); + copperClusterRecipe.stackSize = 22; + Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 17)), null, copperClusterRecipe); + + ItemStack tinClusterRecipe = Items.getItem("smallTinDust").copy(); + tinClusterRecipe.stackSize = 22; + Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 18)), null, tinClusterRecipe); + + ItemStack silverClusterRecipe = Items.getItem("smallSilverDust").copy(); + silverClusterRecipe.stackSize = 22; + Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 19)), null, silverClusterRecipe); + + ItemStack leadClusterRecipe = Items.getItem("smallLeadDust").copy(); + leadClusterRecipe.stackSize = 22; + Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 20)), null, leadClusterRecipe); + + /* Thaumium Plates Recipes */ + thaumiumPlate = GameRegistry.addShapedRecipe(new ItemStack(ItemRegistry.thaumiumPlate), "X", "Y", "Z", 'Y', new ItemStack(ConfigItems.itemResource, 1, 2), 'X', new ItemStack(Items.getItem("ForgeHammer").getItem(), 1, OreDictionary.WILDCARD_VALUE), 'Z', new ItemStack(Block.obsidian)); + Recipes.metalformerRolling.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemResource, 1, 2)), null, new ItemStack(ItemRegistry.thaumiumPlate)); + + /* Ore Processing for Amber and Cinnabar */ + ItemStack crushedAmberRecipe = new ItemStack(ItemRegistry.itemEMTItems, 1, 1); + crushedAmberRecipe.stackSize = 2; + Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigBlocks.blockCustomOre, 1, 7)), null, crushedAmberRecipe); + + ItemStack crushedCinnabarRecipe = new ItemStack(ItemRegistry.itemEMTItems, 1, 3); + crushedCinnabarRecipe.stackSize = 2; + Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigBlocks.blockCustomOre, 1, 0)), null, crushedCinnabarRecipe); + + NBTTagCompound waterAmount = new NBTTagCompound(); + waterAmount.setInteger("amount", 1000); + + Recipes.oreWashing.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 1)), waterAmount, new ItemStack[] { new ItemStack(ItemRegistry.itemEMTItems, 1, 2), StackUtil.copyWithSize(Ic2Items.smallCopperDust, 2), Ic2Items.stoneDust }); + Recipes.oreWashing.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 3)), waterAmount, new ItemStack[] { new ItemStack(ItemRegistry.itemEMTItems, 1, 4), StackUtil.copyWithSize(Ic2Items.smallTinDust, 2), Ic2Items.stoneDust }); + + NBTTagCompound heatAmount = new NBTTagCompound(); + heatAmount.setInteger("minHeat", 1000); + + Recipes.centrifuge.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 2)), heatAmount, new ItemStack[] { Ic2Items.smallCopperDust, new ItemStack(ConfigItems.itemResource, 1, 6) }); + Recipes.centrifuge.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 4)), heatAmount, new ItemStack[] { Ic2Items.smallTinDust, new ItemStack(ConfigItems.itemResource, 1, 3) }); + } + + public static InfusionRecipe thaumiumDrill; + public static InfusionRecipe thaumiumChainsaw; + public static InfusionRecipe thaumicQuantumHelmet; + public static InfusionRecipe thaumiumOmnitool; + public static InfusionRecipe thaumicNanoHelmet; + public static InfusionRecipe explosionFocus; + public static InfusionRecipe shieldFocus; + public static InfusionRecipe potentiaGenerator; + public static InfusionRecipe streamChainsaw; + public static InfusionRecipe rockbreakerDrill; + public static InfusionRecipe thorHammer; + public static InfusionRecipe superchargedThorHammer; + public static InfusionRecipe wandRecharger; + public static InfusionRecipe solarHelmetRevealing; + public static InfusionRecipe electricBootsTravel; + public static InfusionRecipe nanoBootsTravel; + public static InfusionRecipe quantumBootsTravel; + public static InfusionRecipe diamondOmnitoolToThaumium; + public static InfusionRecipe etheralProcessor; + public static InfusionRecipe tripleCompressedSolar; + public static InfusionRecipe electricHoeGrowth; + public static InfusionRecipe chargeFocus; + + public static ShapelessArcaneRecipe diamondOmnitool; + public static ShapelessArcaneRecipe tinyUranium; + public static ShapedArcaneRecipe christmasFocus; + public static ShapedArcaneRecipe electricGoggles; + public static ShapedArcaneRecipe shieldBlock; + public static ShapedArcaneRecipe compressedSolar; + public static ShapedArcaneRecipe doubleCompressedSolar; + public static ShapedArcaneRecipe ironOmnitoolToDiamond; + public static ShapedArcaneRecipe electricScribingTools; + + public static CrucibleRecipe ignisGenerator; + public static CrucibleRecipe auramGenerator; + public static CrucibleRecipe arborGenerator; + public static CrucibleRecipe saxumGenerator; + public static CrucibleRecipe waterSolar; + public static CrucibleRecipe doubleWaterSolar; + public static CrucibleRecipe tripleWaterSolar; + public static CrucibleRecipe darkSolar; + public static CrucibleRecipe doubleDarkSolar; + public static CrucibleRecipe tripleDarkSolar; + public static CrucibleRecipe orderSolar; + public static CrucibleRecipe doubleOrderSolar; + public static CrucibleRecipe tripleOrderSolar; + public static CrucibleRecipe fireSolar; + public static CrucibleRecipe doubleFireSolar; + public static CrucibleRecipe tripleFireSolar; + public static CrucibleRecipe airSolar; + public static CrucibleRecipe doubleAirSolar; + public static CrucibleRecipe tripleAirSolar; + public static CrucibleRecipe earthSolar; + public static CrucibleRecipe doubleEarthSolar; + public static CrucibleRecipe tripleEarthSolar; + public static CrucibleRecipe portableNode; + + public static IRecipe thaumiumPlate; +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/UuMInfusionRecipes.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/UuMInfusionRecipes.java new file mode 100644 index 0000000..9aca759 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/recipes/UuMInfusionRecipes.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.recipes; + +import ic2.api.item.Items; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; +import thaumcraft.api.ThaumcraftApi; +import thaumcraft.api.crafting.InfusionRecipe; +import thaumcraft.common.config.ConfigBlocks; +import thaumcraft.common.config.ConfigItems; +import electricMagicTools.tombenpotter.electricmagictools.common.lib.CraftingAspects; + +public class UuMInfusionRecipes +{ + public static ItemStack uuMCell = Items.getItem("UuMatterCell"); + + public static void add() { + + ItemStack iridium = Items.getItem("iridiumOre").copy(); + iridium.stackSize = 2; + uraniumToIridium = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", iridium, 4, CraftingAspects.uuMatterInfusions, Items.getItem("Uran238"), new ItemStack[] { uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell }); + + ItemStack uranium = Items.getItem("Uran238").copy(); + uranium.stackSize = 2; + diamondToUranium = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", uranium, 4, CraftingAspects.lesserUUMInfusions, new ItemStack(Item.diamond), new ItemStack[] { uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell, uuMCell }); + + ItemStack diamond = new ItemStack(Item.diamond).copy(); + diamond.stackSize = 1; + goldToDiamond = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", diamond, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(Item.ingotGold), new ItemStack[] { uuMCell, uuMCell, uuMCell, uuMCell }); + + ItemStack gold = new ItemStack(Item.ingotGold).copy(); + gold.stackSize = 2; + ironToGold = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", gold, 4, CraftingAspects.cheapestUUMInfusions, new ItemStack(Item.ingotIron), new ItemStack[] { uuMCell, uuMCell, uuMCell }); + + ItemStack ironOre = new ItemStack(Block.oreIron).copy(); + ironOre.stackSize = 16; + stoneBricksToIronOre = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", ironOre, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(Block.stoneBrick), new ItemStack[] { uuMCell, uuMCell }); + + /** + * ItemStack copperOre = Items.getItem("copperOre").copy(); BUGGED IN 1.6 IF IC2 OREGEN IS DISABLED + **/ + ItemStack copperOre = Items.getItem("crushedCopperOre").copy(); + copperOre.stackSize = 32; + arcaneStoneToCopperOre = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", copperOre, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), new ItemStack[] { uuMCell, uuMCell }); + + /** + * ItemStack tinOre = Items.getItem("tinOre").copy(); BUGGED IN 1.6 IF IC2 OREGEN IS DISABLED + **/ + ItemStack tinOre = Items.getItem("crushedTinOre").copy(); + tinOre.stackSize = 32; + arcaneStoneBricksToTinOre = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", tinOre, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 7), new ItemStack[] { uuMCell, uuMCell }); + + /** + * ItemStack leadOre = Items.getItem("leadOre").copy(); BUGGED IN 1.6 IF IC2 OREGEN IS DISABLED + **/ + ItemStack leadOre = Items.getItem("crushedLeadOre").copy(); + leadOre.stackSize = 32; + amberBlockToLeadOre = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", leadOre, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(ConfigBlocks.blockCosmeticOpaque, 1, 0), new ItemStack[] { uuMCell, uuMCell }); + + ItemStack coal = new ItemStack(Item.coal, 1, 0).copy(); + coal.stackSize = 16; + charcoalToCoal = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", coal, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(Item.coal, 1, 1), new ItemStack[] { uuMCell, uuMCell }); + + ItemStack stickyResin = Items.getItem("resin").copy(); + stickyResin.stackSize = 21; + shardToResin = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", stickyResin, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { uuMCell, uuMCell, uuMCell }); + + ItemStack redstone = new ItemStack(Item.redstone).copy(); + redstone.stackSize = 24; + shardToRedstone = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", redstone, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { uuMCell, uuMCell, uuMCell }); + + ItemStack lapisLazuli = new ItemStack(Item.dyePowder, 1, 4).copy(); + lapisLazuli.stackSize = 8; + shardToLapis = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", lapisLazuli, 4, CraftingAspects.cheapUUMInfusions, new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[] { uuMCell, uuMCell, uuMCell }); + + ItemStack glowstone = new ItemStack(Block.glowStone).copy(); + glowstone.stackSize = 1; + glowstoneDustToBlock = ThaumcraftApi.addInfusionCraftingRecipe("UU-Matter Infusion", glowstone, 4, CraftingAspects.cheapestUUMInfusions, new ItemStack(Item.glowstone), new ItemStack[] { uuMCell }); + + } + + public static InfusionRecipe uraniumToIridium; + public static InfusionRecipe diamondToUranium; + public static InfusionRecipe goldToDiamond; + public static InfusionRecipe ironToGold; + public static InfusionRecipe stoneBricksToIronOre; + public static InfusionRecipe arcaneStoneToCopperOre; + public static InfusionRecipe arcaneStoneBricksToTinOre; + public static InfusionRecipe amberBlockToLeadOre; + public static InfusionRecipe charcoalToCoal; + public static InfusionRecipe shardToResin; + public static InfusionRecipe shardToRedstone; + public static InfusionRecipe shardToLapis; + public static InfusionRecipe glowstoneDustToBlock; +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityAirSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityAirSolar.java new file mode 100644 index 0000000..5d608a1 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityAirSolar.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityAirSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 1); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityAirSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible && this.yCoord >= 160) + { + energySource.addEnergy(Config.compressedSolarOutput * 2.5); + } else if (theSunIsVisible) + { + energySource.addEnergy(Config.compressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 15); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityArborGenerator.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityArborGenerator.java new file mode 100644 index 0000000..eb64221 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityArborGenerator.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.lib.EssentiaHandler; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityArborGenerator extends TileEntity +{ + int x; + int y; + int z; + public ForgeDirection orientation; + public static int waitTime; + + public TileEntityArborGenerator() + { + orientation = ForgeDirection.getOrientation(1); + waitTime = 30; + } + + private BasicSource energySource = new BasicSource(this, 1000000000, 3); + + @Override + public void updateEntity() { + energySource.updateEntity(); + + if (waitTime > 0) + { + waitTime--; + } + + if (waitTime <= 0) + { + if (EssentiaHandler.drainEssentia(this, Aspect.TREE, ForgeDirection.UNKNOWN, 8)) + { + energySource.addEnergy(Config.arborGenOutput); + } + waitTime = Config.essentiaGeneratorsDelay; + + } + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + onChunkUnload(); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityAuramGenerator.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityAuramGenerator.java new file mode 100644 index 0000000..67ba408 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityAuramGenerator.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.lib.EssentiaHandler; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityAuramGenerator extends TileEntity +{ + int x; + int y; + int z; + public ForgeDirection orientation; + public static int waitTime; + private BasicSource energySource = new BasicSource(this, 1000000000, 3); + + public TileEntityAuramGenerator() + { + orientation = ForgeDirection.getOrientation(1); + waitTime = 30; + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + + if (waitTime > 0) + { + waitTime--; + } + + if (waitTime <= 0) + { + if (EssentiaHandler.drainEssentia(this, Aspect.AURA, ForgeDirection.UNKNOWN, 8)) + { + energySource.addEnergy(Config.auramGenOutput); + } + waitTime = Config.essentiaGeneratorsDelay; + } + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + energySource.readFromNBT(tag); + } + + @Override + public void writeToNBT(NBTTagCompound tag) { + super.writeToNBT(tag); + energySource.writeToNBT(tag); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityCompressedSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityCompressedSolar.java new file mode 100644 index 0000000..ff70aff --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityCompressedSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityCompressedSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 1); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityCompressedSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.compressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 0); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDarkSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDarkSolar.java new file mode 100644 index 0000000..5911b84 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDarkSolar.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityDarkSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 1); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityDarkSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + if (worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isDaytime() == false && worldObj.isRaining() == false && worldObj.isThundering() == false) + { + energySource.addEnergy(Config.compressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 6); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleAirSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleAirSolar.java new file mode 100644 index 0000000..df084b1 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleAirSolar.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityDoubleAirSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 2); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityDoubleAirSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible && this.yCoord >= 160) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput * 2.5); + } else if (theSunIsVisible) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars2, 1, 0); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleCompressedSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleCompressedSolar.java new file mode 100644 index 0000000..11b3bb8 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleCompressedSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityDoubleCompressedSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 2); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityDoubleCompressedSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 1); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleDarkSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleDarkSolar.java new file mode 100644 index 0000000..b27ab8e --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleDarkSolar.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityDoubleDarkSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 2); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityDoubleDarkSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + if (worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isDaytime() == false && worldObj.isRaining() == false && worldObj.isThundering() == false) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 7); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleEarthSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleEarthSolar.java new file mode 100644 index 0000000..87c7671 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleEarthSolar.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityDoubleEarthSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 2); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityDoubleEarthSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible && this.yCoord <= 10) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput * 2.5); + } else if (theSunIsVisible) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars2, 1, 3); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleFireSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleFireSolar.java new file mode 100644 index 0000000..52321fd --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleFireSolar.java @@ -0,0 +1,131 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityDoubleFireSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 3); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityDoubleFireSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput); + } + if (worldObj.provider.dimensionId == -1) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput * 2); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 13); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleOrderSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleOrderSolar.java new file mode 100644 index 0000000..39184f0 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleOrderSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityDoubleOrderSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 3); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityDoubleOrderSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput * 3); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 10); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleWaterSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleWaterSolar.java new file mode 100644 index 0000000..341aa3e --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityDoubleWaterSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityDoubleWaterSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 2); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityDoubleWaterSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (worldObj.isRaining() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) || worldObj.isThundering() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord)) + { + energySource.addEnergy(Config.doubleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 4); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityEarthSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityEarthSolar.java new file mode 100644 index 0000000..fb4a544 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityEarthSolar.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityEarthSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 1); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityEarthSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible && this.yCoord <= 10) + { + energySource.addEnergy(Config.compressedSolarOutput * 2.5); + } else if (theSunIsVisible) + { + energySource.addEnergy(Config.compressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars2, 1, 2); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityEtherealMacerator.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityEtherealMacerator.java new file mode 100644 index 0000000..4a5aaee --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityEtherealMacerator.java @@ -0,0 +1,392 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.tile.IWrenchable; +import ic2.core.Ic2Items; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.oredict.OreDictionary; +import thaumcraft.common.config.ConfigItems; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityEtherealMacerator extends TileEntity implements ISidedInventory, IWrenchable +{ + private static final int[] slots_top = new int[] { 0 }; + private static final int[] slots_bottom = new int[] { 2, 1 }; + private static final int[] slots_sides = new int[] { 1 }; + + /** + * The ItemStacks that hold the items currently being used in the furnace + */ + private ItemStack[] slots = new ItemStack[3]; + + /** + * the speed of this furnace, 200 is normal / how many ticks it takes : 30 ticks = 1 second + */ + public int maceratingSpeed = Config.etherealProcessorBaseSpeed; + + /** The number of ticks that the current item has been cooking for */ + public int cookTime; + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() { + return this.slots.length; + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) { + return this.slots[par1]; + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack. + */ + public ItemStack decrStackSize(int par1, int par2) { + if (this.slots[par1] != null) + { + ItemStack itemstack; + + if (this.slots[par1].stackSize <= par2) + { + itemstack = this.slots[par1]; + this.slots[par1] = null; + return itemstack; + } else + { + itemstack = this.slots[par1].splitStack(par2); + + if (this.slots[par1].stackSize == 0) + { + this.slots[par1] = null; + } + + return itemstack; + } + } else + { + return null; + } + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) { + if (this.slots[par1] != null) + { + ItemStack itemstack = this.slots[par1]; + this.slots[par1] = null; + return itemstack; + } else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { + this.slots[par1] = par2ItemStack; + + if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + } + + /** + * Returns the name of the inventory. + */ + public String getInvName() { + return "Ethereal Processor"; + } + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's language. Otherwise it will be used directly. + */ + public boolean isInvNameLocalized() { + return false; + } + + /** + * Reads a tile entity from NBT. + */ + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { + super.readFromNBT(par1NBTTagCompound); + NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items"); + this.slots = new ItemStack[this.getSizeInventory()]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i); + byte b0 = nbttagcompound1.getByte("Slot"); + + if (b0 >= 0 && b0 < this.slots.length) + { + this.slots[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + this.cookTime = par1NBTTagCompound.getShort("CookTime"); + } + + /** + * Writes a tile entity to NBT. + */ + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { + super.writeToNBT(par1NBTTagCompound); + par1NBTTagCompound.setShort("CookTime", (short) this.cookTime); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.slots.length; ++i) + { + if (this.slots[i] != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + this.slots[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + + par1NBTTagCompound.setTag("Items", nbttaglist); + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't this more of a set than a get?* + */ + public int getInventoryStackLimit() { + return 64; + } + + @SideOnly(Side.CLIENT) + /** + * Returns an integer between 0 and the passed value representing how close the current item is to being completely + * cooked + */ + public int getCookProgressScaled(int par1) { + return this.cookTime * par1 / this.maceratingSpeed; + } + + public boolean isMacerating() { + return this.cookTime > 0; + } + + /** + * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count ticks and creates a new spawn inside its implementation. + */ + public void updateEntity() { + boolean flag1 = false; + + if (!this.worldObj.isRemote) + { + flag1 = true; + } + + if (this.canSmelt() && isOverLimit(1) == false && isOverLimit(2) == false && isOP() == false) + { + ++this.cookTime; + + if (this.cookTime == this.maceratingSpeed) + { + this.cookTime = 0; + this.smeltItem(); + flag1 = true; + } + } else + { + this.cookTime = 0; + } + + if (flag1) + { + this.onInventoryChanged(); + } + } + + /** + * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc. + */ + private boolean canSmelt() { + if (this.slots[0] == null) + { + return false; + } else + { + ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); + if (itemstack == null) + return false; + if (this.slots[2] == null) + return true; + if (!this.slots[2].isItemEqual(itemstack)) + return false; + int result = slots[2].stackSize + (itemstack.stackSize * 2); + return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); + } + } + + /** + * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack + */ + public void smeltItem() { + if (this.canSmelt()) + { + ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); + + if (this.slots[2] == null) + { + this.slots[2] = itemstack.copy(); + this.slots[2].stackSize *= 2; + } else if (this.slots[2].isItemEqual(itemstack)) + { + slots[2].stackSize += (itemstack.stackSize * 2); + } + + --this.slots[0].stackSize; + + if (this.slots[0].stackSize <= 0) + { + this.slots[0] = null; + } + this.addBonus(); + } + } + + public void addBonus() { + if (this.canSmelt()) + { + if (this.worldObj.rand.nextInt(Config.etherealProcessorBonus) == 0) + { + if (this.slots[1] == null) + { + this.setInventorySlotContents(1, new ItemStack(ConfigItems.itemNugget, 1, 6)); + } else if (this.slots[1].isItemEqual(new ItemStack(ConfigItems.itemNugget, 1, 6)) && this.isOverLimit(1) == false && this.isOverLimit(2) == false) + { + slots[1] = new ItemStack(getStackInSlot(1).getItem(), slots[1].stackSize + 1, 2); + } + } + } + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { + return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; + } + + public void openChest() { + } + + public void closeChest() { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) { + return true; + } + + /** + * Returns an array containing the indices of the slots that can be accessed by automation on the given side of this block. + */ + public int[] getAccessibleSlotsFromSide(int par1) { + return par1 == 0 ? slots_bottom : (par1 == 1 ? slots_top : slots_sides); + } + + /** + * Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, side + */ + public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3) { + return this.isItemValidForSlot(par1, par2ItemStack); + } + + /** + * Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, side + */ + public boolean canExtractItem(int par1, ItemStack par2ItemStack, int par3) { + return true; + } + + public boolean isOverLimit(int i) { + if (slots[i] != null) + { + if (slots[i].stackSize >= 63) + return true; + else if (slots[i].stackSize < 63) + return false; + else + return false; + } else + { + return false; + } + } + + public boolean isOP() { + final int cobblestoneId = OreDictionary.getOreID("blockCobble"); + + if (OreDictionary.getOreID(this.slots[0]) == cobblestoneId || this.slots[0].itemID == Block.sand.blockID || this.slots[0].itemID == Item.potato.itemID || this.slots[0].itemID == Item.porkRaw.itemID || this.slots[0].itemID == Item.beefRaw.itemID || this.slots[0].itemID == Item.chickenRaw.itemID || this.slots[0].itemID == Item.fishRaw.itemID || this.slots[0].itemID == Ic2Items.hydratedCoalDust.itemID || (OreDictionary.getOreName(OreDictionary.getOreID(this.slots[0])).contains("dust"))) + { + return true; + } else + { + return false; + } + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtMachines, 1, 1); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityFireSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityFireSolar.java new file mode 100644 index 0000000..5fabee3 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityFireSolar.java @@ -0,0 +1,131 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityFireSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 1); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityFireSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.compressedSolarOutput); + } + if (worldObj.provider.dimensionId == -1) + { + energySource.addEnergy(Config.compressedSolarOutput * 2); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 12); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityIgnisGenerator.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityIgnisGenerator.java new file mode 100644 index 0000000..d2c6fad --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityIgnisGenerator.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.lib.EssentiaHandler; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityIgnisGenerator extends TileEntity +{ + int x; + int y; + int z; + public ForgeDirection orientation; + public static int waitTime; + private BasicSource energySource = new BasicSource(this, 1000000000, 3); + + public TileEntityIgnisGenerator() + { + orientation = ForgeDirection.getOrientation(1); + waitTime = 30; + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + + if (waitTime > 0) + { + waitTime--; + } + + if (waitTime <= 0) + { + if (EssentiaHandler.drainEssentia(this, Aspect.FIRE, ForgeDirection.UNKNOWN, 8)) + { + energySource.addEnergy(6000); + } + waitTime = Config.essentiaGeneratorsDelay; + } + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + energySource.readFromNBT(tag); + } + + @Override + public void writeToNBT(NBTTagCompound tag) { + super.writeToNBT(tag); + energySource.writeToNBT(tag); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityIndustrialWandRecharge.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityIndustrialWandRecharge.java new file mode 100644 index 0000000..f33911b --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityIndustrialWandRecharge.java @@ -0,0 +1,239 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSink; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.INetworkManager; +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.Packet132TileEntityData; +import net.minecraft.tileentity.TileEntity; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.items.wands.ItemWandCasting; +import cpw.mods.fml.common.network.PacketDispatcher; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityIndustrialWandRecharge extends TileEntity implements IInventory +{ + private BasicSink ic2EnergySink = new BasicSink(this, 100000, 4); + + ItemStack ItemStacks[]; + + public TileEntityIndustrialWandRecharge() + { + ItemStacks = new ItemStack[1]; + } + + @Override + public int getSizeInventory() { + return 1; + } + + @Override + public ItemStack getStackInSlot(int i) { + return ItemStacks[i]; + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if (ItemStacks[i] != null) + { + + if (ItemStacks[i].stackSize <= j) + { + ItemStack itemstack = ItemStacks[i]; + ItemStacks[i] = null; + return itemstack; + } else + { + ItemStack itemstack1 = ItemStacks[i].splitStack(j); + + if (ItemStacks[i].stackSize == 0) + { + ItemStacks[i] = null; + } + + return itemstack1; + } + } else + { + return null; + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int i) { + if (ItemStacks[i] != null) + { + ItemStack itemstack = ItemStacks[i]; + ItemStacks[i] = null; + return itemstack; + } else + { + return null; + } + } + + @Override + public void updateEntity() { + ic2EnergySink.updateEntity(); + if (!this.worldObj.isRemote) + { + if (getStackInSlot(0) != null) + { + + ItemStack wand = getStackInSlot(0); + + if (ic2EnergySink.useEnergy(Config.wandChargerConsumption)) + { + if (wand != null && wand.getItem() instanceof ItemWandCasting) + { + ItemWandCasting wandItem = (ItemWandCasting) wand.getItem(); + wandItem.addVis(wand, Aspect.ORDER, 1, true); + wandItem.addVis(wand, Aspect.FIRE, 1, true); + wandItem.addVis(wand, Aspect.ENTROPY, 1, true); + wandItem.addVis(wand, Aspect.WATER, 1, true); + wandItem.addVis(wand, Aspect.EARTH, 1, true); + wandItem.addVis(wand, Aspect.AIR, 1, true); + } + } + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) { + ItemStacks[i] = itemstack; + + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + { + itemstack.stackSize = getInventoryStackLimit(); + } + } + + @Override + public String getInvName() { + return "Industrial Wand Charging Station"; + } + + @Override + public boolean isInvNameLocalized() { + return false; + } + + @Override + public void openChest() { + + } + + @Override + public void closeChest() { + + } + + @Override + public void readFromNBT(NBTTagCompound tagCompound) { + super.readFromNBT(tagCompound); + + ic2EnergySink.readFromNBT(tagCompound); + + NBTTagList tagList = tagCompound.getTagList("Inventory"); + for (int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); + byte slot = tag.getByte("Slot"); + if (slot >= 0 && slot < ItemStacks.length) + { + ItemStacks[slot] = ItemStack.loadItemStackFromNBT(tag); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound tagCompound) { + super.writeToNBT(tagCompound); + + ic2EnergySink.writeToNBT(tagCompound); + + NBTTagList itemList = new NBTTagList(); + for (int i = 0; i < ItemStacks.length; i++) + { + ItemStack stack = ItemStacks[i]; + if (stack != null) + { + NBTTagCompound tag = new NBTTagCompound(); + tag.setByte("Slot", (byte) i); + stack.writeToNBT(tag); + itemList.appendTag(tag); + } + } + tagCompound.setTag("Inventory", itemList); + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeToNBT(nbttagcompound); + return new Packet132TileEntityData(xCoord, yCoord, zCoord, -999, nbttagcompound); + } + + @Override + public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) { + super.onDataPacket(manager, packet); + readFromNBT(packet.data); + } + + @Override + public void onInventoryChanged() { + super.onInventoryChanged(); + if (!worldObj.isRemote) + { + PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.provider.dimensionId); + } + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + } + + return player.getDistanceSq((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } + + @Override + public void invalidate() { + ic2EnergySink.invalidate(); + super.invalidate(); + } + + @Override + public void onChunkUnload() { + ic2EnergySink.onChunkUnload(); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityOrderSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityOrderSolar.java new file mode 100644 index 0000000..7393f9e --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityOrderSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityOrderSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 2); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityOrderSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.compressedSolarOutput * 3); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 9); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityPortableNode.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityPortableNode.java new file mode 100644 index 0000000..77b0908 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityPortableNode.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import thaumcraft.api.nodes.NodeModifier; +import thaumcraft.api.nodes.NodeType; +import thaumcraft.common.tiles.TileNode; + +public class TileEntityPortableNode extends TileNode +{ + + public TileEntityPortableNode() + { + super(); + } + + @Override + public NodeModifier getNodeModifier() { + return NodeModifier.FADING; + } + + @Override + public NodeType getNodeType() { + return NodeType.UNSTABLE; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityPotentiaGenerator.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityPotentiaGenerator.java new file mode 100644 index 0000000..9603ca5 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityPotentiaGenerator.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.lib.EssentiaHandler; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityPotentiaGenerator extends TileEntity +{ + int x; + int y; + int z; + public ForgeDirection orientation; + public static int waitTime; + + public TileEntityPotentiaGenerator() + { + orientation = ForgeDirection.getOrientation(1); + waitTime = 30; + } + + private BasicSource energySource = new BasicSource(this, 1000000000, 3); + + @Override + public void updateEntity() { + energySource.updateEntity(); + + if (waitTime > 0) + { + waitTime--; + } + + if (waitTime <= 0) + { + if (EssentiaHandler.drainEssentia(this, Aspect.ENERGY, ForgeDirection.UNKNOWN, 8)) + { + energySource.addEnergy(Config.potentiaGenOutput); + } + waitTime = Config.essentiaGeneratorsDelay; + } + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + onChunkUnload(); + } + + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + energySource.readFromNBT(tag); + } + + @Override + public void writeToNBT(NBTTagCompound tag) { + super.writeToNBT(tag); + energySource.writeToNBT(tag); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntitySaxumGenerator.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntitySaxumGenerator.java new file mode 100644 index 0000000..9be129c --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntitySaxumGenerator.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.lib.EssentiaHandler; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntitySaxumGenerator extends TileEntity +{ + int x; + int y; + int z; + public ForgeDirection orientation; + public static int waitTime; + + public TileEntitySaxumGenerator() + { + orientation = ForgeDirection.getOrientation(1); + waitTime = 30; + } + + private BasicSource energySource = new BasicSource(this, 1000000000, 3); + + @Override + public void updateEntity() { + energySource.updateEntity(); + + if (waitTime > 0) + { + waitTime--; + } + + if (waitTime <= 0) + { + if (EssentiaHandler.drainEssentia(this, Aspect.STONE, ForgeDirection.UNKNOWN, 8)) + { + energySource.addEnergy(Config.arborGenOutput); + } + waitTime = Config.essentiaGeneratorsDelay; + + } + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + onChunkUnload(); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleAirSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleAirSolar.java new file mode 100644 index 0000000..218f47b --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleAirSolar.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityTripleAirSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 1000000, 5); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityTripleAirSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible && this.yCoord >= 160) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput * 2.5); + } else if (theSunIsVisible) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars2, 1, 1); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleCompressedSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleCompressedSolar.java new file mode 100644 index 0000000..9f7216f --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleCompressedSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityTripleCompressedSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 1000000, 3); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityTripleCompressedSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 2); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleDarkSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleDarkSolar.java new file mode 100644 index 0000000..c913d66 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleDarkSolar.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityTripleDarkSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 1000000, 3); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityTripleDarkSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + if (worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isDaytime() == false && worldObj.isRaining() == false && worldObj.isThundering() == false) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 8); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleEarthSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleEarthSolar.java new file mode 100644 index 0000000..92623e8 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleEarthSolar.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityTripleEarthSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 1000000, 5); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityTripleEarthSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible && this.yCoord <= 10) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput * 2.5); + } else if (theSunIsVisible) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars2, 1, 4); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleFireSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleFireSolar.java new file mode 100644 index 0000000..a5e6f4e --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleFireSolar.java @@ -0,0 +1,131 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityTripleFireSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 1000000, 5); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityTripleFireSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput); + } + if (worldObj.provider.dimensionId == -1) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput * 2); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 14); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleOrderSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleOrderSolar.java new file mode 100644 index 0000000..c03ee09 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleOrderSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityTripleOrderSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 1000000, 5); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityTripleOrderSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (theSunIsVisible) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput * 3); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 11); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleWaterSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleWaterSolar.java new file mode 100644 index 0000000..ebd641d --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityTripleWaterSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityTripleWaterSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 1000000, 3); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityTripleWaterSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (worldObj.isRaining() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) || worldObj.isThundering() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord)) + { + energySource.addEnergy(Config.tripleCompressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 5); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityWaterSolar.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityWaterSolar.java new file mode 100644 index 0000000..a0d2149 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/TileEntityWaterSolar.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile; + +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; + +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry; +import electricMagicTools.tombenpotter.electricmagictools.common.Config; + +public class TileEntityWaterSolar extends TileEntity implements IWrenchable +{ + + private BasicSource energySource = new BasicSource(this, 10000, 1); + private static Random random = new Random(); + private boolean initialized; + public boolean theSunIsVisible; + private int tick; + private boolean canRain; + private boolean noSunlight; + + public TileEntityWaterSolar() + { + super(); + this.tick = random.nextInt(64); + } + + @Override + public void updateEntity() { + energySource.updateEntity(); + if (!initialized && worldObj != null) + { + canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; + noSunlight = worldObj.provider.hasNoSky; + initialized = true; + } + if (noSunlight) + { + return; + } + if (tick-- == 0) + { + updateSunState(); + tick = 64; + } + int energyProduction = 0; + + if (worldObj.isRaining() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) || worldObj.isThundering() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord)) + { + energySource.addEnergy(Config.compressedSolarOutput); + } + energySource.addEnergy(energyProduction); + } + + private void updateSunState() { + boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering()); + theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord); + } + + @Override + public void onChunkUnload() { + energySource.onChunkUnload(); + } + + @Override + public void invalidate() { + energySource.invalidate(); + super.invalidate(); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + energySource.writeToNBT(nbttagcompound); + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + energySource.readFromNBT(nbttagcompound); + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { + return false; + } + + @Override + public short getFacing() { + return 0; + } + + @Override + public void setFacing(short facing) { + + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) { + return true; + } + + @Override + public float getWrenchDropRate() { + return 1; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { + return new ItemStack(BlockRegistry.emtSolars, 1, 3); + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/container/ContainerEtheralMacerator.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/container/ContainerEtheralMacerator.java new file mode 100644 index 0000000..1a5973c --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/container/ContainerEtheralMacerator.java @@ -0,0 +1,153 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile.container; + +import ic2.core.IC2; +import ic2.core.slot.SlotInvSlot; + +import java.util.List; +import java.util.ListIterator; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import thaumcraft.common.container.SlotOutput; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEtherealMacerator; + +public class ContainerEtheralMacerator extends Container +{ + + TileEntityEtherealMacerator te; + + public ContainerEtheralMacerator(InventoryPlayer inventory, TileEntity te) + { + this.te = ((TileEntityEtherealMacerator) te); + addSlotToContainer(new Slot(this.te, 0, 56, 26)); + addSlotToContainer(new SlotOutput(this.te, 2, 116, 26)); + addSlotToContainer(new SlotOutput(this.te, 1, 116, 53)); + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 9; j++) + { + addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + for (int i = 0; i < 9; i++) + { + addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142)); + } + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return this.te.isUseableByPlayer(player); + } + + @SuppressWarnings("unchecked") + @Override + public final ItemStack transferStackInSlot(EntityPlayer player, int sourceSlotIndex) { + Slot sourceSlot = (Slot) inventorySlots.get(sourceSlotIndex); + + if (sourceSlot != null && sourceSlot.getHasStack()) + { + ItemStack sourceItemStack = sourceSlot.getStack(); + int oldSourceItemStackSize = sourceItemStack.stackSize; + + if (sourceSlot.inventory == player.inventory) + { // player inventory + // clicked + // 0: fill input existing stacks, 1: fill input empty stacks, 2: + // fill existing stacks, 3: fill empty stacks + for (int run = 0; run < 4 && sourceItemStack.stackSize > 0; run++) + { + if (run < 2) + { + for (Slot targetSlot : (List) inventorySlots) + { + if (targetSlot instanceof SlotInvSlot && ((SlotInvSlot) targetSlot).invSlot.canInput() && targetSlot.isItemValid(sourceItemStack)) + { + if (targetSlot.getStack() != null || run == 1) + { + mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false); + + if (sourceItemStack.stackSize == 0) + break; + } + } + } + } else + { + for (Slot targetSlot : (List) inventorySlots) + { + if (targetSlot.inventory != player.inventory && targetSlot.isItemValid(sourceItemStack)) + { + if (targetSlot.getStack() != null || run == 3) + { + mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false); + + if (sourceItemStack.stackSize == 0) + break; + } + } + } + } + } + } else + { // Shift-Click on a GUIslot of the container + for (int run = 0; run < 2 && sourceItemStack.stackSize > 0; run++) + { + for (ListIterator it = ((List) inventorySlots).listIterator(inventorySlots.size()); it.hasPrevious();) + { + Slot targetSlot = it.previous(); + + if (targetSlot.inventory == player.inventory && targetSlot.isItemValid(sourceItemStack)) + { + if (targetSlot.getStack() != null || run == 1) + { + mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false); + + if (sourceItemStack.stackSize == 0) + break; + } + } + } + } + } + + if (sourceItemStack.stackSize != oldSourceItemStackSize) + { + if (sourceItemStack.stackSize == 0) + { + sourceSlot.putStack(null); + } else + { + sourceSlot.onPickupFromSlot(player, sourceItemStack); + } + + // vanilla doesn't fully re-sync after processing the slot click + // packet, + // causing a race condition of the client received an old state + // through packet delay after the slot click + // this forces a proper sync + if (IC2.platform.isSimulating()) + { + detectAndSendChanges(); + } + } + } + + return null; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/container/ContainerIndustrialWandRecharge.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/container/ContainerIndustrialWandRecharge.java new file mode 100644 index 0000000..6e7f2b3 --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/container/ContainerIndustrialWandRecharge.java @@ -0,0 +1,154 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile.container; + +import ic2.core.IC2; +import ic2.core.slot.SlotInvSlot; + +import java.util.List; +import java.util.ListIterator; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIndustrialWandRecharge; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.slot.SlotWandOnly; + +public class ContainerIndustrialWandRecharge extends Container +{ + + TileEntityIndustrialWandRecharge charger; + SlotWandOnly wandSlot; + + public ContainerIndustrialWandRecharge(InventoryPlayer invPlayer, TileEntityIndustrialWandRecharge entity) + { + this.charger = entity; + + for (int x = 0; x < 9; x++) + { + this.addSlotToContainer(new Slot(invPlayer, x, 8 + x * 18, 142)); + } + + for (int y = 0; y < 3; y++) + { + for (int x = 0; x < 9; x++) + { + this.addSlotToContainer(new Slot(invPlayer, 9 + x + y * 9, 8 + x * 18, 84 + y * 18)); + } + } + + this.addSlotToContainer(this.wandSlot = new SlotWandOnly(this, entity, 0, 80, 35)); + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return charger.isUseableByPlayer(player); + } + + @SuppressWarnings("unchecked") + @Override + public final ItemStack transferStackInSlot(EntityPlayer player, int sourceSlotIndex) { + Slot sourceSlot = (Slot) inventorySlots.get(sourceSlotIndex); + + if (sourceSlot != null && sourceSlot.getHasStack()) + { + ItemStack sourceItemStack = sourceSlot.getStack(); + int oldSourceItemStackSize = sourceItemStack.stackSize; + + if (sourceSlot.inventory == player.inventory) + { // player inventory + // clicked + // 0: fill input existing stacks, 1: fill input empty stacks, 2: + // fill existing stacks, 3: fill empty stacks + for (int run = 0; run < 4 && sourceItemStack.stackSize > 0; run++) + { + if (run < 2) + { + for (Slot targetSlot : (List) inventorySlots) + { + if (targetSlot instanceof SlotInvSlot && ((SlotInvSlot) targetSlot).invSlot.canInput() && targetSlot.isItemValid(sourceItemStack)) + { + if (targetSlot.getStack() != null || run == 1) + { + mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false); + + if (sourceItemStack.stackSize == 0) + break; + } + } + } + } else + { + for (Slot targetSlot : (List) inventorySlots) + { + if (targetSlot.inventory != player.inventory && targetSlot.isItemValid(sourceItemStack)) + { + if (targetSlot.getStack() != null || run == 3) + { + mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false); + + if (sourceItemStack.stackSize == 0) + break; + } + } + } + } + } + } else + { // Shift-Click on a GUIslot of the container + for (int run = 0; run < 2 && sourceItemStack.stackSize > 0; run++) + { + for (ListIterator it = ((List) inventorySlots).listIterator(inventorySlots.size()); it.hasPrevious();) + { + Slot targetSlot = it.previous(); + + if (targetSlot.inventory == player.inventory && targetSlot.isItemValid(sourceItemStack)) + { + if (targetSlot.getStack() != null || run == 1) + { + mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false); + + if (sourceItemStack.stackSize == 0) + break; + } + } + } + } + } + + if (sourceItemStack.stackSize != oldSourceItemStackSize) + { + if (sourceItemStack.stackSize == 0) + { + sourceSlot.putStack(null); + } else + { + sourceSlot.onPickupFromSlot(player, sourceItemStack); + } + + // vanilla doesn't fully re-sync after processing the slot click + // packet, + // causing a race condition of the client received an old state + // through packet delay after the slot click + // this forces a proper sync + if (IC2.platform.isSimulating()) + { + detectAndSendChanges(); + } + } + } + + return null; + } +} diff --git a/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/slot/SlotWandOnly.java b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/slot/SlotWandOnly.java new file mode 100644 index 0000000..999cbca --- /dev/null +++ b/src/main/java/electricMagicTools/tombenpotter/electricmagictools/common/tile/slot/SlotWandOnly.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ +package electricMagicTools.tombenpotter.electricmagictools.common.tile.slot; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import thaumcraft.common.items.wands.ItemWandCasting; +import electricMagicTools.tombenpotter.electricmagictools.common.tile.container.ContainerIndustrialWandRecharge; + +public class SlotWandOnly extends Slot +{ + final ContainerIndustrialWandRecharge charger; + + public SlotWandOnly(ContainerIndustrialWandRecharge indCharger, IInventory inv, int par3, int par4, int par5) + { + super(inv, par3, par4, par5); + this.charger = indCharger; + } + + @Override + public boolean isItemValid(ItemStack par1ItemStack) { + if (!(par1ItemStack.getItem() instanceof ItemWandCasting)) + return false; + + ItemWandCasting wand = (ItemWandCasting) par1ItemStack.getItem(); + return wand.getCap(par1ItemStack).getBaseCostModifier() <= 1F; + } + + @Override + public int getSlotStackLimit() { + return 1; + } +} diff --git a/src/main/resources/assets/electricmagictools/lang/WHAT I DIDen_US.lang b/src/main/resources/assets/electricmagictools/lang/WHAT I DIDen_US.lang new file mode 100644 index 0000000..90a84cc --- /dev/null +++ b/src/main/resources/assets/electricmagictools/lang/WHAT I DIDen_US.lang @@ -0,0 +1,43 @@ +Thaumonomicon Names----- +emt.tag.Electric Magic Tools=Combining Technology and Magic +emt.tag.Thaumium Drill=Magic drilling +emt.tag.Thaumium Chainsaw=Magic Chopping and attacking +emt.tag.Electric Goggles=Electric Goggles of Revealing +emt.tag.Thaumic Nanosuit Helmet=Nanosuit Goggles of Revealing +emt.tag.Thaumic Quantum Helmet=Quantum Goggles of Revealing +emt.tag.Iron Omnitool=All in one! +emt.tag.Diamond Omnitool=All in one V2! +emt.tag.Thaumium Omnitool=All in one V3! +emt.tag.Explosion Focus=Concentrated Firebat +emt.tag.Kris-tmas Focus=Ho! Ho! Ho! +emt.tag.Shield Focus=S.H.I.E.L.D. +emt.tag.Potentia Generator=Energetic fun +emt.tag.Ignis Generator=Fiery fun +emt.tag.Auram Generator=Magical fun +emt.tag.Arbor Generator=Energy from trees +emt.tag.Chainsaw of the Stream=Chop it all! +emt.tag.Drill of the Rockbreaker=Mine it all! +emt.tag.Shield Block=To blow or not to blow... +emt.tag.Tiny Uranium=From large, to tiny... + +Thaumonomicon Texts----- +emt.text.Electric Magic Tools=Welcome to the realm of magic, associated with technology! Our researchers worked in association with the Thaumaturges to make their preferred tools compatible with each system. +emt.text.Thaumium Drill=You have discovered a way to infuse Thaumium with mundane electricity. You have managed to bring the diamond drill to a level higher than its previous state. Nevertheless, these ameliorations do not come without drawbacks : during the magical process, the Drill lost its ability to place torches. The Thaumium Drill itslef is not near the level reached by the Iridium Drill, so consider it as a mid-tier tool. You think you will manage to upgrade this tool in future projects. +emt.text.Thaumium Chainsaw=You have discovered a way to infuse Thaumium with mundane electricity. You have managed to bring the chainsaw to a level higher than its previous state. Nevertheless, these ameliorations do not come without drawbacks : during the magical process, the Chainsaw lost its ability to shear. You think you will manage to upgrade this tool in future projects. +emt.text.Electric Goggles=You have discovered a way to merge your goggles of revealing with mundane electricity. You can now recharge your goggles using EU, and see everything as it was before. You need a diamond helmet to be able to merge electricity and your goggles, getting a better protection out of the deal. +emt.text.Thaumic Nanosuit Helmet=You have discovered a way to infuse advanced technological armor with magic. You have managed to bring the nanosuit helmet to a magic level so important that it now shows nodes and aspects. However, during the magical process, you lost the ability to control the nightvision effect of your helmet. +emt.text.Thaumic Quantum Helmet=You have discovered a way to infuse highly advanced technological armor with magic. You have managed to bring the quantum helmet to a magic level so important that it now shows nodes and aspects. However, during the magical process, you lost the ability to control the nightvision effect and get fed by your helmet. +emt.text.Iron Omnitool=You have discovered a way to combine the Mining Drill and the Chainsaw, resulting in a tool capable of doing everything those two tools could do! It comes to your attention, that since both tools are such low-level, this recipe is to happen in a mundane crafting bench. +emt.text.Diamond Omnitool=You have discovered a way to combine the Diamond Drill and the Diamond Chainsaw, resulting in a tool capable of doing everything those two tools could do! It comes to your attention, that since Diamonds are gems, and crystals are a good catalyst of magic, this recipe is to happen in the Arcane Worktable. +emt.text.Thaumium Omnitool=You have discovered a way to combine the Thaumium Drill and the Thaumium Chainsaw, resulting in a tool capable of doing everything those two tools could do! But do not forget that these tools were already infused with magic, which makes this Infusion quite risky. +emt.text.Explosion Focus=You have found a way to modify the Nine Hells focus, therefore provoking a rather ... explosive effect. You have found the perfect tool for focusing the power of the beasts : the mundane mining laser. This recipe is not cheap, nor on the material side, nor in the magic side. +emt.text.Kris-tmas Focus=Merry Christmas! This time, you have discovered a way to spawn some friends of yours, all thanks to the magic of Christmas! +emt.text.Shield Focus=You have studied the portable hole, understanding how you could pass through blocks with its help. You have decided to reverse its effects, and create a shield of blocks to protect yourself from danger. However, doing so will make you slow down for the duration the shield is held. The shield is said to resist to anything and everything. Watch out! The shiel will replace all the blocks nearby, not caring if anything is already there. Use at your own risk, and for your own safety. +emt.text.Potentia Generator=After numerous studies and hard research, you have finally managed to find how to create electricity from your spare essentia. The process is very specific, including many machines, but the result is worth it. This machine produces between 3000 and 3500 EU per unit of Potentia, making it really efficient. To produce energy, place a Potentia Jar on top of the machine. You think you will manage to convert which type of Essentia it uses in your future projects. +emt.text.Ignis Generator=After some more studies, you have found a way to exchange which essentia your generator uses. You now have an Ignis Generator! +emt.text.Auram Generator=After some more studies, you have found a way to exchange which essentia your generator uses. You now have an Auram Generator! +emt.text.Arbor Generator=After some more studies, you have found a way to exchange which essentia your generator uses. You now have an Arbor Generator! +emt.text.Chainsaw of the Stream=After studying both the Axe of the Stream and the Thaumium Chainsaw, you managed to combine most of their abilities, resulting in an electric tool that can chop down whole trees. +emt.text.Drill of the Rockbreaker=After studying the Pickaxe of the Core, the Shovel of the Earthmover and the Thaumium Drill, you have managed to combine most of their abilities, resulting in an electric tool that can mine a whole 3x3x1 area of pickaxe materials, and dirt materials really quickly. It is also able to find the closest ore clusters costing some EU. +emt.text.Shield Block=After a long study of the shield created by the shield focus, you have discovered how to make its blocks real! They are highly blast resistant, and even nuke proof. Be warned that in case of a nuclear explosion, the blocks survive, but the environnement might not. These blocks are so volatile that they do not drop when broken, even if the silk touch enchant is used. +emt.text.Tiny Uranium=After processing your all your ores and using them for the creation of nuclear reactors, you have finally run out of uranium nuggets, nedeed to make your beloved fuel rods. After long researches, you have managed to transform your leftover uranium into the needed nuggets! However, this process is a bit wasteful, but you believe it to be worth the cost. \ No newline at end of file diff --git a/src/main/resources/assets/electricmagictools/lang/en_US.lang b/src/main/resources/assets/electricmagictools/lang/en_US.lang new file mode 100644 index 0000000..d26fe10 --- /dev/null +++ b/src/main/resources/assets/electricmagictools/lang/en_US.lang @@ -0,0 +1,95 @@ +Thaumonomicon Names----- +emt.tag.Electric Magic Tools=Who says magic and technology can't go together? +emt.tag.Thaumium Drill=Magical mining +emt.tag.Thaumium Chainsaw=Felling trees and severing heads with a touch of magic +emt.tag.Electric Goggles=The best of both worlds +emt.tag.Nanosuit Goggles of Revealing=Top-tier eye protection +emt.tag.Quantum Goggles of Revealing=Protection coupled with utility +emt.tag.Iron Omnitool=Changing tools is for peasants +emt.tag.Diamond Omnitool=Jack of all trades +emt.tag.Thaumium Omnitool=Mystical multitool +emt.tag.Explosion Focus=Use only in well-ventilated areas +emt.tag.Kris-tmas Focus=Ho! Ho! Ho! +emt.tag.Shield Focus=S.H.I.E.L.D. +emt.tag.Potentia Generator=Harnessing the power-producing potential of essentia +emt.tag.Ignis Generator=If you can't handle the heat... +emt.tag.Auram Generator=Harnessing the magic in the air +emt.tag.Arbor Generator=Bringing power generation back to its basics +emt.tag.Saxum Generator=Using the remaining heat of solidifed lava +emt.tag.Chainsaw of the Stream=Felling trees in a single swoop +emt.tag.Drill of the Rockbreaker=Mining it big +emt.tag.Shield Block=Magical protection +emt.tag.Tiny Uranium=Some shrinkage may occur +emt.tag.Mjolnir=Godly power +emt.tag.The Legend=Childhood memories... +emt.tag.Lightning Summoner=From vilest enemies +emt.tag.Supercharged Mjolnir=Making it yours +emt.tag.Industrial Wand Charging Station=Charging your wand the industrial way +emt.tag.Compressed Solars=Increase the efficiency! +emt.tag.Solar Helmet of Revealing=The sunlight hurts my eyes +emt.tag.Diamond Chainsaw=Harder, better, faster, stronger +emt.tag.Thaumium Plate=Thaumium, the industrial way +emt.tag.Macerating Native Ore Clusters=Augmenting your yield +emt.tag.Electric Boots of the Traveller=I've got the power +emt.tag.Nano Boots of the Traveller=Speed demon +emt.tag.Quantum Boots of the Traveller=Faster than light +emt.tag.Electric Scribing Tools=Save squiddy! +emt.tag.Etheral Processor=The sky is blue... +emt.tag.Water Infused Solar Panels=Curse you rain! +emt.tag.Entropy Infused Solar Panels=Not afraid of the dark +emt.tag.Order Infused Solar Panels=I've got the power! +emt.tag.Fire Infused Solar Panels=Where it is hot and dangerous... +emt.tag.Air Infused Solar Panels=Don't be afraid of heights +emt.tag.Earth Infused Solar Panels=Not for claustrophobic persons +emt.tag.UU-Matter Infusion=A magically charged metamorphic liquid... +emt.tag.Portable Node=Randomly convenient +emt.tag.Electric Hoe of Growth=Shockingly natural +emt.tag.Wand Focus: Charging=From vis to electricity + +Thaumonomicon Texts----- +emt.text.Electric Magic Tools=Who says magic can't work with technology? Our researchers have collaborated with top mages of the school of Thaumaturgy to bring you the effectiveness of magic coupled with the convenience of electric tools. +emt.text.Thaumium Drill=You have discovered a way to infuse Thaumium with mundane electricity. Fusing Thaumium to a Diamond Drill results in a tool that can dig through stone faster and has a higher capacity.

While Thaumium is a very useful and powerful material, it is nowhere near the strength of Iridium. It is considered a mid-tier tool.

This tool may not be the most powerful, but you have a feeling that you will be able to upgrade it in the near future. +emt.text.Thaumium Chainsaw=You have found a way to fuse Thaumium to a Diamond Chainsaw, allowing it to fell trees quicker and hold more power. Nevertheless, these ameliorations do not come without drawbacks: during the process of fusing these materials, the chainsaw loses its ability to shear foliage, tall grass, and animals.

You have an intuition you will be able to upgrade this tool in the near future. +emt.text.Electric Goggles=You have found a way to detect auras using purely electronic means, no longer requiring mystical energy that can be depleted over time. You can now create a pair of Goggles of Revealing that can be recharged with EU while being able to see Aura Nodes just as you could before. A diamond helmet is required to house the sensitive vis sensing circuitry and prevent it from being damaged, this has the added benefit of providing extra protection. +emt.text.Nanosuit Goggles of Revealing=You have discovered a way to incorporate your previous vis sensors to a Nanosuit Helmet without moving too much around. By infusing the nano helmet with magic, you will be able to use it to see Aura Nodes. During the magical process, the control circuits for the night vision feature are replaced with capacitors to absorb the excess magical energy and vis-sensing microchips. This will prevent you from turning off the night vision effect of the helmet. +emt.text.Quantum Goggles of Revealing=It took a lot of trial and error, but you have found a way to slip in vis detection sensors to a Quantum Helmet. By infusing the quantum helmet with magic, you will be able to use it to see Aura Nodes. During the design process, you had to replace several control circuits that involve the night vision and automatic feeding with vis detecting circuitry and capacitors to absorb the excess magical en You find that using a Mining Laser to contain it can safely focus and direct the explosive pulse where t vision effect and the feeding unit of the helmet. Have fun getting force-fed.ergy. This will prevent you from turning off the night vision and feeding features. +emt.text.Iron Omnitool=While tinkering with the inner workings of some of your tools to see if magical integration is a possibility, you have discovered a way to combine the Mining Drill and the Chainsaw, resulting in a tool capable of both mining, cutting down trees and attack enemies! As you are working with mundane metals, magic influence is not needed to merge these tools together. +emt.text.Diamond Omnitool=Your discovery of an Iron Omnitool has driven you to try to accomplish the same with some more powerful devices. You have discovered a way to combine the Diamond Drill and the Diamond Chainsaw, resulting in a tool capable of both mining, cutting down trees and attack enemies, while maintaining the speed and capacity bonuses of the diamond tools. As diamonds are incredibly tough and nearly impossible to reshape once the raw diamonds have been fashioned into tools such as drills and chainsaws, you will require a little bit of magic to coax them to merge. +emt.text.Thaumium Omnitool=After creating the Diamond and Iron Omnitools, the next logic step was to do the same with Thaumium. Unfortunately, this isn't as easy. You have discovered a way to combine the Thaumium Drill and the Thaumium Chainsaw, resulting in a tool capable of mining and chopping trees at great speed with a high energy capacity. These tools have already once been infused with magic. You are not sure of what is to happen if they were to be infused again. +emt.text.Explosion Focus=You have found a way to modify the Nine Hells focus by exposing the bats to the rather explosive properties of a Mining Laser. This focus acts similarily to a Mining Laser but uses vis instead of EU. This explosive foci has the downside of being incredibly unstable, so you make a note to be careful. +emt.text.Kris-tmas Focus=Merry Christmas!

You have found a novel use for the frost focus. By exposing it to the magic of Christmas, you can summon your snowy friends at will to fire snowballs at your Festivus celebrating neighbours! +emt.text.Shield Focus=With some experimentation with the Portable Hole, you have found more about the transportation of objects to alternate dimensions. You believe you can reverse these effects to summon a swath of blocks from a dimension full of matter to shield you from any oncoming disaster. Caution is to be taken when using this focus, as when bringing these blocks into our dimension, it will transpose any blocks in the way into the dimension it came from, never to return again. You will also be unable to move while this shield is in existance. +emt.text.Potentia Generator=After much studying and research, you have finally discovered how to create electricity from your leftover essentia.

This generator will produce between 3000 and 3500 EU per unit of Potentia, making it very efficient. Simply place a Warded Jar containing Potentia in a 8 blocks radius of the machine and it will draw it in to create EU.

While Potentia seems like the most logical choice for producing essentia with EU, tou believe you will be able to generate electricity from different essentia in the near future with a bit of tinkering. +emt.text.Ignis Generator=Just as you thought, with a bit of tweaking, you have found a way to instead use Ignis essentia to produce power. On the inside, this machine is able to heat water by consuming Ignis. The steam produced by this heat then spins turbines, similarily to a typical generator. +emt.text.Auram Generator=Though it took a bit more work than you initially thought, you have found a way to produce EU using Auram essenita. This required a complete reworking of the machine, relying on Auram's pulsating magical power to spin a generator. +emt.text.Arbor Generator=You always seem to have excess Arbor essentia sitting around. Not anymore! By modifying your original Potentia generator, you have found a way to produce energy using Arbor essentia instead. +emt.text.Saxum Generator=You always thought that the Saxum essentia was radiating some kind of heat, a heat that could be used to make energy. And you have been proved right! You have modified your Potentia Generator to create some heat, used to make energy. +emt.text.Chainsaw of the Stream=After studying both the Axe of the Stream and the Thaumium Chainsaw, you managed to combine most of their abilities, resulting in an electric tool that can chop down whole trees without much effort. +emt.text.Drill of the Rockbreaker=After studying the Pickaxe of the Core, the Shovel of the Earthmover and the Thaumium Drill, you have managed to combine most of their abilities, resulting in an electric tool that can mine a whole 3x3x1 area of pickaxe materials, and dirt materials very quickly.

This marvelous device is able to find the closest ore clusters on a shift-right click, though at the cost of some EU. +emt.text.Shield Block=After studying the blocks created by the shield focus, you have discovered how to recreate them yourself, without relying on them to be summoned by the focus. They are highly blast resistant, and even resistant to nukes. However, in the event of an actual nuclear explosion, while the shield blocks will survive the aftermath, the surrounding blocks will not.

These blocks are unstable and do not drop when broken, even when Silk Touch is used. +emt.text.Tiny Uranium=After processing your all your ores and using them for the creation of nuclear reactors, you have finally run out of uranium nuggets, nedeed to make your beloved fuel rods. After long research sessions, you have managed to transform your leftover uranium into much-needed nuggets!

Unfortunately, this process is a bit wasteful, but you believe it to be worth the cost. +emt.text.Mjolnir=You have travelled the world, in quest for the mighty Hammer of Thor. One day, you stumbled upon its broken remains, and your heart crumbled with it. Ater some long and tedeous research, you found a way to restore this magnificent tool to its past greatness.

You have an odd feeling,(you seem to have a lot of those), that although this tool is amazingly powerful, you could do more with it. +emt.text.The Legend=You have always heard about the Legend of the Hammer.

It is said that the god of Lightning, Thor, had a hammer capable of summoning lightning.

The legend also states that, when the god retired in his dimension, he left his hammer, hidden somewhere in a well protected dungeon, where only a worthy mortal could find it.

You have long since wanted to go explore the world, to try and find it. +emt.text.Lightning Summoner=This item is dropped by your archenemy, the Supercharged Creeper. You feel it is going to be very useful later on. +emt.text.Supercharged Mjolnir=After some more exploring of the dungeons existing all around the worlds and dimensions, you have managed to find a method that makes you able to overpower Thor's power, making his Hammer yours. Furthermore, you have managed to make your Hammer summon defenders, some strange Snow-Golems like creature that shall protect you. However, the hammer lost its power to summon lightning where you desire it to, and creates a ring of lightning around you. +emt.text.Industrial Wand Charging Station=You have managed to combine the powers of the Wand Pedestal with those of the mighty Uu-Matter, resulting in a machine capable of replicating aspects on your wand, at the cost of 50000 EU to recharge every aspect on the wand of 1 unit. +emt.text.Compressed Solars=You have found a way to compress 9 mundane Solar Panels in a magical one, that acts as if it was made of 10 mundane solar panels, generating 10 eu/t. You can repeat this process with Compressed Solar Panels, getting Double Compressed Solar Panels. They act as if they were made of 10 Compressed Solars, therefore generating 100 eu/t. +emt.text.Solar Helmet of Revealing=You now have a helmet that acts exactly like your quantum goggles of revealing, but can also recharge your chest armor! It generates 128 eu/t during the day, and nothing at night. +emt.text.Diamond Chainsaw=You are unsure why the thought of upgrading a Chainsaw with diamonds similarily to what you have done with a Drill has never occured to you. This upgrade makes the Chainsaw capable of holding more energy and breaking blocks faster. +emt.text.Thaumium Plate=As every electrical engineer knows, plates are the basis of many devices. We knew that pressing Thaumium into plates would be a neccesary step to facilitate integration of magic into our tools, but this made the mages of the school of Thaumaturgy very upset. The don't like us tampering with their precious metal. You can produce these plates as shown, which is a bit more expensive, or in a metal former, requiring only one Thaumium Ingot. Keep an eye out for angry mages. +emt.text.Macerating Native Ore Clusters=You can macerate all Native Ore Clusters, except cinnabar. You will get 22 tiny dusts per Native Ore Cluster macerated. +emt.text.Electric Boots of the Traveller=With lots of precise mechanical components and a touch of magic, you have recreated the effects of the Boots of the Traveller in a more stable form. These boots, unlike the original, will not wear away over time, but instead use EU. These boots negate all fall damage, and have all the properties of the Boots of the Traveller. +emt.text.Nano Boots of the Traveller=Your Electric Boots of the Traveller are nice, but you think you can do better. You have found a way to upgrade these boots to the Nano tier, improving the mechanical components and improving the spell cast on the footwear. These boots allow for higher jumps and faster running than before. +emt.text.Quantum Boots of the Traveller=You have meddled with Quantum Physics, making these Quantum Boots of the Traveller so fast, that your appear to be at multiple places at once. But do not forget what happened to Schrodinger's cat... +emt.text.Electric Scribing Tools=You have decided not to kill any more squid. Therefore, you researched a way to charge your scribing tools, in a way that would make them need no ink. Thanks to static electricity, and the ball pen technology, you managed to make the ink inside the scribing tools spin so quickly, that EU could recharge it. +emt.text.Etheral Processor=After taping into hell's power with the Infernal Furnace to get some rewards out of your mining sessions, you have something totally different in mind. You are now using the power of the "Good", the sky and the so called "Paradise". This Ethereal Processor doubles the yield of every smelting recipe, and gives a 10% chance of getting a Thaumium Nugget as a bonus. You can see two drawbacks to this : as it doubles your smelting yield, it takes twice the time to process an item. As it is a highly magical device, some mundane smelting recipes do not seem to work. You are confident that smelting cobblestone into stone will not work into this wonder-machine. +emt.text.Water Infused Solar Panels=You always hated rain, especially when all your power came from Solar Panels. You hated it so much that you decided to find a way to make your Solar Panels keep running during rain. You managed it... kind of. The Water Infused Solar Panels work during rain, and during rain only. +emt.text.Entropy Infused Solar Panels=You know that Solar Panels stop working at nightime. To counter that, you found a way to make your Solar Panels produce energy at night! +emt.text.Order Infused Solar Panels=Harnessing the power of Order, you have managed to triple the output of your Solar Panels at day! +emt.text.Fire Infused Solar Panels=Fascinated by the Nether, you created a monster. These Solar Panels work like normal in the Overworld, but also produce more energy when they are located in the Nether! A monster a tell you.. +emt.text.Air Infused Solar Panels=Your adventurous mind and the natural amount of air existing at the top of the wolrd make these Solar Panels yield more energy when located over Y = 160. +emt.text.Earth Infused Solar Panels=You have decided to get closer to the core. These Solar Panels produce more energy under Y = 10, but keep in mind they rebellious spirits need to be able to see the sun to work. +emt.text.UU-Matter Infusion=You have always found the powers possessed by UU-Mater very strange, even... magical looking, especially the hability to take a large number of shapes if manipulated correctly. And here you are, having discovered a way to shape the liquid through the process of Infusion Crafting. Many recipes are available, and all of them use between 4 to 32 of each primal aspect. +emt.text.Portable Node=After studying in an in-depth manner the wonders of Node Jarring, you have managed to create an item capable of spawning a random node. However, due to some parts of node magic you cannot understand, this Portable Node will always be Fading and Unstable.

You can only get rid of it by a shift-right click, and you think that you should dispose of it as soon as possible, for unstable nodes are... rather unpredictable. +emt.text.Electric Hoe of Growth=You have managed to upgrade your Hoe of Growth. It now delivers little shocks to the land and plants around it, much like your regular Hoe of Growth would do.

However, the magic contained within this tool is too powerful for you to convert it fully to using mundane electricity, for the tool still has a limited number of uses before it breaks, but is rechargeable. +emt.text.Wand Focus: Charging=You realized you always carry a wand with you, along with your electric staff. But sometimes, you have ran out of juice in your electric tools. That's why you created this wand focus. It is very simple, yet very useful, for it drains vis from your wand storage, and charges the items using mundane electricity. diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/arborfront.png b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/arborfront.png new file mode 100644 index 0000000..6446faf Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/arborfront.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/auramfront.png b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/auramfront.png new file mode 100644 index 0000000..6571bf2 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/auramfront.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/ignisfront.png b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/ignisfront.png new file mode 100644 index 0000000..e25e3f5 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/ignisfront.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/potentiafront.png b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/potentiafront.png new file mode 100644 index 0000000..bca4ccf Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/potentiafront.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/saxumfront.png b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/saxumfront.png new file mode 100644 index 0000000..bb3b38c Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/saxumfront.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/side.png b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/side.png new file mode 100644 index 0000000..7783103 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/side.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/top.png b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/top.png new file mode 100644 index 0000000..0836285 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/essentiagenerator/top.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/machines/bottom.png b/src/main/resources/assets/electricmagictools/textures/blocks/machines/bottom.png new file mode 100644 index 0000000..0836285 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/machines/bottom.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmacerator.png b/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmacerator.png new file mode 100644 index 0000000..a85b8ef Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmacerator.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratorfront.png b/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratorfront.png new file mode 100644 index 0000000..2dc3ee8 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratorfront.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratorfrontactive.png b/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratorfrontactive.png new file mode 100644 index 0000000..12b2a6e Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratorfrontactive.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratortop.png b/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratortop.png new file mode 100644 index 0000000..769b13d Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/machines/etherealmaceratortop.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/machines/side.png b/src/main/resources/assets/electricmagictools/textures/blocks/machines/side.png new file mode 100644 index 0000000..7783103 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/machines/side.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/machines/top.png b/src/main/resources/assets/electricmagictools/textures/blocks/machines/top.png new file mode 100644 index 0000000..0836285 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/machines/top.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/machines/wandcharger.png b/src/main/resources/assets/electricmagictools/textures/blocks/machines/wandcharger.png new file mode 100644 index 0000000..91947a3 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/machines/wandcharger.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/portablenode.png b/src/main/resources/assets/electricmagictools/textures/blocks/portablenode.png new file mode 100644 index 0000000..98f8763 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/portablenode.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/shield.png b/src/main/resources/assets/electricmagictools/textures/blocks/shield.png new file mode 100644 index 0000000..281371c Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/shield.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/airbottom.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/airbottom.png new file mode 100644 index 0000000..8b45cc4 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/airbottom.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/airside.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/airside.png new file mode 100644 index 0000000..1fed154 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/airside.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/bottom.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/bottom.png new file mode 100644 index 0000000..0836285 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/bottom.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/darkbottom.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/darkbottom.png new file mode 100644 index 0000000..a9b6ed2 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/darkbottom.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/darkside.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/darkside.png new file mode 100644 index 0000000..ee0350a Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/darkside.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/doublesolartop.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/doublesolartop.png new file mode 100644 index 0000000..29fe539 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/doublesolartop.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/earthbottom.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/earthbottom.png new file mode 100644 index 0000000..00f5701 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/earthbottom.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/earthside.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/earthside.png new file mode 100644 index 0000000..3c0e785 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/earthside.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/firebottom.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/firebottom.png new file mode 100644 index 0000000..7e820ff Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/firebottom.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/fireside.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/fireside.png new file mode 100644 index 0000000..1b4f33c Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/fireside.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/orderbottom.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/orderbottom.png new file mode 100644 index 0000000..938dd67 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/orderbottom.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/orderside.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/orderside.png new file mode 100644 index 0000000..cd9d3b4 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/orderside.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/side.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/side.png new file mode 100644 index 0000000..7783103 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/side.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/solartop.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/solartop.png new file mode 100644 index 0000000..3274227 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/solartop.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/triplesolartop.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/triplesolartop.png new file mode 100644 index 0000000..23b7215 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/triplesolartop.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/waterbottom.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/waterbottom.png new file mode 100644 index 0000000..06e1b42 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/waterbottom.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/blocks/solars/waterside.png b/src/main/resources/assets/electricmagictools/textures/blocks/solars/waterside.png new file mode 100644 index 0000000..14cea2f Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/blocks/solars/waterside.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/guis/etherealmacerator.png b/src/main/resources/assets/electricmagictools/textures/guis/etherealmacerator.png new file mode 100644 index 0000000..1f17bad Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/guis/etherealmacerator.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/guis/wandcharger.png b/src/main/resources/assets/electricmagictools/textures/guis/wandcharger.png new file mode 100644 index 0000000..d64de50 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/guis/wandcharger.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/chargefocus.png b/src/main/resources/assets/electricmagictools/textures/items/chargefocus.png new file mode 100644 index 0000000..3b4d042 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/chargefocus.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/chargefocus.png.mcmeta b/src/main/resources/assets/electricmagictools/textures/items/chargefocus.png.mcmeta new file mode 100644 index 0000000..4a650b1 --- /dev/null +++ b/src/main/resources/assets/electricmagictools/textures/items/chargefocus.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 5 + } +} diff --git a/src/main/resources/assets/electricmagictools/textures/items/christmasfocus.png b/src/main/resources/assets/electricmagictools/textures/items/christmasfocus.png new file mode 100644 index 0000000..326b5c4 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/christmasfocus.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/clusteruranium.png b/src/main/resources/assets/electricmagictools/textures/items/clusteruranium.png new file mode 100644 index 0000000..cc02cb0 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/clusteruranium.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/crushedamber.png b/src/main/resources/assets/electricmagictools/textures/items/crushedamber.png new file mode 100644 index 0000000..d8d05b1 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/crushedamber.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/crushedcinnabar.png b/src/main/resources/assets/electricmagictools/textures/items/crushedcinnabar.png new file mode 100644 index 0000000..b063043 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/crushedcinnabar.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/diamondchainsaw.png b/src/main/resources/assets/electricmagictools/textures/items/diamondchainsaw.png new file mode 100644 index 0000000..a860618 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/diamondchainsaw.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/diamondomnitool.png b/src/main/resources/assets/electricmagictools/textures/items/diamondomnitool.png new file mode 100644 index 0000000..6fa9cc1 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/diamondomnitool.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/electricboots.png b/src/main/resources/assets/electricmagictools/textures/items/electricboots.png new file mode 100644 index 0000000..d59477d Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/electricboots.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/electricgoggles.png b/src/main/resources/assets/electricmagictools/textures/items/electricgoggles.png new file mode 100644 index 0000000..833f6f8 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/electricgoggles.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/electrichoegrowth.png b/src/main/resources/assets/electricmagictools/textures/items/electrichoegrowth.png new file mode 100644 index 0000000..a242db5 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/electrichoegrowth.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/explosionfocus.png b/src/main/resources/assets/electricmagictools/textures/items/explosionfocus.png new file mode 100644 index 0000000..e54d37a Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/explosionfocus.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/hammer/electricthorhammer.png b/src/main/resources/assets/electricmagictools/textures/items/hammer/electricthorhammer.png new file mode 100644 index 0000000..d2040cf Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/hammer/electricthorhammer.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/hammer/electricthorhammer.png.mcmeta b/src/main/resources/assets/electricmagictools/textures/items/hammer/electricthorhammer.png.mcmeta new file mode 100644 index 0000000..d3db93d --- /dev/null +++ b/src/main/resources/assets/electricmagictools/textures/items/hammer/electricthorhammer.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 30 + } +} diff --git a/src/main/resources/assets/electricmagictools/textures/items/hammer/taintedthorhammer.png b/src/main/resources/assets/electricmagictools/textures/items/hammer/taintedthorhammer.png new file mode 100644 index 0000000..dc62117 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/hammer/taintedthorhammer.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/hammer/taintedthorhammer.png.mcmeta b/src/main/resources/assets/electricmagictools/textures/items/hammer/taintedthorhammer.png.mcmeta new file mode 100644 index 0000000..d3db93d --- /dev/null +++ b/src/main/resources/assets/electricmagictools/textures/items/hammer/taintedthorhammer.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 30 + } +} diff --git a/src/main/resources/assets/electricmagictools/textures/items/hammer/thorhammer.png b/src/main/resources/assets/electricmagictools/textures/items/hammer/thorhammer.png new file mode 100644 index 0000000..6122108 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/hammer/thorhammer.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/ironomnitool.png b/src/main/resources/assets/electricmagictools/textures/items/ironomnitool.png new file mode 100644 index 0000000..8f4d218 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/ironomnitool.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/lightningsummoner.png b/src/main/resources/assets/electricmagictools/textures/items/lightningsummoner.png new file mode 100644 index 0000000..edb3892 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/lightningsummoner.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/nanobootstravel.png b/src/main/resources/assets/electricmagictools/textures/items/nanobootstravel.png new file mode 100644 index 0000000..26bbccf Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/nanobootstravel.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/nanothaumichelmet.png b/src/main/resources/assets/electricmagictools/textures/items/nanothaumichelmet.png new file mode 100644 index 0000000..4e654c7 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/nanothaumichelmet.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/purifiedamber.png b/src/main/resources/assets/electricmagictools/textures/items/purifiedamber.png new file mode 100644 index 0000000..b59d8bd Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/purifiedamber.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/purifiedcinnabar.png b/src/main/resources/assets/electricmagictools/textures/items/purifiedcinnabar.png new file mode 100644 index 0000000..af149cc Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/purifiedcinnabar.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/quantumbootstravel.png b/src/main/resources/assets/electricmagictools/textures/items/quantumbootstravel.png new file mode 100644 index 0000000..0514196 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/quantumbootstravel.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/quantumthaumichelmet.png b/src/main/resources/assets/electricmagictools/textures/items/quantumthaumichelmet.png new file mode 100644 index 0000000..b3f31dc Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/quantumthaumichelmet.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/rockbreakerdrill.png b/src/main/resources/assets/electricmagictools/textures/items/rockbreakerdrill.png new file mode 100644 index 0000000..f6a2c53 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/rockbreakerdrill.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/shieldfocus.png b/src/main/resources/assets/electricmagictools/textures/items/shieldfocus.png new file mode 100644 index 0000000..f55a453 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/shieldfocus.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/solarrevealinghelmet.png b/src/main/resources/assets/electricmagictools/textures/items/solarrevealinghelmet.png new file mode 100644 index 0000000..3e368e1 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/solarrevealinghelmet.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/streamchainsaw.png b/src/main/resources/assets/electricmagictools/textures/items/streamchainsaw.png new file mode 100644 index 0000000..11b3ab7 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/streamchainsaw.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/streamchainsaw.png.mcmeta b/src/main/resources/assets/electricmagictools/textures/items/streamchainsaw.png.mcmeta new file mode 100644 index 0000000..d3db93d --- /dev/null +++ b/src/main/resources/assets/electricmagictools/textures/items/streamchainsaw.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 30 + } +} diff --git a/src/main/resources/assets/electricmagictools/textures/items/thaumiumchainsaw.png b/src/main/resources/assets/electricmagictools/textures/items/thaumiumchainsaw.png new file mode 100644 index 0000000..0de7168 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/thaumiumchainsaw.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/thaumiumdrill.png b/src/main/resources/assets/electricmagictools/textures/items/thaumiumdrill.png new file mode 100644 index 0000000..3225484 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/thaumiumdrill.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/thaumiumomnitool.png b/src/main/resources/assets/electricmagictools/textures/items/thaumiumomnitool.png new file mode 100644 index 0000000..f89c9f1 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/thaumiumomnitool.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/items/thaumiumplate.png b/src/main/resources/assets/electricmagictools/textures/items/thaumiumplate.png new file mode 100644 index 0000000..420afcf Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/items/thaumiumplate.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/misc/emt.png b/src/main/resources/assets/electricmagictools/textures/misc/emt.png new file mode 100644 index 0000000..661f59d Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/misc/emt.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/misc/thaumiumplaterecipe.png b/src/main/resources/assets/electricmagictools/textures/misc/thaumiumplaterecipe.png new file mode 100644 index 0000000..a90541a Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/misc/thaumiumplaterecipe.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/electricboots.png b/src/main/resources/assets/electricmagictools/textures/models/electricboots.png new file mode 100644 index 0000000..6f8a59a Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/electricboots.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/electricgoggles.png b/src/main/resources/assets/electricmagictools/textures/models/electricgoggles.png new file mode 100644 index 0000000..feecead Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/electricgoggles.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/lasermodel.png b/src/main/resources/assets/electricmagictools/textures/models/lasermodel.png new file mode 100644 index 0000000..d95ef1c Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/lasermodel.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/nanobootstravel.png b/src/main/resources/assets/electricmagictools/textures/models/nanobootstravel.png new file mode 100644 index 0000000..6535f21 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/nanobootstravel.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/quantumbootstravel.png b/src/main/resources/assets/electricmagictools/textures/models/quantumbootstravel.png new file mode 100644 index 0000000..ebd17bd Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/quantumbootstravel.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/scaryhelmet.png b/src/main/resources/assets/electricmagictools/textures/models/scaryhelmet.png new file mode 100644 index 0000000..8f3bb68 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/scaryhelmet.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/solarrevealinghelmet.png b/src/main/resources/assets/electricmagictools/textures/models/solarrevealinghelmet.png new file mode 100644 index 0000000..678e67b Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/solarrevealinghelmet.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/thaumicnanohelmet.png b/src/main/resources/assets/electricmagictools/textures/models/thaumicnanohelmet.png new file mode 100644 index 0000000..969bd35 Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/thaumicnanohelmet.png differ diff --git a/src/main/resources/assets/electricmagictools/textures/models/thaumicquantumhelmet.png b/src/main/resources/assets/electricmagictools/textures/models/thaumicquantumhelmet.png new file mode 100644 index 0000000..8fd61bc Binary files /dev/null and b/src/main/resources/assets/electricmagictools/textures/models/thaumicquantumhelmet.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000..d91a18b --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,16 @@ +[ +{ + "modid": "ElectricMagicTools", + "name": "Electric Magic Tools", + "description": "Have you ever thought about combining IC2 and TC4?", + "version": "${1.0.7}", + "mcversion": "${1.6.4}", + "url": "http://www.minecraftforum.net/topic/2196652-164smpindustrialcraft-2thaumcraft-electric-magic-tools/", + "updateUrl": "", + "authors": ["Tombenpotter"], + "credits": "All the guys who helped me in any way, shape or form, and beta testers I bug to try and break my stuff. And of course the IC2 team and Azanor", + "logoFile": "/assets/electricmagictools/textures/misc/emt.png", + "screenshots": [], + "dependencies": ["Thaumcraft", "ic2"] +} +]