diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..19fa4f2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +# Set default behaviour, in case users don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files we want to always be normalized and converted to native line endings on checkout. +*.md text +*.info text +*.txt text + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary diff --git a/.gitignore b/.gitignore index 8eef75c..fb705af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,28 @@ -build/ -.classpath -.project -.gradle/ -eclipse/ +gnore Gradle cache files & directories bin/ +build/ + +## Exclusive to IronChests repo/ -/run/ +run/ + +## Forge +forge-*.txt + +## Eclipse +eclipse/ +.classpath +.gradle/ +.project .settings/ -#IDEA files from Gradle -.idea/ + +## Idea +.idea /*.iml /*.ipr /*.iws + +# Ignore OS cache files & directories +*.DS_Store +_MACOSX +Thumbs.db diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..648667a --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,5 @@ +Copyright (c) 2012-14 cpw + +All rights reserved. This program and the accompanying materials +are made available under the terms of the GNU Public License v3.0, +which are available at http://www.gnu.org/licenses/gpl.html diff --git a/build.gradle b/build.gradle index a24a928..6ce4cb8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,196 +1,196 @@ -// This sets us up for building a forge project - you need all of these -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - -// Apply the forge plugin - this adds all the magic for automatically obfuscating, deobfuscating etc -apply plugin: 'forge' - -// This is a simple flatdir repository for "uploadArchives" when you don't have a remote repo to target -repositories { - flatDir { - name "fileRepo" - dirs "repo" - } -} -// IronChest uses git tagging to mark major versions. This sets up the project version to that version data -def versionInfo = getGitVersion() -version = "${versionInfo['IronChest.version']}" - -// This is our group. I'm cpw.mods -group= "cpw.mods" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -// This is our actual project within the group. Note: FML has "fml" here. But this is ironchest. -archivesBaseName = "ironchest" - -// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here -minecraft { - version = "1.7.10-10.13.0.1150" -} - -// This wrangles the resources for the jar files- stuff like textures and languages -processResources -{ - // we're omitting the .xcf files - they're development only - exclude '**/*.xcf' - // we only want to do search/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' - } - - // generate version.properties file from the git version data earlier - doLast { - def propsFile = new File(destinationDir, 'version.properties') - def properties = new Properties() - properties.putAll(versionInfo) - properties['IronChest.build.mcversion'] = project.minecraft.version - properties.store(propsFile.newWriter(), null) - } -} - -// this sets our output jar to have a 'tag' of 'universal' on it -// It also adds the minecraft version in a custom version name -// The result is files named ---universal.jar -jar { - classifier = 'universal' - version = "${project.minecraft.version}-${project.version}" - -} - -println "FISHBUM ${jar.version}" - -// Add in a source jar for people, should they desire to download such a thing -task sourceJar(type: Jar) { - from sourceSets.main.allSource - classifier = 'src' - version = "${project.minecraft.version}-${project.version}" -} - -// Add in an mcp named jar, for those who wish to run in a development environment (assuming mcp naming matches) -task deobfJar(type: Jar) { - from sourceSets.main.output - classifier = 'deobf' - version = "${project.minecraft.version}-${project.version}" -} - -// Tell the artifact system about our extra jars -artifacts { - archives sourceJar, deobfJar -} - -// Configure an upload task. this is setup for uploading to files.minecraftforge.net. There are other examples around -uploadArchives { - dependsOn 'reobf' - repositories { - if (project.hasProperty("filesmaven")) { - logger.info('Publishing to files server') - - mavenDeployer { - configuration = configurations.deployJars - - repository(url: project.filesmaven.url) { - authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key) - } - - // This is just the pom data for the maven repo - pom { - groupId = project.group - // Force the maven upload to use the - syntax preferred at files - version = "${project.minecraft.version}-${project.version}" - artifactId = project.archivesBaseName - project { - name project.archivesBaseName - packaging 'jar' - description 'IronChest' - url 'https://github.com/cpw/IronChest' - - scm { - url 'https://github.com/progwml6/IronChest' - connection 'scm:git:git://github.com/progwml6/IronChest.git' - developerConnection 'scm:git:git@github.com:progwml6/IronChest.git' - } - - issueManagement { - system 'github' - url 'https://github.com/progwml6/IronChest/issues' - } - - licenses { - license { - name 'GNU Public License (GPL), Version 3.0' - url 'http://www.gnu.org/licenses/gpl-3.0.txt' - distribution 'repo' - } - } - - developers { - developer { - id 'cpw' - name 'cpw' - roles { role 'developer' } - } - } - } - } - } - } else { - logger.info('Publishing to repo folder') - - mavenDeployer { - pom.version = "${project.minecraft.version}-${project.version}" - repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath()) - } - } - } -} - -// This is a special task for pulling the version information from git and the environment (for BUILD_NUMBER) -def getGitVersion() -{ - def out = [:] - - // call git command. - def outStream = new ByteArrayOutputStream() - def result = exec { - executable = 'git' - args = [ 'describe', '--long', "--match=[^(jenkins)]*"] - standardOutput = outStream - } - - def fullVersion = outStream.toString().trim() - def matcher = fullVersion =~ /(\d+).(\d+)-(\d+)-(.*)/ - - def maj = matcher[0][1] - def min = matcher[0][2] - def rev = matcher[0][3] - def bn = System.getenv("BUILD_NUMBER") ?: "1" - - out['IronChest.build.major.number'] = maj.toString() - out['IronChest.build.minor.number'] = min.toString() - out['IronChest.build.revision.number'] = rev.toString() - out['IronChest.build.githash'] = matcher[0][4].toString() - out['IronChest.build.number' ] = bn.toString() - out['IronChest.version' ] = "${maj}.${min}.${rev}.${bn}".toString() - - return out -} +// This sets us up for building a forge project - you need all of these +buildscript { + repositories { + mavenCentral() + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + } +} + +// Apply the forge plugin - this adds all the magic for automatically obfuscating, deobfuscating etc +apply plugin: 'forge' + +// This is a simple flatdir repository for "uploadArchives" when you don't have a remote repo to target +repositories { + flatDir { + name "fileRepo" + dirs "repo" + } +} +// IronChest uses git tagging to mark major versions. This sets up the project version to that version data +def versionInfo = getGitVersion() +version = "${versionInfo['IronChest.version']}" + +// This is our group. I'm cpw.mods +group= "cpw.mods" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +// This is our actual project within the group. Note: FML has "fml" here. But this is ironchest. +archivesBaseName = "ironchest" + +// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here +minecraft { + version = "1.7.10-10.13.0.1150" +} + +// This wrangles the resources for the jar files- stuff like textures and languages +processResources +{ + // we're omitting the .xcf files - they're development only + exclude '**/*.xcf' + // we only want to do search/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' + } + + // generate version.properties file from the git version data earlier + doLast { + def propsFile = new File(destinationDir, 'version.properties') + def properties = new Properties() + properties.putAll(versionInfo) + properties['IronChest.build.mcversion'] = project.minecraft.version + properties.store(propsFile.newWriter(), null) + } +} + +// this sets our output jar to have a 'tag' of 'universal' on it +// It also adds the minecraft version in a custom version name +// The result is files named ---universal.jar +jar { + classifier = 'universal' + version = "${project.minecraft.version}-${project.version}" + +} + +println "FISHBUM ${jar.version}" + +// Add in a source jar for people, should they desire to download such a thing +task sourceJar(type: Jar) { + from sourceSets.main.allSource + classifier = 'src' + version = "${project.minecraft.version}-${project.version}" +} + +// Add in an mcp named jar, for those who wish to run in a development environment (assuming mcp naming matches) +task deobfJar(type: Jar) { + from sourceSets.main.output + classifier = 'deobf' + version = "${project.minecraft.version}-${project.version}" +} + +// Tell the artifact system about our extra jars +artifacts { + archives sourceJar, deobfJar +} + +// Configure an upload task. this is setup for uploading to files.minecraftforge.net. There are other examples around +uploadArchives { + dependsOn 'reobf' + repositories { + if (project.hasProperty("filesmaven")) { + logger.info('Publishing to files server') + + mavenDeployer { + configuration = configurations.deployJars + + repository(url: project.filesmaven.url) { + authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key) + } + + // This is just the pom data for the maven repo + pom { + groupId = project.group + // Force the maven upload to use the - syntax preferred at files + version = "${project.minecraft.version}-${project.version}" + artifactId = project.archivesBaseName + project { + name project.archivesBaseName + packaging 'jar' + description 'IronChest' + url 'https://github.com/cpw/IronChest' + + scm { + url 'https://github.com/progwml6/IronChest' + connection 'scm:git:git://github.com/progwml6/IronChest.git' + developerConnection 'scm:git:git@github.com:progwml6/IronChest.git' + } + + issueManagement { + system 'github' + url 'https://github.com/progwml6/IronChest/issues' + } + + licenses { + license { + name 'GNU Public License (GPL), Version 3.0' + url 'http://www.gnu.org/licenses/gpl-3.0.txt' + distribution 'repo' + } + } + + developers { + developer { + id 'cpw' + name 'cpw' + roles { role 'developer' } + } + } + } + } + } + } else { + logger.info('Publishing to repo folder') + + mavenDeployer { + pom.version = "${project.minecraft.version}-${project.version}" + repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath()) + } + } + } +} + +// This is a special task for pulling the version information from git and the environment (for BUILD_NUMBER) +def getGitVersion() +{ + def out = [:] + + // call git command. + def outStream = new ByteArrayOutputStream() + def result = exec { + executable = 'git' + args = [ 'describe', '--long', "--match=[^(jenkins)]*"] + standardOutput = outStream + } + + def fullVersion = outStream.toString().trim() + def matcher = fullVersion =~ /(\d+).(\d+)-(\d+)-(.*)/ + + def maj = matcher[0][1] + def min = matcher[0][2] + def rev = matcher[0][3] + def bn = System.getenv("BUILD_NUMBER") ?: "1" + + out['IronChest.build.major.number'] = maj.toString() + out['IronChest.build.minor.number'] = min.toString() + out['IronChest.build.revision.number'] = rev.toString() + out['IronChest.build.githash'] = matcher[0][4].toString() + out['IronChest.build.number' ] = bn.toString() + out['IronChest.version' ] = "${maj}.${min}.${rev}.${bn}".toString() + + return out +} diff --git a/gradlew.bat b/gradlew.bat index aec9973..8a0b282 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,90 +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 +@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/scripts/setup.bat b/scripts/setup.bat new file mode 100644 index 0000000..85d8863 --- /dev/null +++ b/scripts/setup.bat @@ -0,0 +1,2 @@ +gradle setupDecompWorkspace +gradle eclipse \ No newline at end of file diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100644 index 0000000..a2c40ef --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1 @@ +gradle setupDecompWorkspace && gradle eclipse \ No newline at end of file diff --git a/scripts/setupw.bat b/scripts/setupw.bat new file mode 100644 index 0000000..bb72ee5 --- /dev/null +++ b/scripts/setupw.bat @@ -0,0 +1,2 @@ +gradlew setupDecompWorkspace +gradlew eclipse \ No newline at end of file diff --git a/scripts/setupw.sh b/scripts/setupw.sh new file mode 100644 index 0000000..19f3bcf --- /dev/null +++ b/scripts/setupw.sh @@ -0,0 +1 @@ +bash gradlew setupDecompWorkspace && bash gradlew eclipse \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/BlockIronChest.java b/src/main/java/cpw/mods/ironchest/BlockIronChest.java index da4c957..49b82f7 100644 --- a/src/main/java/cpw/mods/ironchest/BlockIronChest.java +++ b/src/main/java/cpw/mods/ironchest/BlockIronChest.java @@ -1,13 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import static net.minecraftforge.common.util.ForgeDirection.DOWN; @@ -17,8 +7,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import com.google.common.collect.Lists; - import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -38,15 +26,15 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; + +import com.google.common.collect.Lists; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockIronChest extends BlockContainer { - - private Random random; - - @SideOnly(Side.CLIENT) - private IIcon[][] icons; + @SideOnly(Side.CLIENT) + public static IIcon icon[] = new IIcon[IronChestType.values().length]; public BlockIronChest() { @@ -54,17 +42,13 @@ public class BlockIronChest extends BlockContainer { setBlockName("IronChest"); setHardness(3.0F); setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); - random = new Random(); setCreativeTab(CreativeTabs.tabDecorations); } - /** - * Overridden by {@link #createTileEntity(World, int)} - */ @Override - public TileEntity createNewTileEntity(World w, int i) + public TileEntity createNewTileEntity(World world, int meta) { - return null; + return IronChestType.makeEntity(meta); } @Override @@ -86,21 +70,23 @@ public class BlockIronChest extends BlockContainer { } @Override - public TileEntity createTileEntity(World world, int metadata) + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister r) { - return IronChestType.makeEntity(metadata); + for (IronChestType type : IronChestType.values()) + { + if (type.isValidForCreativeMode()) + { + icon[type.ordinal()] = r.registerIcon("ironchest:" + type.name().toLowerCase()); + } + } } - @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int i, int j) + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { - if (j < IronChestType.values().length) - { - IronChestType type = IronChestType.values()[j]; - return type.getIcon(i); - } - return null; + return icon[meta]; } @Override @@ -112,22 +98,13 @@ public class BlockIronChest extends BlockContainer { items.add(stack); return items; } + @Override public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int i1, float f1, float f2, float f3) { TileEntity te = world.getTileEntity(i, j, k); - if (te == null || !(te instanceof TileEntityIronChest)) - { - return true; - } - - if (world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN)) - { - return true; - } - - if (world.isRemote) + if (te == null || !(te instanceof TileEntityIronChest) || world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN) || world.isRemote) { return true; } @@ -187,48 +164,48 @@ public class BlockIronChest extends BlockContainer { if (tileentitychest != null) { tileentitychest.removeAdornments(); - dropContent(0, tileentitychest, world, tileentitychest.xCoord, tileentitychest.yCoord, tileentitychest.zCoord); + dropItems(0, tileentitychest, world, tileentitychest.xCoord, tileentitychest.yCoord, tileentitychest.zCoord); } super.breakBlock(world, i, j, k, i1, i2); } - public void dropContent(int newSize, IInventory chest, World world, int xCoord, int yCoord, int zCoord) + public void dropItems(int newSize, IInventory chest, World world, int i, int j, int k) { - for (int l = newSize; l < chest.getSizeInventory(); l++) + for (int i1 = 0; i1 < chest.getSizeInventory(); ++i1) { - ItemStack itemstack = chest.getStackInSlot(l); - if (itemstack == null) + Random rand = new Random(); + ItemStack is = chest.getStackInSlot(i1); + + if (is != null) { - continue; - } - float f = random.nextFloat() * 0.8F + 0.1F; - float f1 = random.nextFloat() * 0.8F + 0.1F; - float f2 = random.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int i1 = random.nextInt(21) + 10; - if (i1 > itemstack.stackSize) + EntityItem entityitem; + + for (float f = rand.nextFloat() * 0.8F + 0.1F; is.stackSize > 0; world.spawnEntityInWorld(entityitem)) { - i1 = itemstack.stackSize; + int j1 = rand.nextInt(21) + 10; + + if (j1 > is.stackSize) + { + j1 = is.stackSize; + } + + is.stackSize -= j1; + entityitem = new EntityItem(world, (double)((float)i + f), (double)((float)j + f), (double)((float)k + f), new ItemStack(is.getItem(), j1, is.getItemDamage())); + float f2 = 0.05F; + entityitem.motionX = (double)((float)rand.nextGaussian() * f2); + entityitem.motionY = (double)((float)rand.nextGaussian() * f2 + 0.2F); + entityitem.motionZ = (double)((float)rand.nextGaussian() * f2); + + if (is.hasTagCompound()) + { + entityitem.getEntityItem().setTagCompound((NBTTagCompound)is.getTagCompound().copy()); + } } - itemstack.stackSize -= i1; - EntityItem entityitem = new EntityItem(world, (float) xCoord + f, (float) yCoord + (newSize > 0 ? 1 : 0) + f1, (float) zCoord + f2, - new ItemStack(itemstack.getItem(), i1, itemstack.getItemDamage())); - float f3 = 0.05F; - entityitem.motionX = (float) random.nextGaussian() * f3; - entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float) random.nextGaussian() * f3; - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); - } - world.spawnEntityInWorld(entityitem); } } } @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { @@ -272,22 +249,10 @@ public class BlockIronChest extends BlockContainer { return 0; } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister par1IconRegister) - { - for (IronChestType typ: IronChestType.values()) - { - typ.makeIcons(par1IconRegister); - } - } - - private static final ForgeDirection[] validRotationAxes = new ForgeDirection[] { UP, DOWN }; @Override public ForgeDirection[] getValidRotations(World worldObj, int x, int y, int z) { - return validRotationAxes; + return new ForgeDirection[] { UP, DOWN }; } @Override diff --git a/src/main/java/cpw/mods/ironchest/ChestChangerType.java b/src/main/java/cpw/mods/ironchest/ChestChangerType.java index 65dd56a..304f3cc 100644 --- a/src/main/java/cpw/mods/ironchest/ChestChangerType.java +++ b/src/main/java/cpw/mods/ironchest/ChestChangerType.java @@ -1,9 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. 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 - * - * Contributors: cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import static cpw.mods.ironchest.IronChestType.COPPER; @@ -16,7 +10,6 @@ import static cpw.mods.ironchest.IronChestType.SILVER; import static cpw.mods.ironchest.IronChestType.WOOD; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.config.Configuration; import cpw.mods.fml.common.registry.GameRegistry; public enum ChestChangerType { @@ -56,7 +49,7 @@ public enum ChestChangerType { return this.target.ordinal(); } - public ItemChestChanger buildItem(Configuration cfg) + public ItemChestChanger buildItem() { item = new ItemChestChanger(this); GameRegistry.registerItem(item, itemName); @@ -76,14 +69,6 @@ public enum ChestChangerType { } } - public static void buildItems(Configuration cfg) - { - for (ChestChangerType type : values()) - { - type.buildItem(cfg); - } - } - public static void generateRecipes() { for (ChestChangerType item : values()) diff --git a/src/main/java/cpw/mods/ironchest/CommonProxy.java b/src/main/java/cpw/mods/ironchest/CommonProxy.java deleted file mode 100644 index 9b82146..0000000 --- a/src/main/java/cpw/mods/ironchest/CommonProxy.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package cpw.mods.ironchest; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import cpw.mods.fml.common.network.IGuiHandler; - -public class CommonProxy implements IGuiHandler { - public void registerRenderInformation() - { - - } - - public void registerTileEntitySpecialRenderer(IronChestType typ) - { - - } - - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - return null; - } - - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int X, int Y, int Z) - { - TileEntity te = world.getTileEntity(X, Y, Z); - if (te != null && te instanceof TileEntityIronChest) - { - TileEntityIronChest icte = (TileEntityIronChest) te; - return new ContainerIronChest(player.inventory, icte, icte.getType(), 0, 0); - } - else - { - return null; - } - } - - public World getClientWorld() - { - return null; - } - -} diff --git a/src/main/java/cpw/mods/ironchest/ContainerIronChest.java b/src/main/java/cpw/mods/ironchest/ContainerIronChest.java index 92f111d..a4f99c7 100644 --- a/src/main/java/cpw/mods/ironchest/ContainerIronChest.java +++ b/src/main/java/cpw/mods/ironchest/ContainerIronChest.java @@ -1,22 +1,12 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; +import invtweaks.api.container.ChestContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import invtweaks.api.container.ChestContainer; @ChestContainer(isLargeChest = true) public class ContainerIronChest extends Container { @@ -85,13 +75,13 @@ public class ContainerIronChest extends Container { protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize) { if (type == IronChestType.DIRTCHEST9000) { - addSlotToContainer(type.makeSlot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18)); + addSlotToContainer(new Slot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18)); } else { for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++) { for (int chestCol = 0; chestCol < type.getRowLength(); chestCol++) { - addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18)); + addSlotToContainer(new Slot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18)); } } } @@ -101,8 +91,7 @@ public class ContainerIronChest extends Container { { for (int playerInvCol = 0; playerInvCol < 9; playerInvCol++) { - addSlotToContainer(new Slot(playerInventory, playerInvCol + playerInvRow * 9 + 9, leftCol + playerInvCol * 18, ySize - (4 - playerInvRow) * 18 - - 10)); + addSlotToContainer(new Slot(playerInventory, playerInvCol + playerInvRow * 9 + 9, leftCol + playerInvCol * 18, ySize - (4 - playerInvRow) * 18 - 10)); } } diff --git a/src/main/java/cpw/mods/ironchest/IronChest.java b/src/main/java/cpw/mods/ironchest/IronChest.java index 9cf3e85..f371d70 100644 --- a/src/main/java/cpw/mods/ironchest/IronChest.java +++ b/src/main/java/cpw/mods/ironchest/IronChest.java @@ -1,88 +1,55 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.config.Configuration; -import org.apache.logging.log4j.Level; -import cpw.mods.fml.common.FMLLog; 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.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.ironchest.net.UniversalProxy; -@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[10.10,);required-after:FML@[7.2,)") +@Mod(modid = IronChest.modid, name = IronChest.name) public class IronChest { - public static BlockIronChest ironChestBlock; - @SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy") - public static CommonProxy proxy; - @Instance("IronChest") - public static IronChest instance; - public static boolean CACHE_RENDER = true; - public static boolean OCELOTS_SITONCHESTS = true; + public static final String modid = "IronChest", name = "Iron Chests", proxyPath = "cpw.mods.ironchest.net.UniversalProxy"; + + @Instance(modid) + public static IronChest instance; + + @SidedProxy(clientSide = proxyPath, serverSide = proxyPath) + public static UniversalProxy proxy; + + public static BlockIronChest ironChestBlock; @EventHandler - public void preInit(FMLPreInitializationEvent event) + public void preInit(FMLPreInitializationEvent e) { - Version.init(event.getVersionProperties()); - event.getModMetadata().version = Version.fullVersionString(); - Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); - try - { - cfg.load(); - ChestChangerType.buildItems(cfg); - CACHE_RENDER = cfg.get(Configuration.CATEGORY_GENERAL, "cacheRenderingInformation", true).getBoolean(true); - OCELOTS_SITONCHESTS = cfg.get(Configuration.CATEGORY_GENERAL, "ocelotsSitOnChests", true).getBoolean(true); - } - catch (Exception e) - { - FMLLog.log(Level.ERROR, e, "IronChest has a problem loading its configuration"); - } - finally - { - if (cfg.hasChanged()) - cfg.save(); - } + Version.init(e.getVersionProperties()); + e.getModMetadata().version = Version.fullVersionString(); + + for (ChestChangerType type : ChestChangerType.values()) + type.buildItem(); ironChestBlock = new BlockIronChest(); GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest"); + PacketHandler.INSTANCE.ordinal(); } @EventHandler - public void load(FMLInitializationEvent evt) + public void init(FMLInitializationEvent e) { for (IronChestType typ : IronChestType.values()) { - GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest."+typ.name(), typ.name()); + GameRegistry.registerTileEntityWithAlternatives(typ.clazz, modid + "." + typ.name(), typ.name()); proxy.registerTileEntitySpecialRenderer(typ); } IronChestType.registerBlocksAndRecipes(ironChestBlock); ChestChangerType.generateRecipes(); NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); proxy.registerRenderInformation(); -// if (OCELOTS_SITONCHESTS) -// { -// MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler()); -// } MinecraftForge.EVENT_BUS.register(this); } - @EventHandler - public void modsLoaded(FMLPostInitializationEvent evt) - { - } - } diff --git a/src/main/java/cpw/mods/ironchest/IronChestAIOcelotSit.java b/src/main/java/cpw/mods/ironchest/IronChestAIOcelotSit.java deleted file mode 100644 index 51c2aa3..0000000 --- a/src/main/java/cpw/mods/ironchest/IronChestAIOcelotSit.java +++ /dev/null @@ -1,22 +0,0 @@ -package cpw.mods.ironchest; - -import net.minecraft.entity.ai.EntityAIOcelotSit; -import net.minecraft.entity.passive.EntityOcelot; -import net.minecraft.world.World; - -public class IronChestAIOcelotSit extends EntityAIOcelotSit { - public IronChestAIOcelotSit(EntityOcelot par1EntityOcelot, float par2) - { - super(par1EntityOcelot, par2); - } - -/* @Override - protected boolean func_151486_a(World world, int x, int y, int z) - { - if (world.getBlock(x, y, z) == IronChest.ironChestBlock) - { - return true; - } - return super.func_151486_a(world, x, y, z); - } -*/} diff --git a/src/main/java/cpw/mods/ironchest/IronChestType.java b/src/main/java/cpw/mods/ironchest/IronChestType.java index 0c7a7d3..a02c88d 100644 --- a/src/main/java/cpw/mods/ironchest/IronChestType.java +++ b/src/main/java/cpw/mods/ironchest/IronChestType.java @@ -1,41 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagByte; -import net.minecraft.util.IIcon; import net.minecraftforge.oredict.ShapedOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public enum IronChestType { - IRON(54, 9, true, "Iron Chest", "ironchest.png", 0, Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"), - GOLD(81, 9, true, "Gold Chest", "goldchest.png", 1, Arrays.asList("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"), - DIAMOND(108, 12, true, "Diamond Chest", "diamondchest.png", 2, Arrays.asList("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"), - COPPER(45, 9, false, "Copper Chest", "copperchest.png", 3, Arrays.asList("ingotCopper"), TileEntityCopperChest.class, "mmmmCmmmm"), - SILVER(72, 9, false, "Silver Chest", "silverchest.png", 4, Arrays.asList("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"), - CRYSTAL(108, 12, true, "Crystal Chest", "crystalchest.png", 5, Arrays.asList("blockGlass"), TileEntityCrystalChest.class, "GGGGPGGGG"), - OBSIDIAN(108, 12, false, "Obsidian Chest", "obsidianchest.png", 6, Arrays.asList("obsidian"), TileEntityObsidianChest.class, "mmmm2mmmm"), - DIRTCHEST9000(1, 1, false, "Dirt Chest 9000", "dirtchest.png",7,Arrays.asList("dirt"), TileEntityDirtChest.class,Item.getItemFromBlock(Blocks.dirt),"mmmmCmmmm"), + IRON(54, 9, true, "Iron Chest", "chest_iron.png", 0, Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"), + GOLD(81, 9, true, "Gold Chest", "chest_gold.png", 1, Arrays.asList("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"), + DIAMOND(108, 12, true, "Diamond Chest", "chest_diamond.png", 2, Arrays.asList("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"), + COPPER(45, 9, false, "Copper Chest", "chest_copper.png", 3, Arrays.asList("ingotCopper"), TileEntityCopperChest.class, "mmmmCmmmm"), + SILVER(72, 9, false, "Silver Chest", "chest_silver.png", 4, Arrays.asList("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"), + CRYSTAL(108, 12, true, "Crystal Chest", "chest_crystal.png", 5, Arrays.asList("blockGlass"), TileEntityCrystalChest.class, "GGGGPGGGG"), + OBSIDIAN(108, 12, false, "Obsidian Chest", "chest_obsidian.png", 6, Arrays.asList("obsidian"), TileEntityObsidianChest.class, "mmmm2mmmm"), + DIRTCHEST9000(1, 1, false, "Dirt Chest 9000", "chest_dirt.png", 7, Arrays.asList("dirt"), TileEntityDirtChest.class, Item.getItemFromBlock(Blocks.dirt), "mmmmCmmmm"), WOOD(0, 0, false, "", "", -1, Arrays.asList("plankWood"), null); int size; private int rowLength; @@ -104,10 +89,6 @@ public enum IronChestType { return null; } - public static void registerTranslations() - { - } - public static void registerBlocksAndRecipes(BlockIronChest blockResult) { ItemStack previous = new ItemStack(Blocks.chest); @@ -219,42 +200,11 @@ public enum IronChestType { return this == OBSIDIAN; } - @SideOnly(Side.CLIENT) - private IIcon[] icons; - - @SideOnly(Side.CLIENT) - public void makeIcons(IIconRegister par1IconRegister) - { - if (isValidForCreativeMode()) - { - icons = new IIcon[3]; - int i = 0; - for (String s : sideNames) - { - icons[i++] = par1IconRegister.registerIcon(String.format("ironchest:%s_%s",name().toLowerCase(),s)); - } - } - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side) - { - - return icons[sideMapping[side]]; - } - - private static String[] sideNames = { "top", "front", "side" }; - private static int[] sideMapping = { 0, 0, 2, 1, 2, 2, 2 }; - - public Slot makeSlot(IInventory chestInventory, int index, int x, int y) - { - return new ValidatingSlot(chestInventory, index, x, y, this); - } - public boolean acceptsStack(ItemStack itemstack) { return itemFilter == null || itemstack == null || itemstack.getItem() == itemFilter; } + public void adornItemDrop(ItemStack item) { if (this == DIRTCHEST9000) diff --git a/src/main/java/cpw/mods/ironchest/ItemChestChanger.java b/src/main/java/cpw/mods/ironchest/ItemChestChanger.java index 0677f08..c3e58b1 100644 --- a/src/main/java/cpw/mods/ironchest/ItemChestChanger.java +++ b/src/main/java/cpw/mods/ironchest/ItemChestChanger.java @@ -1,13 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import net.minecraft.client.renderer.texture.IIconRegister; @@ -24,7 +14,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemChestChanger extends Item { - private ChestChangerType type; public ItemChestChanger(ChestChangerType type) @@ -36,7 +25,6 @@ public class ItemChestChanger extends Item { setCreativeTab(CreativeTabs.tabMisc); } - @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister par1IconRegister) @@ -76,7 +64,7 @@ public class ItemChestChanger extends Item { ItemStack[] chestContents = ObfuscationReflectionHelper.getPrivateValue(TileEntityChest.class, tec, 0); System.arraycopy(chestContents, 0, newchest.chestContents, 0, Math.min(newSize, chestContents.length)); BlockIronChest block = IronChest.ironChestBlock; - block.dropContent(newSize, tec, world, tec.xCoord, tec.yCoord, tec.zCoord); + block.dropItems(newSize, tec, world, tec.xCoord, tec.yCoord, tec.zCoord); newchest.setFacing((byte) tec.getBlockMetadata()); newchest.sortTopStacks(); for (int i = 0; i < Math.min(newSize, chestContents.length); i++) @@ -87,8 +75,7 @@ public class ItemChestChanger extends Item { world.setBlock(X, Y, Z, Blocks.air, 0, 3); // Force the Chest TE to reset it's knowledge of neighbouring blocks tec.updateContainingBlockInfo(); - // Force the Chest TE to update any neighbours so they update next - // tick + // Force the Chest TE to update any neighbours so they update next tick tec.checkForAdjacentChests(); // And put in our block instead world.setBlock(X, Y, Z, block, newchest.getType().ordinal(), 3); diff --git a/src/main/java/cpw/mods/ironchest/ItemIronChest.java b/src/main/java/cpw/mods/ironchest/ItemIronChest.java index 0b3b8e2..7c74444 100644 --- a/src/main/java/cpw/mods/ironchest/ItemIronChest.java +++ b/src/main/java/cpw/mods/ironchest/ItemIronChest.java @@ -1,13 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import net.minecraft.block.Block; diff --git a/src/main/java/cpw/mods/ironchest/MappableItemStackWrapper.java b/src/main/java/cpw/mods/ironchest/MappableItemStackWrapper.java deleted file mode 100644 index 95a8a40..0000000 --- a/src/main/java/cpw/mods/ironchest/MappableItemStackWrapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package cpw.mods.ironchest; - -import net.minecraft.item.ItemStack; - -public class MappableItemStackWrapper { - private ItemStack wrap; - - public MappableItemStackWrapper(ItemStack toWrap) - { - wrap = toWrap; - } - - @Override - public boolean equals(Object obj) - { - if (!(obj instanceof MappableItemStackWrapper)) return false; - MappableItemStackWrapper isw = (MappableItemStackWrapper) obj; - if (wrap.getHasSubtypes()) - { - return isw.wrap.isItemEqual(wrap); - } - else - { - return isw.wrap == wrap; - } - } - - @Override - public int hashCode() - { - return System.identityHashCode(wrap); - } -} diff --git a/src/main/java/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java b/src/main/java/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java deleted file mode 100644 index 3e3283e..0000000 --- a/src/main/java/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -package cpw.mods.ironchest; - -import java.util.List; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import net.minecraft.entity.ai.EntityAIOcelotSit; -import net.minecraft.entity.ai.EntityAITasks; -import net.minecraft.entity.passive.EntityOcelot; -import net.minecraftforge.event.entity.living.LivingEvent; - -public class OcelotsSitOnChestsHandler { - @SubscribeEvent - public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt) - { - if (evt.entityLiving.ticksExisted < 5 && evt.entityLiving instanceof EntityOcelot) - { - EntityOcelot ocelot = (EntityOcelot) evt.entityLiving; - @SuppressWarnings("unchecked") - List tasks = ocelot.tasks.taskEntries; - - for (int i = 0; i < tasks.size(); i++) - { - EntityAITasks.EntityAITaskEntry task = tasks.get(i); - if (task.priority == 6 && (task.action instanceof EntityAIOcelotSit) && !(task.action instanceof IronChestAIOcelotSit)) - { - task.action = new IronChestAIOcelotSit(ocelot, 0.4F); - } - } - } - } -} diff --git a/src/main/java/cpw/mods/ironchest/PacketHandler.java b/src/main/java/cpw/mods/ironchest/PacketHandler.java index 8c8aa05..6cf4e71 100644 --- a/src/main/java/cpw/mods/ironchest/PacketHandler.java +++ b/src/main/java/cpw/mods/ironchest/PacketHandler.java @@ -1,22 +1,15 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; + import java.util.EnumMap; + import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.FMLEmbeddedChannel; import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec; @@ -28,7 +21,6 @@ import cpw.mods.fml.relauncher.SideOnly; /** * Handles the packet wrangling for IronChest * @author cpw - * */ public enum PacketHandler { INSTANCE; @@ -79,7 +71,7 @@ public enum PacketHandler { @Override protected void channelRead0(ChannelHandlerContext ctx, IronChestMessage msg) throws Exception { - World world = IronChest.proxy.getClientWorld(); + World world = FMLClientHandler.instance().getClient().theWorld; TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); if (te instanceof TileEntityIronChest) { diff --git a/src/main/java/cpw/mods/ironchest/TileEntityCopperChest.java b/src/main/java/cpw/mods/ironchest/TileEntityCopperChest.java index f8ececf..b5b72bc 100644 --- a/src/main/java/cpw/mods/ironchest/TileEntityCopperChest.java +++ b/src/main/java/cpw/mods/ironchest/TileEntityCopperChest.java @@ -1,19 +1,7 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; public class TileEntityCopperChest extends TileEntityIronChest { - public TileEntityCopperChest() - { - super(IronChestType.COPPER); - } - -} + public TileEntityCopperChest() { + super(IronChestType.COPPER); + } +} \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/TileEntityCrystalChest.java b/src/main/java/cpw/mods/ironchest/TileEntityCrystalChest.java index 24288ec..3ed64fa 100644 --- a/src/main/java/cpw/mods/ironchest/TileEntityCrystalChest.java +++ b/src/main/java/cpw/mods/ironchest/TileEntityCrystalChest.java @@ -1,18 +1,7 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; public class TileEntityCrystalChest extends TileEntityIronChest { - public TileEntityCrystalChest() - { - super(IronChestType.CRYSTAL); - } -} + public TileEntityCrystalChest() { + super(IronChestType.CRYSTAL); + } +} \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/TileEntityDiamondChest.java b/src/main/java/cpw/mods/ironchest/TileEntityDiamondChest.java index f1e8078..3a8411d 100644 --- a/src/main/java/cpw/mods/ironchest/TileEntityDiamondChest.java +++ b/src/main/java/cpw/mods/ironchest/TileEntityDiamondChest.java @@ -1,18 +1,7 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; public class TileEntityDiamondChest extends TileEntityIronChest { - public TileEntityDiamondChest() - { - super(IronChestType.DIAMOND); - } -} + public TileEntityDiamondChest() { + super(IronChestType.DIAMOND); + } +} \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/TileEntityDirtChest.java b/src/main/java/cpw/mods/ironchest/TileEntityDirtChest.java index a7608c0..fe6fc52 100644 --- a/src/main/java/cpw/mods/ironchest/TileEntityDirtChest.java +++ b/src/main/java/cpw/mods/ironchest/TileEntityDirtChest.java @@ -20,8 +20,9 @@ public class TileEntityDirtChest extends TileEntityIronChest { pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page5"))); dirtChest9000GuideBook.setTagInfo("pages", pages); } + public TileEntityDirtChest() { - super(IronChestType.DIRTCHEST9000); + super(IronChestType.DIRTCHEST9000); } @Override diff --git a/src/main/java/cpw/mods/ironchest/TileEntityGoldChest.java b/src/main/java/cpw/mods/ironchest/TileEntityGoldChest.java index fc531e2..2b2e4cb 100644 --- a/src/main/java/cpw/mods/ironchest/TileEntityGoldChest.java +++ b/src/main/java/cpw/mods/ironchest/TileEntityGoldChest.java @@ -1,19 +1,7 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; public class TileEntityGoldChest extends TileEntityIronChest { - - public TileEntityGoldChest() - { - super(IronChestType.GOLD); - } -} + public TileEntityGoldChest() { + super(IronChestType.GOLD); + } +} \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/TileEntityIronChest.java b/src/main/java/cpw/mods/ironchest/TileEntityIronChest.java index be2481b..a27a942 100644 --- a/src/main/java/cpw/mods/ironchest/TileEntityIronChest.java +++ b/src/main/java/cpw/mods/ironchest/TileEntityIronChest.java @@ -1,13 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import java.util.Arrays; @@ -383,11 +373,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory { public TileEntityIronChest applyUpgradeItem(ItemChestChanger itemChestChanger) { - if (numUsingPlayers > 0) - { - return null; - } - if (!itemChestChanger.getType().canUpgrade(this.getType())) + if (numUsingPlayers > 0 || !itemChestChanger.getType().canUpgrade(this.getType())) { return null; } @@ -395,7 +381,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory { int newSize = newEntity.chestContents.length; System.arraycopy(chestContents, 0, newEntity.chestContents, 0, Math.min(newSize, chestContents.length)); BlockIronChest block = IronChest.ironChestBlock; - block.dropContent(newSize, this, this.worldObj, this.xCoord, this.yCoord, this.zCoord); + block.dropItems(newSize, this, this.worldObj, this.xCoord, this.yCoord, this.zCoord); newEntity.setFacing(facing); newEntity.sortTopStacks(); newEntity.ticksSinceSync = -1; @@ -498,11 +484,6 @@ public class TileEntityIronChest extends TileEntity implements IInventory { } } - public void setMaxStackSize(int size) - { - - } - @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { @@ -527,6 +508,5 @@ public class TileEntityIronChest extends TileEntity implements IInventory { public void removeAdornments() { - } } diff --git a/src/main/java/cpw/mods/ironchest/TileEntityObsidianChest.java b/src/main/java/cpw/mods/ironchest/TileEntityObsidianChest.java index 5f03eb9..fed9039 100644 --- a/src/main/java/cpw/mods/ironchest/TileEntityObsidianChest.java +++ b/src/main/java/cpw/mods/ironchest/TileEntityObsidianChest.java @@ -1,9 +1,7 @@ package cpw.mods.ironchest; public class TileEntityObsidianChest extends TileEntityIronChest { - - public TileEntityObsidianChest() - { - super(IronChestType.OBSIDIAN); - } -} + public TileEntityObsidianChest() { + super(IronChestType.OBSIDIAN); + } +} \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/TileEntitySilverChest.java b/src/main/java/cpw/mods/ironchest/TileEntitySilverChest.java index 439d266..5fd4e13 100644 --- a/src/main/java/cpw/mods/ironchest/TileEntitySilverChest.java +++ b/src/main/java/cpw/mods/ironchest/TileEntitySilverChest.java @@ -1,18 +1,7 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; public class TileEntitySilverChest extends TileEntityIronChest { - public TileEntitySilverChest() - { - super(IronChestType.SILVER); - } -} + public TileEntitySilverChest() { + super(IronChestType.SILVER); + } +} \ No newline at end of file diff --git a/src/main/java/cpw/mods/ironchest/ValidatingSlot.java b/src/main/java/cpw/mods/ironchest/ValidatingSlot.java deleted file mode 100644 index f0348c9..0000000 --- a/src/main/java/cpw/mods/ironchest/ValidatingSlot.java +++ /dev/null @@ -1,21 +0,0 @@ -package cpw.mods.ironchest; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ValidatingSlot extends Slot { - private IronChestType type; - - public ValidatingSlot(IInventory par1iInventory, int par2, int par3, int par4, IronChestType type) - { - super(par1iInventory, par2, par3, par4); - this.type = type; - } - - @Override - public boolean isItemValid(ItemStack par1ItemStack) - { - return type.acceptsStack(par1ItemStack); - } -} diff --git a/src/main/java/cpw/mods/ironchest/Version.java b/src/main/java/cpw/mods/ironchest/Version.java index 791e78d..b93fd34 100644 --- a/src/main/java/cpw/mods/ironchest/Version.java +++ b/src/main/java/cpw/mods/ironchest/Version.java @@ -1,20 +1,9 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. 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 - * - * Contributors: cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest; import java.util.Properties; public class Version { - private static String major; - private static String minor; - private static String rev; - private static String build; - @SuppressWarnings("unused") - private static String mcversion; + private static String major, minor, rev, build, mcversion; static void init(Properties properties) { diff --git a/src/main/java/cpw/mods/ironchest/client/ClientProxy.java b/src/main/java/cpw/mods/ironchest/client/ClientProxy.java deleted file mode 100644 index 1885523..0000000 --- a/src/main/java/cpw/mods/ironchest/client/ClientProxy.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package cpw.mods.ironchest.client; - -import net.minecraft.client.renderer.tileentity.TileEntityRendererChestHelper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.ironchest.CommonProxy; -import cpw.mods.ironchest.IronChestType; -import cpw.mods.ironchest.TileEntityIronChest; - -public class ClientProxy extends CommonProxy { - @Override - public void registerRenderInformation() - { - TileEntityRendererChestHelper.instance = new IronChestRenderHelper(); - } - - @Override - public void registerTileEntitySpecialRenderer(IronChestType typ) - { - ClientRegistry.bindTileEntitySpecialRenderer(typ.clazz, new TileEntityIronChestRenderer()); - } - - @Override - public World getClientWorld() - { - return FMLClientHandler.instance().getClient().theWorld; - } - - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityIronChest) - { - return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te); - } - else - { - return null; - } - } -} diff --git a/src/main/java/cpw/mods/ironchest/client/GUIChest.java b/src/main/java/cpw/mods/ironchest/client/GUIChest.java index 345791b..46c0d21 100644 --- a/src/main/java/cpw/mods/ironchest/client/GUIChest.java +++ b/src/main/java/cpw/mods/ironchest/client/GUIChest.java @@ -1,13 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest.client; import net.minecraft.client.gui.inventory.GuiContainer; @@ -23,15 +13,15 @@ import cpw.mods.ironchest.TileEntityIronChest; public class GUIChest extends GuiContainer { public enum ResourceList { - IRON(new ResourceLocation("ironchest", "textures/gui/ironcontainer.png")), - COPPER(new ResourceLocation("ironchest", "textures/gui/coppercontainer.png")), - SILVER(new ResourceLocation("ironchest", "textures/gui/silvercontainer.png")), - GOLD(new ResourceLocation("ironchest", "textures/gui/goldcontainer.png")), - DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamondcontainer.png")), - DIRT(new ResourceLocation("ironchest", "textures/gui/dirtcontainer.png")); + IRON(new ResourceLocation("ironchest", "textures/gui/gui_chest_iron.png")), + COPPER(new ResourceLocation("ironchest", "textures/gui/gui_chest_copper.png")), + SILVER(new ResourceLocation("ironchest", "textures/gui/gui_chest_silver.png")), + GOLD(new ResourceLocation("ironchest", "textures/gui/gui_chest_gold.png")), + DIAMOND(new ResourceLocation("ironchest", "textures/gui/gui_chest_diamond.png")), + DIRT(new ResourceLocation("ironchest", "textures/gui/gui_chest_dirt.png")); public final ResourceLocation location; private ResourceList(ResourceLocation loc) { - this.location = loc; + location = loc; } } public enum GUI { @@ -89,8 +79,7 @@ public class GUIChest extends GuiContainer { protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - // new "bind tex" - this.mc.getTextureManager().bindTexture(type.guiResourceList.location); + mc.getTextureManager().bindTexture(type.guiResourceList.location); int x = (width - xSize) / 2; int y = (height - ySize) / 2; drawTexturedModalRect(x, y, 0, 0, xSize, ySize); diff --git a/src/main/java/cpw/mods/ironchest/client/IronChestRenderHelper.java b/src/main/java/cpw/mods/ironchest/client/IronChestRenderHelper.java index 36b5534..5780cda 100644 --- a/src/main/java/cpw/mods/ironchest/client/IronChestRenderHelper.java +++ b/src/main/java/cpw/mods/ironchest/client/IronChestRenderHelper.java @@ -1,13 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest.client; import java.util.Map; diff --git a/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java b/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java index 3749e26..bd5adf8 100644 --- a/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java +++ b/src/main/java/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java @@ -1,13 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * 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 - * - * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ package cpw.mods.ironchest.client; import static org.lwjgl.opengl.GL11.glColor4f; @@ -18,11 +8,11 @@ import static org.lwjgl.opengl.GL11.glPushMatrix; import static org.lwjgl.opengl.GL11.glRotatef; import static org.lwjgl.opengl.GL11.glScalef; import static org.lwjgl.opengl.GL11.glTranslatef; -import java.util.HashMap; + import java.util.Map; import java.util.Random; + import net.minecraft.client.model.ModelChest; -import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -30,30 +20,24 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import com.google.common.primitives.SignedBytes; + import cpw.mods.ironchest.IronChestType; -import cpw.mods.ironchest.MappableItemStackWrapper; import cpw.mods.ironchest.TileEntityIronChest; public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { - @SuppressWarnings("unused") - private static Map renderList = new HashMap(); - private static Map locations; static { Builder builder = ImmutableMap.builder(); - for (IronChestType typ : IronChestType.values()) { - builder.put(typ, new ResourceLocation("ironchest","textures/model/"+typ.getModelTexture())); - } + for (IronChestType typ : IronChestType.values()) + builder.put(typ, new ResourceLocation("ironchest", "textures/models/" + typ.getModelTexture())); locations = builder.build(); } + private Random random; - - @SuppressWarnings("unused") - private RenderBlocks renderBlocks; - private RenderItem itemRenderer; private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F }, @@ -63,7 +47,6 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { { model = new ModelChest(); random = new Random(); - renderBlocks = new RenderBlocks(); itemRenderer = new RenderItem() { @Override public byte getMiniBlockCount(ItemStack stack, byte original) { diff --git a/src/main/java/cpw/mods/ironchest/net/UniversalProxy.java b/src/main/java/cpw/mods/ironchest/net/UniversalProxy.java new file mode 100644 index 0000000..e66a559 --- /dev/null +++ b/src/main/java/cpw/mods/ironchest/net/UniversalProxy.java @@ -0,0 +1,43 @@ +package cpw.mods.ironchest.net; + +import net.minecraft.client.renderer.tileentity.TileEntityRendererChestHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.ironchest.ContainerIronChest; +import cpw.mods.ironchest.IronChestType; +import cpw.mods.ironchest.TileEntityIronChest; +import cpw.mods.ironchest.client.GUIChest; +import cpw.mods.ironchest.client.IronChestRenderHelper; +import cpw.mods.ironchest.client.TileEntityIronChestRenderer; + +public class UniversalProxy implements IGuiHandler { + public void registerRenderInformation() { + TileEntityRendererChestHelper.instance = new IronChestRenderHelper(); + } + + public void registerTileEntitySpecialRenderer(IronChestType typ) { + ClientRegistry.bindTileEntitySpecialRenderer(typ.clazz, new TileEntityIronChestRenderer()); + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + TileEntity te = world.getTileEntity(x, y, z); + if (te != null && te instanceof TileEntityIronChest) { + TileEntityIronChest chest = (TileEntityIronChest) te; + return new ContainerIronChest(player.inventory, chest, chest.getType(), 0, 0); + } else + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + TileEntity te = world.getTileEntity(x, y, z); + if (te != null && te instanceof TileEntityIronChest) + return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te); + else + return null; + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ironchest/textures/blocks/copper.png b/src/main/resources/assets/ironchest/textures/blocks/copper.png new file mode 100644 index 0000000..d98191c Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/blocks/copper.png differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/copper_front.png b/src/main/resources/assets/ironchest/textures/blocks/copper_front.png deleted file mode 100644 index 8ca415c..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/copper_front.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/copper_side.png b/src/main/resources/assets/ironchest/textures/blocks/copper_side.png deleted file mode 100644 index 864e950..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/copper_side.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/copper_top.png b/src/main/resources/assets/ironchest/textures/blocks/copper_top.png deleted file mode 100644 index 09a8488..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/copper_top.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/crystal.png b/src/main/resources/assets/ironchest/textures/blocks/crystal.png new file mode 100644 index 0000000..1b1a72b Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/blocks/crystal.png differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/crystal_front.png b/src/main/resources/assets/ironchest/textures/blocks/crystal_front.png deleted file mode 100644 index c517953..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/crystal_front.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/crystal_side.png b/src/main/resources/assets/ironchest/textures/blocks/crystal_side.png deleted file mode 100644 index 842cc18..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/crystal_side.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/crystal_top.png b/src/main/resources/assets/ironchest/textures/blocks/crystal_top.png deleted file mode 100644 index ce8ef63..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/crystal_top.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/diamond.png b/src/main/resources/assets/ironchest/textures/blocks/diamond.png new file mode 100644 index 0000000..e87ff6a Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/blocks/diamond.png differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/diamond_front.png b/src/main/resources/assets/ironchest/textures/blocks/diamond_front.png deleted file mode 100644 index d5e6373..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/diamond_front.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/diamond_side.png b/src/main/resources/assets/ironchest/textures/blocks/diamond_side.png deleted file mode 100644 index 3c69947..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/diamond_side.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/diamond_top.png b/src/main/resources/assets/ironchest/textures/blocks/diamond_top.png deleted file mode 100644 index 08c3bb5..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/diamond_top.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000.png b/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000.png new file mode 100644 index 0000000..8f77d16 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000.png differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_front.png b/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_front.png deleted file mode 100644 index 4e1e1fd..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_front.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_side.png b/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_side.png deleted file mode 100644 index ebda19f..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_side.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_top.png b/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_top.png deleted file mode 100644 index a92c5f1..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/dirtchest9000_top.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/gold.png b/src/main/resources/assets/ironchest/textures/blocks/gold.png new file mode 100644 index 0000000..c557c87 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/blocks/gold.png differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/gold_front.png b/src/main/resources/assets/ironchest/textures/blocks/gold_front.png deleted file mode 100644 index 56f1d4d..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/gold_front.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/gold_side.png b/src/main/resources/assets/ironchest/textures/blocks/gold_side.png deleted file mode 100644 index f06fb4f..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/gold_side.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/gold_top.png b/src/main/resources/assets/ironchest/textures/blocks/gold_top.png deleted file mode 100644 index a29e9f3..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/gold_top.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/iron.png b/src/main/resources/assets/ironchest/textures/blocks/iron.png new file mode 100644 index 0000000..12ad0af Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/blocks/iron.png differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/iron_front.png b/src/main/resources/assets/ironchest/textures/blocks/iron_front.png deleted file mode 100644 index a3db415..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/iron_front.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/iron_side.png b/src/main/resources/assets/ironchest/textures/blocks/iron_side.png deleted file mode 100644 index 1486949..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/iron_side.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/iron_top.png b/src/main/resources/assets/ironchest/textures/blocks/iron_top.png deleted file mode 100644 index 30efea4..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/iron_top.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/obsidian.png b/src/main/resources/assets/ironchest/textures/blocks/obsidian.png new file mode 100644 index 0000000..ffee510 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/blocks/obsidian.png differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/obsidian_front.png b/src/main/resources/assets/ironchest/textures/blocks/obsidian_front.png deleted file mode 100644 index ed1ef0d..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/obsidian_front.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/obsidian_side.png b/src/main/resources/assets/ironchest/textures/blocks/obsidian_side.png deleted file mode 100644 index dc8d227..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/obsidian_side.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/obsidian_top.png b/src/main/resources/assets/ironchest/textures/blocks/obsidian_top.png deleted file mode 100644 index 4f531cc..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/obsidian_top.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/silver.png b/src/main/resources/assets/ironchest/textures/blocks/silver.png new file mode 100644 index 0000000..b8cfa6c Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/blocks/silver.png differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/silver_front.png b/src/main/resources/assets/ironchest/textures/blocks/silver_front.png deleted file mode 100644 index 3a8a37e..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/silver_front.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/silver_side.png b/src/main/resources/assets/ironchest/textures/blocks/silver_side.png deleted file mode 100644 index d4df077..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/silver_side.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/blocks/silver_top.png b/src/main/resources/assets/ironchest/textures/blocks/silver_top.png deleted file mode 100644 index 9439036..0000000 Binary files a/src/main/resources/assets/ironchest/textures/blocks/silver_top.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/gui/coppercontainer.png b/src/main/resources/assets/ironchest/textures/gui/coppercontainer.png deleted file mode 100644 index 2fdb824..0000000 Binary files a/src/main/resources/assets/ironchest/textures/gui/coppercontainer.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/gui/diamondcontainer.png b/src/main/resources/assets/ironchest/textures/gui/diamondcontainer.png deleted file mode 100644 index b53f472..0000000 Binary files a/src/main/resources/assets/ironchest/textures/gui/diamondcontainer.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/gui/dirtcontainer.png b/src/main/resources/assets/ironchest/textures/gui/dirtcontainer.png deleted file mode 100644 index 44667e1..0000000 Binary files a/src/main/resources/assets/ironchest/textures/gui/dirtcontainer.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/gui/goldcontainer.png b/src/main/resources/assets/ironchest/textures/gui/goldcontainer.png deleted file mode 100644 index 27f506f..0000000 Binary files a/src/main/resources/assets/ironchest/textures/gui/goldcontainer.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/gui/gui_chest_copper.png b/src/main/resources/assets/ironchest/textures/gui/gui_chest_copper.png new file mode 100644 index 0000000..4d30fe1 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/gui/gui_chest_copper.png differ diff --git a/src/main/resources/assets/ironchest/textures/gui/gui_chest_diamond.png b/src/main/resources/assets/ironchest/textures/gui/gui_chest_diamond.png new file mode 100644 index 0000000..fdb8b3e Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/gui/gui_chest_diamond.png differ diff --git a/src/main/resources/assets/ironchest/textures/gui/gui_chest_dirt.png b/src/main/resources/assets/ironchest/textures/gui/gui_chest_dirt.png new file mode 100644 index 0000000..265026b Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/gui/gui_chest_dirt.png differ diff --git a/src/main/resources/assets/ironchest/textures/gui/gui_chest_gold.png b/src/main/resources/assets/ironchest/textures/gui/gui_chest_gold.png new file mode 100644 index 0000000..3e7e469 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/gui/gui_chest_gold.png differ diff --git a/src/main/resources/assets/ironchest/textures/gui/gui_chest_iron.png b/src/main/resources/assets/ironchest/textures/gui/gui_chest_iron.png new file mode 100644 index 0000000..31ec2f1 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/gui/gui_chest_iron.png differ diff --git a/src/main/resources/assets/ironchest/textures/gui/gui_chest_silver.png b/src/main/resources/assets/ironchest/textures/gui/gui_chest_silver.png new file mode 100644 index 0000000..8b1d8c6 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/gui/gui_chest_silver.png differ diff --git a/src/main/resources/assets/ironchest/textures/gui/ironcontainer.png b/src/main/resources/assets/ironchest/textures/gui/ironcontainer.png deleted file mode 100644 index 1c48eed..0000000 Binary files a/src/main/resources/assets/ironchest/textures/gui/ironcontainer.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/gui/silvercontainer.png b/src/main/resources/assets/ironchest/textures/gui/silvercontainer.png deleted file mode 100644 index 65179f2..0000000 Binary files a/src/main/resources/assets/ironchest/textures/gui/silvercontainer.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/items/copperIronUpgrade.png b/src/main/resources/assets/ironchest/textures/items/copperIronUpgrade.png index 7bb2159..b5be2e3 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/copperIronUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/copperIronUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/items/copperSilverUpgrade.png b/src/main/resources/assets/ironchest/textures/items/copperSilverUpgrade.png index de87597..fb48636 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/copperSilverUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/copperSilverUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/items/diamondCrystalUpgrade.png b/src/main/resources/assets/ironchest/textures/items/diamondCrystalUpgrade.png index 68caa0c..d5bc6b3 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/diamondCrystalUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/diamondCrystalUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/items/diamondObsidianUpgrade.png b/src/main/resources/assets/ironchest/textures/items/diamondObsidianUpgrade.png index dd1a36d..9ad5430 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/diamondObsidianUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/diamondObsidianUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/items/goldDiamondUpgrade.png b/src/main/resources/assets/ironchest/textures/items/goldDiamondUpgrade.png index 028e2d8..57fb236 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/goldDiamondUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/goldDiamondUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/items/ironGoldUpgrade.png b/src/main/resources/assets/ironchest/textures/items/ironGoldUpgrade.png index 65cf6ae..1f64db6 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/ironGoldUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/ironGoldUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/items/silverGoldUpgrade.png b/src/main/resources/assets/ironchest/textures/items/silverGoldUpgrade.png index d3cad2e..d22f6b8 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/silverGoldUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/silverGoldUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/items/woodCopperUpgrade.png b/src/main/resources/assets/ironchest/textures/items/woodCopperUpgrade.png index 4273a54..cbbd9fa 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/woodCopperUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/woodCopperUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/items/woodIronUpgrade.png b/src/main/resources/assets/ironchest/textures/items/woodIronUpgrade.png index e6e62bb..6f6243f 100644 Binary files a/src/main/resources/assets/ironchest/textures/items/woodIronUpgrade.png and b/src/main/resources/assets/ironchest/textures/items/woodIronUpgrade.png differ diff --git a/src/main/resources/assets/ironchest/textures/model/copperchest.png b/src/main/resources/assets/ironchest/textures/model/copperchest.png deleted file mode 100644 index a008864..0000000 Binary files a/src/main/resources/assets/ironchest/textures/model/copperchest.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/model/crystalchest.png b/src/main/resources/assets/ironchest/textures/model/crystalchest.png deleted file mode 100644 index a455ce8..0000000 Binary files a/src/main/resources/assets/ironchest/textures/model/crystalchest.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/model/diamondchest.png b/src/main/resources/assets/ironchest/textures/model/diamondchest.png deleted file mode 100644 index 64020b5..0000000 Binary files a/src/main/resources/assets/ironchest/textures/model/diamondchest.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/model/dirtchest.png b/src/main/resources/assets/ironchest/textures/model/dirtchest.png deleted file mode 100644 index 168e179..0000000 Binary files a/src/main/resources/assets/ironchest/textures/model/dirtchest.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/model/goldchest.png b/src/main/resources/assets/ironchest/textures/model/goldchest.png deleted file mode 100644 index 7f18468..0000000 Binary files a/src/main/resources/assets/ironchest/textures/model/goldchest.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/model/ironchest.png b/src/main/resources/assets/ironchest/textures/model/ironchest.png deleted file mode 100644 index df883ff..0000000 Binary files a/src/main/resources/assets/ironchest/textures/model/ironchest.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/model/obsidianchest.png b/src/main/resources/assets/ironchest/textures/model/obsidianchest.png deleted file mode 100644 index 4f0657a..0000000 Binary files a/src/main/resources/assets/ironchest/textures/model/obsidianchest.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/model/silverchest.png b/src/main/resources/assets/ironchest/textures/model/silverchest.png deleted file mode 100644 index 780becd..0000000 Binary files a/src/main/resources/assets/ironchest/textures/model/silverchest.png and /dev/null differ diff --git a/src/main/resources/assets/ironchest/textures/models/chest_copper.png b/src/main/resources/assets/ironchest/textures/models/chest_copper.png new file mode 100644 index 0000000..c12166a Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/models/chest_copper.png differ diff --git a/src/main/resources/assets/ironchest/textures/models/chest_crystal.png b/src/main/resources/assets/ironchest/textures/models/chest_crystal.png new file mode 100644 index 0000000..fb76f19 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/models/chest_crystal.png differ diff --git a/src/main/resources/assets/ironchest/textures/models/chest_diamond.png b/src/main/resources/assets/ironchest/textures/models/chest_diamond.png new file mode 100644 index 0000000..a4a2349 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/models/chest_diamond.png differ diff --git a/src/main/resources/assets/ironchest/textures/models/chest_dirt.png b/src/main/resources/assets/ironchest/textures/models/chest_dirt.png new file mode 100644 index 0000000..2cf0a90 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/models/chest_dirt.png differ diff --git a/src/main/resources/assets/ironchest/textures/models/chest_gold.png b/src/main/resources/assets/ironchest/textures/models/chest_gold.png new file mode 100644 index 0000000..62447fa Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/models/chest_gold.png differ diff --git a/src/main/resources/assets/ironchest/textures/models/chest_iron.png b/src/main/resources/assets/ironchest/textures/models/chest_iron.png new file mode 100644 index 0000000..c9d3412 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/models/chest_iron.png differ diff --git a/src/main/resources/assets/ironchest/textures/models/chest_obsidian.png b/src/main/resources/assets/ironchest/textures/models/chest_obsidian.png new file mode 100644 index 0000000..6ef6ec0 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/models/chest_obsidian.png differ diff --git a/src/main/resources/assets/ironchest/textures/models/chest_silver.png b/src/main/resources/assets/ironchest/textures/models/chest_silver.png new file mode 100644 index 0000000..6434ad8 Binary files /dev/null and b/src/main/resources/assets/ironchest/textures/models/chest_silver.png differ