Update for 1.7.2. Missing ocelot behaviour, pending an AT
|
|
@ -1,2 +1,6 @@
|
||||||
forge-client
|
build/
|
||||||
.metadata
|
.classpath
|
||||||
|
.project
|
||||||
|
.gradle/
|
||||||
|
eclipse/
|
||||||
|
bin/
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="common"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/Forge"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
*.zip
|
|
||||||
/*.jpage
|
|
||||||
bin/
|
|
||||||
/target
|
|
||||||
/build.properties
|
|
||||||
/build
|
|
||||||
/ironchestversion.properties
|
|
||||||
/version.properties
|
|
||||||
/tmpbukkit
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>IronChests2</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
<linkedResources>
|
|
||||||
<link>
|
|
||||||
<name>common/assets</name>
|
|
||||||
<type>2</type>
|
|
||||||
<locationURI>PROJECT_LOC/resources/assets</locationURI>
|
|
||||||
</link>
|
|
||||||
<link>
|
|
||||||
<name>common/mcmod.info</name>
|
|
||||||
<type>1</type>
|
|
||||||
<location>/home/cpw/projects/ironchests/IronChests2/mcmod.info</location>
|
|
||||||
</link>
|
|
||||||
<link>
|
|
||||||
<name>common/version.properties</name>
|
|
||||||
<type>1</type>
|
|
||||||
<location>/home/cpw/projects/ironchests/IronChests2/version.properties</location>
|
|
||||||
</link>
|
|
||||||
</linkedResources>
|
|
||||||
</projectDescription>
|
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
|
||||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
||||||
|
|
@ -1,131 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!-- ======================================================================
|
|
||||||
|
|
||||||
|
|
||||||
IronChest
|
|
||||||
Bigger chests
|
|
||||||
|
|
||||||
cpw
|
|
||||||
====================================================================== -->
|
|
||||||
<project name="IronChest" default="build">
|
|
||||||
<description>Iron Chest</description>
|
|
||||||
<target name="writeversion" depends="buildenvsetup">
|
|
||||||
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
|
|
||||||
<arg value="${basedir}/getversion.py" />
|
|
||||||
<arg value="${mcp.home}" />
|
|
||||||
</exec>
|
|
||||||
<propertyfile file="version.properties">
|
|
||||||
<entry key="IronChest.build.number" type="int" value="${version.build}"/>
|
|
||||||
<entry key="IronChest.version" type="string" value="${version}"/>
|
|
||||||
</propertyfile>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="buildenvsetup">
|
|
||||||
<tstamp>
|
|
||||||
<format pattern="yyMMddHHmmss" property="timestamp" />
|
|
||||||
</tstamp>
|
|
||||||
<property environment="env" />
|
|
||||||
<property file="build.properties" />
|
|
||||||
<property name="modname" value="ironchest" />
|
|
||||||
<condition property="mcp.home" value="${env.WORKSPACE}/mcpworkspace/forge/mcp" else="${default.mcp.home}">
|
|
||||||
<isset property="env.WORKSPACE" />
|
|
||||||
</condition>
|
|
||||||
<condition property="python.exe" value="${mcp.home}/runtime/bin/python/python_mcp" else="python">
|
|
||||||
<os family="Windows" />
|
|
||||||
</condition>
|
|
||||||
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
|
|
||||||
<property name="mcp.obfoutput.classes" location="${mcp.obfoutput}/minecraft" />
|
|
||||||
<property name="mcp.srcdir" location="${mcp.home}/src" />
|
|
||||||
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
|
|
||||||
<property name="common.src.dir" location="${basedir}/common" />
|
|
||||||
<property name="deploy.dir" location="${user.home}/.minecraft/mods" />
|
|
||||||
<property name="resource.dir" location="${basedir}/resources" />
|
|
||||||
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
|
|
||||||
<isset property="env.BUILD_NUMBER" />
|
|
||||||
</condition>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="init" depends="buildenvsetup">
|
|
||||||
<antcall target="writeversion" />
|
|
||||||
<property file="version.properties" />
|
|
||||||
<property name="build.number" value="${IronChest.build.major.number}.${IronChest.build.minor.number}.${IronChest.build.revision.number}" />
|
|
||||||
<property name="version.minecraft" value="${IronChest.build.mcversion}" />
|
|
||||||
<property name="version.major" value="${IronChest.build.major.number}" />
|
|
||||||
<property name="version.minor" value="${IronChest.build.minor.number}" />
|
|
||||||
<property name="version.rev" value="${IronChest.build.revision.number}" />
|
|
||||||
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
|
|
||||||
<antcall target="writeversion" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean" depends="buildenvsetup">
|
|
||||||
<antcall target="clean-source"/>
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/updatemd5.py" />
|
|
||||||
<arg value="-f" />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="recompile" depends="init">
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
|
||||||
<arg value="${mcp.home}/runtime/recompile.py" />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="reobfuscate" depends="init">
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/reobfuscate.py" />
|
|
||||||
<arg value="--srgnames"/>
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="merge" depends="init">
|
|
||||||
<copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
|
|
||||||
<fileset dir="${common.src.dir}" includes="**/*.java" />
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build-universal" depends="init,clean,merge,recompile,reobfuscate">
|
|
||||||
<antcall target="writeversion" />
|
|
||||||
<antcall target="extract-built-jar"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="extract-built-jar">
|
|
||||||
<property name="jarname" value="${modname}-universal-${version.minecraft}-${version}" />
|
|
||||||
<mkdir dir="${basedir}/target" />
|
|
||||||
<jar destfile="${basedir}/target/${jarname}.zip">
|
|
||||||
<fileset dir="${mcp.obfoutput.classes}" includes="**/*.class" />
|
|
||||||
<zipfileset dir="${basedir}" includes="version.properties"/>
|
|
||||||
<mappedresources>
|
|
||||||
<concat>
|
|
||||||
<fileset dir="${basedir}" includes="mcmod.info" />
|
|
||||||
<filterchain>
|
|
||||||
<replacetokens>
|
|
||||||
<token key="VERSION" value="${version}" />
|
|
||||||
</replacetokens>
|
|
||||||
</filterchain>
|
|
||||||
</concat>
|
|
||||||
<mergemapper to="mcmod.info" />
|
|
||||||
</mappedresources>
|
|
||||||
<fileset dir="${resource.dir}" erroronmissingdir="false">
|
|
||||||
<include name="**/*.png" />
|
|
||||||
<include name="**/*.mcmeta" />
|
|
||||||
<include name="**/*.lang" />
|
|
||||||
</fileset>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build" depends="build-universal" />
|
|
||||||
|
|
||||||
<target name="buildandclean" depends="build">
|
|
||||||
<antcall target="clean" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- antcall target to merge source to a side -->
|
|
||||||
<target name="clean-source">
|
|
||||||
<delete verbose="true">
|
|
||||||
<fileset dir="${client.mcp.srcdir}">
|
|
||||||
<present present="both" targetdir="${common.src.dir}" />
|
|
||||||
</fileset>
|
|
||||||
</delete>
|
|
||||||
</target>
|
|
||||||
</project>
|
|
||||||
|
|
@ -1,96 +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 java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import net.minecraft.network.INetworkManager;
|
|
||||||
import net.minecraft.network.packet.Packet;
|
|
||||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
|
||||||
import com.google.common.io.ByteStreams;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.IPacketHandler;
|
|
||||||
import cpw.mods.fml.common.network.Player;
|
|
||||||
|
|
||||||
public class PacketHandler implements IPacketHandler {
|
|
||||||
@Override
|
|
||||||
public void onPacketData(INetworkManager network, Packet250CustomPayload packet, Player player)
|
|
||||||
{
|
|
||||||
ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
|
|
||||||
int x = dat.readInt();
|
|
||||||
int y = dat.readInt();
|
|
||||||
int z = dat.readInt();
|
|
||||||
int typDat = dat.readByte();
|
|
||||||
byte typ = (byte)(typDat & 0xf);
|
|
||||||
byte facing = (byte)((typDat >> 4) & 0xf);
|
|
||||||
boolean hasStacks = dat.readByte() != 0;
|
|
||||||
int[] items = new int[0];
|
|
||||||
if (hasStacks)
|
|
||||||
{
|
|
||||||
items = new int[24];
|
|
||||||
for (int i = 0; i < items.length; i++)
|
|
||||||
{
|
|
||||||
items[i] = dat.readInt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
World world = IronChest.proxy.getClientWorld();
|
|
||||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
|
||||||
if (te instanceof TileEntityIronChest)
|
|
||||||
{
|
|
||||||
TileEntityIronChest icte = (TileEntityIronChest) te;
|
|
||||||
icte.setFacing(facing);
|
|
||||||
icte.handlePacketData(typ, items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Packet getPacket(TileEntityIronChest tileEntityIronChest)
|
|
||||||
{
|
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
|
|
||||||
DataOutputStream dos = new DataOutputStream(bos);
|
|
||||||
int x = tileEntityIronChest.xCoord;
|
|
||||||
int y = tileEntityIronChest.yCoord;
|
|
||||||
int z = tileEntityIronChest.zCoord;
|
|
||||||
int typ = (tileEntityIronChest.getType().ordinal() | (tileEntityIronChest.getFacing() << 4)) & 0xFF;
|
|
||||||
int[] items = tileEntityIronChest.buildIntDataList();
|
|
||||||
boolean hasStacks = (items != null);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dos.writeInt(x);
|
|
||||||
dos.writeInt(y);
|
|
||||||
dos.writeInt(z);
|
|
||||||
dos.writeByte(typ);
|
|
||||||
dos.writeByte(hasStacks ? 1 : 0);
|
|
||||||
if (hasStacks)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 24; i++)
|
|
||||||
{
|
|
||||||
dos.writeInt(items[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
// UNPOSSIBLE?
|
|
||||||
}
|
|
||||||
Packet250CustomPayload pkt = new Packet250CustomPayload();
|
|
||||||
pkt.channel = "IronChest";
|
|
||||||
pkt.data = bos.toByteArray();
|
|
||||||
pkt.length = bos.size();
|
|
||||||
pkt.isChunkDataPacket = true;
|
|
||||||
return pkt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import commands
|
|
||||||
import fnmatch
|
|
||||||
import re
|
|
||||||
import subprocess, shlex
|
|
||||||
|
|
||||||
mcp_home = sys.argv[1]
|
|
||||||
mcp_dir = os.path.abspath(mcp_home)
|
|
||||||
|
|
||||||
print(mcp_dir)
|
|
||||||
sys.path.append(mcp_dir)
|
|
||||||
|
|
||||||
from runtime.commands import Commands
|
|
||||||
Commands._version_config = os.path.join(mcp_dir,Commands._version_config)
|
|
||||||
|
|
||||||
def cmdsplit(args):
|
|
||||||
if os.sep == '\\':
|
|
||||||
args = args.replace('\\', '\\\\')
|
|
||||||
return shlex.split(args)
|
|
||||||
|
|
||||||
def cleanDirs(path):
|
|
||||||
if not os.path.isdir(path):
|
|
||||||
return
|
|
||||||
|
|
||||||
files = os.listdir(path)
|
|
||||||
if len(files):
|
|
||||||
for f in files:
|
|
||||||
fullpath = os.path.join(path, f)
|
|
||||||
if os.path.isdir(fullpath):
|
|
||||||
cleanDirs(fullpath)
|
|
||||||
|
|
||||||
files = os.listdir(path)
|
|
||||||
if len(files) == 0:
|
|
||||||
os.rmdir(path)
|
|
||||||
|
|
||||||
def main():
|
|
||||||
print("Obtaining version information from git")
|
|
||||||
cmd = "git describe --long --match='[^(jenkins)]*'"
|
|
||||||
try:
|
|
||||||
process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
|
|
||||||
vers, _ = process.communicate()
|
|
||||||
except OSError:
|
|
||||||
print("Git not found")
|
|
||||||
vers="v1.0-0-deadbeef"
|
|
||||||
(major,minor,rev,githash)=re.match("v(\d+).(\d+)-(\d+)-(.*)",vers).groups()
|
|
||||||
|
|
||||||
(mcpversion,mcversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups()
|
|
||||||
|
|
||||||
with open("version.properties","w") as f:
|
|
||||||
f.write("%s=%s\n" %("IronChest.build.major.number",major))
|
|
||||||
f.write("%s=%s\n" %("IronChest.build.minor.number",minor))
|
|
||||||
f.write("%s=%s\n" %("IronChest.build.revision.number",rev))
|
|
||||||
f.write("%s=%s\n" %("IronChest.build.githash",githash))
|
|
||||||
f.write("%s=%s\n" %("IronChest.build.mcpversion",mcpversion))
|
|
||||||
f.write("%s=%s\n" %("IronChest.build.mcversion",mcversion))
|
|
||||||
|
|
||||||
print("Version information: IronChest %s.%s.%s using MCP %s for %s" % (major, minor, rev, mcpversion, mcversion))
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
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.1-SNAPSHOT'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'forge'
|
||||||
|
|
||||||
|
def versionInfo = getGitVersion()
|
||||||
|
version = "${versionInfo['IronChest.version']}"
|
||||||
|
|
||||||
|
group= "cpw.mods.ironchest" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
archivesBaseName = "ironchest"
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
version = "1.7.2-10.12.0.1024"
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.lifecycle "IronChest "+version
|
||||||
|
|
||||||
|
processResources
|
||||||
|
{
|
||||||
|
exclude '**/*.xcf'
|
||||||
|
// 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
|
||||||
|
doLast {
|
||||||
|
def propsFile = new File(destinationDir, 'version.properties')
|
||||||
|
def properties = new Properties()
|
||||||
|
|
||||||
|
properties.putAll(versionInfo)
|
||||||
|
properties['IronChest.build.mcversion'] = project.minecraft.apiVersion
|
||||||
|
|
||||||
|
properties.store(propsFile.newWriter(), null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jar { appendix = 'universal' }
|
||||||
|
|
||||||
|
task sourceJar(type: Jar) {
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
appendix = 'src'
|
||||||
|
}
|
||||||
|
|
||||||
|
// because the normal default jar task has been modified to be obfuscated
|
||||||
|
task deobfJar(type: Jar) {
|
||||||
|
from sourceSets.main.output
|
||||||
|
appendix = 'deobf'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourceJar
|
||||||
|
archives deobfJar
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// version
|
||||||
|
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.getProperty("BUILD_NUMBER","1")
|
||||||
|
out['IronChest.build.major.number'] = maj
|
||||||
|
out['IronChest.build.minor.number'] = min
|
||||||
|
out['IronChest.build.revision.number'] = rev
|
||||||
|
out['IronChest.build.githash'] = matcher[0][4]
|
||||||
|
out['IronChest.build.number' ] = bn
|
||||||
|
out['IronChest.version' ] = "${maj}.${min}.${rev}.${bn}"
|
||||||
|
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
#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
|
||||||
|
|
@ -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 "$@"
|
||||||
|
|
@ -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
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import static net.minecraftforge.common.ForgeDirection.DOWN;
|
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||||
import static net.minecraftforge.common.ForgeDirection.UP;
|
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -19,9 +19,10 @@ import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
|
@ -29,13 +30,14 @@ import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
@ -44,20 +46,23 @@ public class BlockIronChest extends BlockContainer {
|
||||||
private Random random;
|
private Random random;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private Icon[][] icons;
|
private IIcon[][] icons;
|
||||||
|
|
||||||
public BlockIronChest(int id)
|
public BlockIronChest()
|
||||||
{
|
{
|
||||||
super(id, Material.iron);
|
super(Material.iron);
|
||||||
setUnlocalizedName("IronChest");
|
setBlockName("IronChest");
|
||||||
setHardness(3.0F);
|
setHardness(3.0F);
|
||||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||||
random = new Random();
|
random = new Random();
|
||||||
setCreativeTab(CreativeTabs.tabDecorations);
|
setCreativeTab(CreativeTabs.tabDecorations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden by {@link #createTileEntity(World, int)}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World w)
|
public TileEntity createNewTileEntity(World w, int i)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +93,7 @@ public class BlockIronChest extends BlockContainer {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public Icon getIcon(int i, int j)
|
public IIcon getIcon(int i, int j)
|
||||||
{
|
{
|
||||||
if (j < IronChestType.values().length)
|
if (j < IronChestType.values().length)
|
||||||
{
|
{
|
||||||
|
|
@ -99,7 +104,7 @@ public class BlockIronChest extends BlockContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||||
{
|
{
|
||||||
ArrayList<ItemStack> items = Lists.newArrayList();
|
ArrayList<ItemStack> items = Lists.newArrayList();
|
||||||
ItemStack stack = new ItemStack(this,1,metadata);
|
ItemStack stack = new ItemStack(this,1,metadata);
|
||||||
|
|
@ -110,14 +115,14 @@ public class BlockIronChest extends BlockContainer {
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int i1, float f1, float f2, float f3)
|
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int i1, float f1, float f2, float f3)
|
||||||
{
|
{
|
||||||
TileEntity te = world.getBlockTileEntity(i, j, k);
|
TileEntity te = world.getTileEntity(i, j, k);
|
||||||
|
|
||||||
if (te == null || !(te instanceof TileEntityIronChest))
|
if (te == null || !(te instanceof TileEntityIronChest))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.isBlockSolidOnSide(i, j + 1, k, ForgeDirection.DOWN))
|
if (world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +164,7 @@ public class BlockIronChest extends BlockContainer {
|
||||||
{
|
{
|
||||||
chestFacing = 4;
|
chestFacing = 4;
|
||||||
}
|
}
|
||||||
TileEntity te = world.getBlockTileEntity(i, j, k);
|
TileEntity te = world.getTileEntity(i, j, k);
|
||||||
if (te != null && te instanceof TileEntityIronChest)
|
if (te != null && te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
TileEntityIronChest teic = (TileEntityIronChest) te;
|
TileEntityIronChest teic = (TileEntityIronChest) te;
|
||||||
|
|
@ -176,9 +181,9 @@ public class BlockIronChest extends BlockContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int i, int j, int k, int i1, int i2)
|
public void breakBlock(World world, int i, int j, int k, Block i1, int i2)
|
||||||
{
|
{
|
||||||
TileEntityIronChest tileentitychest = (TileEntityIronChest) world.getBlockTileEntity(i, j, k);
|
TileEntityIronChest tileentitychest = (TileEntityIronChest) world.getTileEntity(i, j, k);
|
||||||
if (tileentitychest != null)
|
if (tileentitychest != null)
|
||||||
{
|
{
|
||||||
tileentitychest.removeAdornments();
|
tileentitychest.removeAdornments();
|
||||||
|
|
@ -208,7 +213,7 @@ public class BlockIronChest extends BlockContainer {
|
||||||
}
|
}
|
||||||
itemstack.stackSize -= i1;
|
itemstack.stackSize -= i1;
|
||||||
EntityItem entityitem = new EntityItem(world, (float) xCoord + f, (float) yCoord + (newSize > 0 ? 1 : 0) + f1, (float) zCoord + f2,
|
EntityItem entityitem = new EntityItem(world, (float) xCoord + f, (float) yCoord + (newSize > 0 ? 1 : 0) + f1, (float) zCoord + f2,
|
||||||
new ItemStack(itemstack.itemID, i1, itemstack.getItemDamage()));
|
new ItemStack(itemstack.getItem(), i1, itemstack.getItemDamage()));
|
||||||
float f3 = 0.05F;
|
float f3 = 0.05F;
|
||||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||||
|
|
@ -225,7 +230,7 @@ public class BlockIronChest extends BlockContainer {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||||
{
|
{
|
||||||
for (IronChestType type : IronChestType.values())
|
for (IronChestType type : IronChestType.values())
|
||||||
{
|
{
|
||||||
|
|
@ -239,7 +244,7 @@ public class BlockIronChest extends BlockContainer {
|
||||||
@Override
|
@Override
|
||||||
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
||||||
{
|
{
|
||||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
if (te instanceof TileEntityIronChest)
|
if (te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
TileEntityIronChest teic = (TileEntityIronChest) te;
|
TileEntityIronChest teic = (TileEntityIronChest) te;
|
||||||
|
|
@ -255,13 +260,13 @@ public class BlockIronChest extends BlockContainer {
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5)
|
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5)
|
||||||
{
|
{
|
||||||
return Container.calcRedstoneFromInventory((TileEntityIronChest) par1World.getBlockTileEntity(par2, par3, par4));
|
return Container.calcRedstoneFromInventory((TileEntityIronChest) par1World.getTileEntity(par2, par3, par4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
for (IronChestType typ: IronChestType.values())
|
for (IronChestType typ: IronChestType.values())
|
||||||
{
|
{
|
||||||
|
|
@ -285,7 +290,7 @@ public class BlockIronChest extends BlockContainer {
|
||||||
}
|
}
|
||||||
if (axis == UP || axis == DOWN)
|
if (axis == UP || axis == DOWN)
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = worldObj.getBlockTileEntity(x, y, z);
|
TileEntity tileEntity = worldObj.getTileEntity(x, y, z);
|
||||||
if (tileEntity instanceof TileEntityIronChest) {
|
if (tileEntity instanceof TileEntityIronChest) {
|
||||||
TileEntityIronChest icte = (TileEntityIronChest) tileEntity;
|
TileEntityIronChest icte = (TileEntityIronChest) tileEntity;
|
||||||
icte.rotateAround(axis);
|
icte.rotateAround(axis);
|
||||||
|
|
@ -14,9 +14,9 @@ import static cpw.mods.ironchest.IronChestType.IRON;
|
||||||
import static cpw.mods.ironchest.IronChestType.OBSIDIAN;
|
import static cpw.mods.ironchest.IronChestType.OBSIDIAN;
|
||||||
import static cpw.mods.ironchest.IronChestType.SILVER;
|
import static cpw.mods.ironchest.IronChestType.SILVER;
|
||||||
import static cpw.mods.ironchest.IronChestType.WOOD;
|
import static cpw.mods.ironchest.IronChestType.WOOD;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public enum ChestChangerType {
|
public enum ChestChangerType {
|
||||||
|
|
@ -56,10 +56,9 @@ public enum ChestChangerType {
|
||||||
return this.target.ordinal();
|
return this.target.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemChestChanger buildItem(Configuration cfg, int id)
|
public ItemChestChanger buildItem(Configuration cfg)
|
||||||
{
|
{
|
||||||
int itemId = cfg.getItem(itemName, id).getInt(id);
|
item = new ItemChestChanger(this);
|
||||||
item = new ItemChestChanger(itemId, this);
|
|
||||||
GameRegistry.registerItem(item, itemName);
|
GameRegistry.registerItem(item, itemName);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
@ -72,16 +71,16 @@ public enum ChestChangerType {
|
||||||
{
|
{
|
||||||
Object targetMaterial = IronChestType.translateOreName(targetMat);
|
Object targetMaterial = IronChestType.translateOreName(targetMat);
|
||||||
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
|
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
|
||||||
IronChestType.addRecipe(new ItemStack(item), recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', Block.glass, 'O', Block.obsidian);
|
IronChestType.addRecipe(new ItemStack(item), recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', Blocks.glass, 'O', Blocks.obsidian);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void buildItems(Configuration cfg, int defaultId)
|
public static void buildItems(Configuration cfg)
|
||||||
{
|
{
|
||||||
for (ChestChangerType type : values())
|
for (ChestChangerType type : values())
|
||||||
{
|
{
|
||||||
type.buildItem(cfg, defaultId++);
|
type.buildItem(cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,11 +35,11 @@ public class CommonProxy implements IGuiHandler {
|
||||||
@Override
|
@Override
|
||||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int X, int Y, int Z)
|
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int X, int Y, int Z)
|
||||||
{
|
{
|
||||||
TileEntity te = world.getBlockTileEntity(X, Y, Z);
|
TileEntity te = world.getTileEntity(X, Y, Z);
|
||||||
if (te != null && te instanceof TileEntityIronChest)
|
if (te != null && te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
TileEntityIronChest icte = (TileEntityIronChest) te;
|
TileEntityIronChest icte = (TileEntityIronChest) te;
|
||||||
return new ContainerIronChestBase(player.inventory, icte, icte.getType(), 0, 0);
|
return new ContainerIronChest(player.inventory, icte, icte.getType(), 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -17,17 +17,17 @@ import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ContainerIronChestBase extends Container {
|
public class ContainerIronChest extends Container {
|
||||||
private IronChestType type;
|
private IronChestType type;
|
||||||
private EntityPlayer player;
|
private EntityPlayer player;
|
||||||
private IInventory chest;
|
private IInventory chest;
|
||||||
|
|
||||||
public ContainerIronChestBase(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
public ContainerIronChest(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
||||||
{
|
{
|
||||||
chest = chestInventory;
|
chest = chestInventory;
|
||||||
player = ((InventoryPlayer) playerInventory).player;
|
player = ((InventoryPlayer) playerInventory).player;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
chestInventory.openChest();
|
chestInventory.openInventory();
|
||||||
layoutContainer(playerInventory, chestInventory, type, xSize, ySize);
|
layoutContainer(playerInventory, chestInventory, type, xSize, ySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ public class ContainerIronChestBase extends Container {
|
||||||
public void onContainerClosed(EntityPlayer entityplayer)
|
public void onContainerClosed(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
super.onContainerClosed(entityplayer);
|
super.onContainerClosed(entityplayer);
|
||||||
chest.closeChest();
|
chest.closeInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
||||||
|
|
@ -10,10 +10,9 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.Configuration;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
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.FMLLog;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
|
|
@ -22,12 +21,10 @@ import cpw.mods.fml.common.SidedProxy;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
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.common.network.NetworkRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[7.0,);required-after:FML@[5.0.5,)")
|
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[7.0,);required-after:FML@[5.0.5,)")
|
||||||
@NetworkMod(channels = { "IronChest" }, versionBounds = "[5.2,)", clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
|
||||||
public class IronChest {
|
public class IronChest {
|
||||||
public static BlockIronChest ironChestBlock;
|
public static BlockIronChest ironChestBlock;
|
||||||
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
||||||
|
|
@ -36,7 +33,6 @@ public class IronChest {
|
||||||
public static IronChest instance;
|
public static IronChest instance;
|
||||||
public static boolean CACHE_RENDER = true;
|
public static boolean CACHE_RENDER = true;
|
||||||
public static boolean OCELOTS_SITONCHESTS = true;
|
public static boolean OCELOTS_SITONCHESTS = true;
|
||||||
private int blockId;
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event)
|
public void preInit(FMLPreInitializationEvent event)
|
||||||
|
|
@ -47,22 +43,22 @@ public class IronChest {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cfg.load();
|
cfg.load();
|
||||||
blockId = cfg.getBlock("ironChests", 975).getInt(975);
|
ChestChangerType.buildItems(cfg);
|
||||||
ChestChangerType.buildItems(cfg, 19501);
|
|
||||||
CACHE_RENDER = cfg.get(Configuration.CATEGORY_GENERAL, "cacheRenderingInformation", true).getBoolean(true);
|
CACHE_RENDER = cfg.get(Configuration.CATEGORY_GENERAL, "cacheRenderingInformation", true).getBoolean(true);
|
||||||
OCELOTS_SITONCHESTS = cfg.get(Configuration.CATEGORY_GENERAL, "ocelotsSitOnChests", true).getBoolean(true);
|
OCELOTS_SITONCHESTS = cfg.get(Configuration.CATEGORY_GENERAL, "ocelotsSitOnChests", true).getBoolean(true);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
FMLLog.log(Level.SEVERE, e, "IronChest has a problem loading it's configuration");
|
FMLLog.log(Level.ERROR, e, "IronChest has a problem loading it's configuration");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (cfg.hasChanged())
|
if (cfg.hasChanged())
|
||||||
cfg.save();
|
cfg.save();
|
||||||
}
|
}
|
||||||
ironChestBlock = new BlockIronChest(blockId);
|
ironChestBlock = new BlockIronChest();
|
||||||
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
|
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
|
||||||
|
PacketHandler.INSTANCE.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
@ -75,12 +71,12 @@ public class IronChest {
|
||||||
}
|
}
|
||||||
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
||||||
ChestChangerType.generateRecipes();
|
ChestChangerType.generateRecipes();
|
||||||
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||||
proxy.registerRenderInformation();
|
proxy.registerRenderInformation();
|
||||||
if (OCELOTS_SITONCHESTS)
|
// if (OCELOTS_SITONCHESTS)
|
||||||
{
|
// {
|
||||||
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
// MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
||||||
}
|
// }
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -10,13 +10,13 @@ public class IronChestAIOcelotSit extends EntityAIOcelotSit {
|
||||||
super(par1EntityOcelot, par2);
|
super(par1EntityOcelot, par2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
protected boolean isSittableBlock(World world, int x, int y, int z)
|
protected boolean func_151486_a(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
if (world.getBlockId(x, y, z) == IronChest.ironChestBlock.blockID)
|
if (world.getBlock(x, y, z) == IronChest.ironChestBlock)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.isSittableBlock(world, x, y, z);
|
return super.func_151486_a(world, x, y, z);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
*/}
|
||||||
|
|
@ -13,15 +13,15 @@ package cpw.mods.ironchest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagByte;
|
import net.minecraft.nbt.NBTTagByte;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
@ -35,7 +35,7 @@ public enum IronChestType {
|
||||||
SILVER(72, 9, false, "Silver Chest", "silverchest.png", 4, Arrays.asList("ingotSilver"), TileEntitySilverChest.class, "mmmm3mmmm", "mGmG0GmGm"),
|
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"),
|
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"),
|
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.itemsList[Block.dirt.blockID],"mmmmCmmmm"),
|
DIRTCHEST9000(1, 1, false, "Dirt Chest 9000", "dirtchest.png",7,Arrays.asList("dirt"), TileEntityDirtChest.class,Item.getItemFromBlock(Blocks.dirt),"mmmmCmmmm"),
|
||||||
WOOD(0, 0, false, "", "", -1, Arrays.asList("plankWood"), null);
|
WOOD(0, 0, false, "", "", -1, Arrays.asList("plankWood"), null);
|
||||||
int size;
|
int size;
|
||||||
private int rowLength;
|
private int rowLength;
|
||||||
|
|
@ -110,7 +110,7 @@ public enum IronChestType {
|
||||||
|
|
||||||
public static void registerBlocksAndRecipes(BlockIronChest blockResult)
|
public static void registerBlocksAndRecipes(BlockIronChest blockResult)
|
||||||
{
|
{
|
||||||
ItemStack previous = new ItemStack(Block.chest);
|
ItemStack previous = new ItemStack(Blocks.chest);
|
||||||
for (IronChestType typ : values())
|
for (IronChestType typ : values())
|
||||||
{
|
{
|
||||||
generateRecipesForType(blockResult, previous, typ);
|
generateRecipesForType(blockResult, previous, typ);
|
||||||
|
|
@ -131,7 +131,7 @@ public enum IronChestType {
|
||||||
mainMaterial = translateOreName(mat);
|
mainMaterial = translateOreName(mat);
|
||||||
addRecipe(new ItemStack(blockResult, 1, type.ordinal()), recipeSplit,
|
addRecipe(new ItemStack(blockResult, 1, type.ordinal()), recipeSplit,
|
||||||
'm', mainMaterial, 'P', previousTier, /* previous tier of chest */
|
'm', mainMaterial, 'P', previousTier, /* previous tier of chest */
|
||||||
'G', Block.glass, 'C', Block.chest,
|
'G', Blocks.glass, 'C', Blocks.chest,
|
||||||
'0', new ItemStack(blockResult, 1, 0), /* Iron Chest */
|
'0', new ItemStack(blockResult, 1, 0), /* Iron Chest */
|
||||||
'1', new ItemStack(blockResult, 1, 1), /* Gold Chest */
|
'1', new ItemStack(blockResult, 1, 1), /* Gold Chest */
|
||||||
'2', new ItemStack(blockResult, 1, 2), /* Diamond Chest */
|
'2', new ItemStack(blockResult, 1, 2), /* Diamond Chest */
|
||||||
|
|
@ -146,27 +146,27 @@ public enum IronChestType {
|
||||||
{
|
{
|
||||||
if (mat == "ingotIron")
|
if (mat == "ingotIron")
|
||||||
{
|
{
|
||||||
return Item.ingotIron;
|
return Items.iron_ingot;
|
||||||
}
|
}
|
||||||
else if (mat == "ingotGold")
|
else if (mat == "ingotGold")
|
||||||
{
|
{
|
||||||
return Item.ingotGold;
|
return Items.gold_ingot;
|
||||||
}
|
}
|
||||||
else if (mat == "gemDiamond")
|
else if (mat == "gemDiamond")
|
||||||
{
|
{
|
||||||
return Item.diamond;
|
return Items.diamond;
|
||||||
}
|
}
|
||||||
else if (mat == "blockGlass")
|
else if (mat == "blockGlass")
|
||||||
{
|
{
|
||||||
return Block.glass;
|
return Blocks.glass;
|
||||||
}
|
}
|
||||||
else if (mat == "obsidian")
|
else if (mat == "obsidian")
|
||||||
{
|
{
|
||||||
return Block.obsidian;
|
return Blocks.obsidian;
|
||||||
}
|
}
|
||||||
else if (mat == "dirt")
|
else if (mat == "dirt")
|
||||||
{
|
{
|
||||||
return Block.dirt;
|
return Blocks.dirt;
|
||||||
}
|
}
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
|
|
@ -220,14 +220,14 @@ public enum IronChestType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private Icon[] icons;
|
private IIcon[] icons;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void makeIcons(IconRegister par1IconRegister)
|
public void makeIcons(IIconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
if (isValidForCreativeMode())
|
if (isValidForCreativeMode())
|
||||||
{
|
{
|
||||||
icons = new Icon[3];
|
icons = new IIcon[3];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String s : sideNames)
|
for (String s : sideNames)
|
||||||
{
|
{
|
||||||
|
|
@ -237,7 +237,7 @@ public enum IronChestType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Icon getIcon(int side)
|
public IIcon getIcon(int side)
|
||||||
{
|
{
|
||||||
|
|
||||||
return icons[sideMapping[side]];
|
return icons[sideMapping[side]];
|
||||||
|
|
@ -259,7 +259,7 @@ public enum IronChestType {
|
||||||
{
|
{
|
||||||
if (this == DIRTCHEST9000)
|
if (this == DIRTCHEST9000)
|
||||||
{
|
{
|
||||||
item.setTagInfo("dirtchest", new NBTTagByte("",(byte) 1));
|
item.setTagInfo("dirtchest", new NBTTagByte((byte) 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,9 +10,10 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
@ -26,9 +27,9 @@ public class ItemChestChanger extends Item {
|
||||||
|
|
||||||
private ChestChangerType type;
|
private ChestChangerType type;
|
||||||
|
|
||||||
public ItemChestChanger(int id, ChestChangerType type)
|
public ItemChestChanger(ChestChangerType type)
|
||||||
{
|
{
|
||||||
super(id);
|
super();
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
setUnlocalizedName("ironchest:"+type.name());
|
setUnlocalizedName("ironchest:"+type.name());
|
||||||
|
|
@ -38,7 +39,7 @@ public class ItemChestChanger extends Item {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IIconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon("ironchest:"+type.itemName);
|
this.itemIcon = par1IconRegister.registerIcon("ironchest:"+type.itemName);
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +48,7 @@ public class ItemChestChanger extends Item {
|
||||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side, float hitX, float hitY, float hitZ)
|
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (world.isRemote) return false;
|
if (world.isRemote) return false;
|
||||||
TileEntity te = world.getBlockTileEntity(X, Y, Z);
|
TileEntity te = world.getTileEntity(X, Y, Z);
|
||||||
TileEntityIronChest newchest;
|
TileEntityIronChest newchest;
|
||||||
if (te != null && te instanceof TileEntityIronChest)
|
if (te != null && te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
|
|
@ -61,7 +62,7 @@ public class ItemChestChanger extends Item {
|
||||||
else if (te != null && te instanceof TileEntityChest)
|
else if (te != null && te instanceof TileEntityChest)
|
||||||
{
|
{
|
||||||
TileEntityChest tec = (TileEntityChest) te;
|
TileEntityChest tec = (TileEntityChest) te;
|
||||||
if (tec.numUsingPlayers > 0)
|
if (tec.numPlayersUsing > 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -83,20 +84,20 @@ public class ItemChestChanger extends Item {
|
||||||
chestContents[i] = null;
|
chestContents[i] = null;
|
||||||
}
|
}
|
||||||
// Clear the old block out
|
// Clear the old block out
|
||||||
world.setBlock(X, Y, Z, 0, 0, 3);
|
world.setBlock(X, Y, Z, Blocks.air, 0, 3);
|
||||||
// Force the Chest TE to reset it's knowledge of neighbouring blocks
|
// Force the Chest TE to reset it's knowledge of neighbouring blocks
|
||||||
tec.updateContainingBlockInfo();
|
tec.updateContainingBlockInfo();
|
||||||
// Force the Chest TE to update any neighbours so they update next
|
// Force the Chest TE to update any neighbours so they update next
|
||||||
// tick
|
// tick
|
||||||
tec.checkForAdjacentChests();
|
tec.checkForAdjacentChests();
|
||||||
// And put in our block instead
|
// And put in our block instead
|
||||||
world.setBlock(X, Y, Z, block.blockID, newchest.getType().ordinal(), 3);
|
world.setBlock(X, Y, Z, block, newchest.getType().ordinal(), 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
world.setBlockTileEntity(X, Y, Z, newchest);
|
world.setTileEntity(X, Y, Z, newchest);
|
||||||
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal(), 3);
|
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal(), 3);
|
||||||
stack.stackSize = 0;
|
stack.stackSize = 0;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -10,14 +10,15 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemIronChest extends ItemBlock {
|
public class ItemIronChest extends ItemBlock {
|
||||||
|
|
||||||
public ItemIronChest(int id)
|
public ItemIronChest(Block block)
|
||||||
{
|
{
|
||||||
super(id);
|
super(block);
|
||||||
setMaxDamage(0);
|
setMaxDamage(0);
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
}
|
}
|
||||||
|
|
@ -21,13 +21,13 @@ public class MappableItemStackWrapper {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return isw.wrap.itemID == wrap.itemID;
|
return isw.wrap == wrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
return wrap.itemID;
|
return System.identityHashCode(wrap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,26 +1,25 @@
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraft.entity.ai.EntityAIOcelotSit;
|
import net.minecraft.entity.ai.EntityAIOcelotSit;
|
||||||
import net.minecraft.entity.ai.EntityAITaskEntry;
|
import net.minecraft.entity.ai.EntityAITasks;
|
||||||
import net.minecraft.entity.passive.EntityOcelot;
|
import net.minecraft.entity.passive.EntityOcelot;
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
|
||||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||||
|
|
||||||
public class OcelotsSitOnChestsHandler {
|
public class OcelotsSitOnChestsHandler {
|
||||||
@ForgeSubscribe
|
@SubscribeEvent
|
||||||
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
|
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
|
||||||
{
|
{
|
||||||
if (evt.entityLiving.ticksExisted < 5 && evt.entityLiving instanceof EntityOcelot)
|
if (evt.entityLiving.ticksExisted < 5 && evt.entityLiving instanceof EntityOcelot)
|
||||||
{
|
{
|
||||||
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
|
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
|
List<EntityAITasks.EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++)
|
for (int i = 0; i < tasks.size(); i++)
|
||||||
{
|
{
|
||||||
EntityAITaskEntry task = tasks.get(i);
|
EntityAITasks.EntityAITaskEntry task = tasks.get(i);
|
||||||
if (task.priority == 6 && (task.action instanceof EntityAIOcelotSit) && !(task.action instanceof IronChestAIOcelotSit))
|
if (task.priority == 6 && (task.action instanceof EntityAIOcelotSit) && !(task.action instanceof IronChestAIOcelotSit))
|
||||||
{
|
{
|
||||||
task.action = new IronChestAIOcelotSit(ocelot, 0.4F);
|
task.action = new IronChestAIOcelotSit(ocelot, 0.4F);
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||||
|
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public enum PacketHandler {
|
||||||
|
INSTANCE;
|
||||||
|
private EnumMap<Side, FMLEmbeddedChannel> channels;
|
||||||
|
|
||||||
|
private PacketHandler()
|
||||||
|
{
|
||||||
|
this.channels = NetworkRegistry.INSTANCE.newChannel("IronChest", new IronChestCodec());
|
||||||
|
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
||||||
|
{
|
||||||
|
addClientHandler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private void addClientHandler() {
|
||||||
|
FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT);
|
||||||
|
String codec = clientChannel.findChannelHandlerNameForType(IronChestCodec.class);
|
||||||
|
clientChannel.pipeline().addAfter(codec, "ClientHandler", new IronChestMessageHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class IronChestMessageHandler extends SimpleChannelInboundHandler<IronChestMessage>
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void channelRead0(ChannelHandlerContext ctx, IronChestMessage msg) throws Exception
|
||||||
|
{
|
||||||
|
World world = IronChest.proxy.getClientWorld();
|
||||||
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
|
if (te instanceof TileEntityIronChest)
|
||||||
|
{
|
||||||
|
TileEntityIronChest icte = (TileEntityIronChest) te;
|
||||||
|
icte.setFacing(msg.facing);
|
||||||
|
icte.handlePacketData(msg.type, msg.items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class IronChestMessage
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
int type;
|
||||||
|
int facing;
|
||||||
|
int[] items;
|
||||||
|
}
|
||||||
|
private class IronChestCodec extends FMLIndexedMessageToMessageCodec<IronChestMessage>
|
||||||
|
{
|
||||||
|
public IronChestCodec()
|
||||||
|
{
|
||||||
|
addDiscriminator(0, IronChestMessage.class);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void encodeInto(ChannelHandlerContext ctx, IronChestMessage msg, ByteBuf target) throws Exception
|
||||||
|
{
|
||||||
|
target.writeInt(msg.x);
|
||||||
|
target.writeInt(msg.y);
|
||||||
|
target.writeInt(msg.z);
|
||||||
|
int typeAndFacing = ((msg.type & 0x0F) | ((msg.facing & 0x0F) << 4)) & 0xFF;
|
||||||
|
target.writeByte(typeAndFacing);
|
||||||
|
target.writeBoolean(msg.items != null);
|
||||||
|
if (msg.items != null)
|
||||||
|
{
|
||||||
|
int[] items = msg.items;
|
||||||
|
for (int j = 0; j < items.length; j++)
|
||||||
|
{
|
||||||
|
int i = items[j];
|
||||||
|
target.writeInt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, IronChestMessage msg)
|
||||||
|
{
|
||||||
|
msg.x = dat.readInt();
|
||||||
|
msg.y = dat.readInt();
|
||||||
|
msg.z = dat.readInt();
|
||||||
|
int typDat = dat.readByte();
|
||||||
|
msg.type = (byte)(typDat & 0xf);
|
||||||
|
msg.facing = (byte)((typDat >> 4) & 0xf);
|
||||||
|
boolean hasStacks = dat.readBoolean();
|
||||||
|
msg.items = new int[0];
|
||||||
|
if (hasStacks)
|
||||||
|
{
|
||||||
|
msg.items = new int[24];
|
||||||
|
for (int i = 0; i < msg.items.length; i++)
|
||||||
|
{
|
||||||
|
msg.items[i] = dat.readInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Packet getPacket(TileEntityIronChest tileEntityIronChest)
|
||||||
|
{
|
||||||
|
IronChestMessage msg = new IronChestMessage();
|
||||||
|
msg.x = tileEntityIronChest.xCoord;
|
||||||
|
msg.y = tileEntityIronChest.yCoord;
|
||||||
|
msg.z = tileEntityIronChest.zCoord;
|
||||||
|
msg.type = tileEntityIronChest.getType().ordinal();
|
||||||
|
msg.facing = tileEntityIronChest.getFacing();
|
||||||
|
msg.items = tileEntityIronChest.buildIntDataList();
|
||||||
|
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,26 +1,23 @@
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.nbt.NBTTagString;
|
import net.minecraft.nbt.NBTTagString;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
public class TileEntityDirtChest extends TileEntityIronChest {
|
public class TileEntityDirtChest extends TileEntityIronChest {
|
||||||
private static ItemStack dirtChest9000GuideBook = new ItemStack(Item.writtenBook);
|
private static ItemStack dirtChest9000GuideBook = new ItemStack(Items.written_book);
|
||||||
static {
|
static {
|
||||||
dirtChest9000GuideBook.setTagInfo("author", new NBTTagString("author", "cpw"));
|
dirtChest9000GuideBook.setTagInfo("author", new NBTTagString("cpw"));
|
||||||
dirtChest9000GuideBook.setTagInfo("title", new NBTTagString("title", StatCollector.translateToLocal("book.ironchest:dirtchest9000.title")));
|
dirtChest9000GuideBook.setTagInfo("title", new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.title")));
|
||||||
NBTTagList pages = new NBTTagList();
|
NBTTagList pages = new NBTTagList();
|
||||||
pages.appendTag(new NBTTagString("1", StatCollector.translateToLocal("book.ironchest:dirtchest9000.page1")));
|
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page1")));
|
||||||
pages.appendTag(new NBTTagString("2", StatCollector.translateToLocal("book.ironchest:dirtchest9000.page2")));
|
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page2")));
|
||||||
pages.appendTag(new NBTTagString("3", StatCollector.translateToLocal("book.ironchest:dirtchest9000.page3")));
|
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page3")));
|
||||||
pages.appendTag(new NBTTagString("4", StatCollector.translateToLocal("book.ironchest:dirtchest9000.page4")));
|
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page4")));
|
||||||
pages.appendTag(new NBTTagString("5", StatCollector.translateToLocal("book.ironchest:dirtchest9000.page5")));
|
pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.ironchest:dirtchest9000.page5")));
|
||||||
dirtChest9000GuideBook.setTagInfo("pages", pages);
|
dirtChest9000GuideBook.setTagInfo("pages", pages);
|
||||||
}
|
}
|
||||||
public TileEntityDirtChest() {
|
public TileEntityDirtChest() {
|
||||||
|
|
@ -18,13 +18,15 @@ import java.util.List;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.util.Constants;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityIronChest extends TileEntity implements IInventory {
|
public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
private int ticksSinceSync = -1;
|
private int ticksSinceSync = -1;
|
||||||
|
|
@ -34,7 +36,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
private IronChestType type;
|
private IronChestType type;
|
||||||
public ItemStack[] chestContents;
|
public ItemStack[] chestContents;
|
||||||
private ItemStack[] topStacks;
|
private ItemStack[] topStacks;
|
||||||
private byte facing;
|
private int facing;
|
||||||
private boolean inventoryTouched;
|
private boolean inventoryTouched;
|
||||||
private boolean hadStuff;
|
private boolean hadStuff;
|
||||||
|
|
||||||
|
|
@ -62,13 +64,13 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
return type.size;
|
return type.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getFacing()
|
public int getFacing()
|
||||||
{
|
{
|
||||||
return this.facing;
|
return this.facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInvName()
|
public String getInventoryName()
|
||||||
{
|
{
|
||||||
return type.name();
|
return type.name();
|
||||||
}
|
}
|
||||||
|
|
@ -86,9 +88,9 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInventoryChanged()
|
public void markDirty()
|
||||||
{
|
{
|
||||||
super.onInventoryChanged();
|
super.markDirty();
|
||||||
sortTopStacks();
|
sortTopStacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,7 +182,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
{
|
{
|
||||||
ItemStack itemstack = chestContents[i];
|
ItemStack itemstack = chestContents[i];
|
||||||
chestContents[i] = null;
|
chestContents[i] = null;
|
||||||
onInventoryChanged();
|
markDirty();
|
||||||
return itemstack;
|
return itemstack;
|
||||||
}
|
}
|
||||||
ItemStack itemstack1 = chestContents[i].splitStack(j);
|
ItemStack itemstack1 = chestContents[i].splitStack(j);
|
||||||
|
|
@ -188,7 +190,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
{
|
{
|
||||||
chestContents[i] = null;
|
chestContents[i] = null;
|
||||||
}
|
}
|
||||||
onInventoryChanged();
|
markDirty();
|
||||||
return itemstack1;
|
return itemstack1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -205,18 +207,18 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
{
|
{
|
||||||
itemstack.stackSize = getInventoryStackLimit();
|
itemstack.stackSize = getInventoryStackLimit();
|
||||||
}
|
}
|
||||||
onInventoryChanged();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(nbttagcompound);
|
super.readFromNBT(nbttagcompound);
|
||||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
|
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||||
chestContents = new ItemStack[getSizeInventory()];
|
chestContents = new ItemStack[getSizeInventory()];
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); i++)
|
for (int i = 0; i < nbttaglist.tagCount(); i++)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
|
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||||
int j = nbttagcompound1.getByte("Slot") & 0xff;
|
int j = nbttagcompound1.getByte("Slot") & 0xff;
|
||||||
if (j >= 0 && j < chestContents.length)
|
if (j >= 0 && j < chestContents.length)
|
||||||
{
|
{
|
||||||
|
|
@ -244,7 +246,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
nbttagcompound.setTag("Items", nbttaglist);
|
nbttagcompound.setTag("Items", nbttaglist);
|
||||||
nbttagcompound.setByte("facing", facing);
|
nbttagcompound.setByte("facing", (byte)facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -260,7 +262,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
|
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -276,14 +278,15 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
{
|
{
|
||||||
this.numUsingPlayers = 0;
|
this.numUsingPlayers = 0;
|
||||||
float var1 = 5.0F;
|
float var1 = 5.0F;
|
||||||
List var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)this.xCoord - var1), (double)((float)this.yCoord - var1), (double)((float)this.zCoord - var1), (double)((float)(this.xCoord + 1) + var1), (double)((float)(this.yCoord + 1) + var1), (double)((float)(this.zCoord + 1) + var1)));
|
@SuppressWarnings("unchecked")
|
||||||
Iterator var3 = var2.iterator();
|
List<EntityPlayer> var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)this.xCoord - var1), (double)((float)this.yCoord - var1), (double)((float)this.zCoord - var1), (double)((float)(this.xCoord + 1) + var1), (double)((float)(this.yCoord + 1) + var1), (double)((float)(this.zCoord + 1) + var1)));
|
||||||
|
Iterator<EntityPlayer> var3 = var2.iterator();
|
||||||
|
|
||||||
while (var3.hasNext())
|
while (var3.hasNext())
|
||||||
{
|
{
|
||||||
EntityPlayer var4 = (EntityPlayer)var3.next();
|
EntityPlayer var4 = var3.next();
|
||||||
|
|
||||||
if (var4.openContainer instanceof ContainerIronChestBase)
|
if (var4.openContainer instanceof ContainerIronChest)
|
||||||
{
|
{
|
||||||
++this.numUsingPlayers;
|
++this.numUsingPlayers;
|
||||||
}
|
}
|
||||||
|
|
@ -292,7 +295,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
|
|
||||||
if (worldObj != null && !worldObj.isRemote && ticksSinceSync < 0)
|
if (worldObj != null && !worldObj.isRemote && ticksSinceSync < 0)
|
||||||
{
|
{
|
||||||
worldObj.addBlockEvent(xCoord, yCoord, zCoord, IronChest.ironChestBlock.blockID, 3, ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7));
|
worldObj.addBlockEvent(xCoord, yCoord, zCoord, IronChest.ironChestBlock, 3, ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7));
|
||||||
}
|
}
|
||||||
if (!worldObj.isRemote && inventoryTouched)
|
if (!worldObj.isRemote && inventoryTouched)
|
||||||
{
|
{
|
||||||
|
|
@ -358,24 +361,24 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openChest()
|
public void openInventory()
|
||||||
{
|
{
|
||||||
if (worldObj == null) return;
|
if (worldObj == null) return;
|
||||||
numUsingPlayers++;
|
numUsingPlayers++;
|
||||||
worldObj.addBlockEvent(xCoord, yCoord, zCoord, IronChest.ironChestBlock.blockID, 1, numUsingPlayers);
|
worldObj.addBlockEvent(xCoord, yCoord, zCoord, IronChest.ironChestBlock, 1, numUsingPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeChest()
|
public void closeInventory()
|
||||||
{
|
{
|
||||||
if (worldObj == null) return;
|
if (worldObj == null) return;
|
||||||
numUsingPlayers--;
|
numUsingPlayers--;
|
||||||
worldObj.addBlockEvent(xCoord, yCoord, zCoord, IronChest.ironChestBlock.blockID, 1, numUsingPlayers);
|
worldObj.addBlockEvent(xCoord, yCoord, zCoord, IronChest.ironChestBlock, 1, numUsingPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFacing(byte chestFacing)
|
public void setFacing(int facing2)
|
||||||
{
|
{
|
||||||
this.facing = chestFacing;
|
this.facing = facing2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntityIronChest applyUpgradeItem(ItemChestChanger itemChestChanger)
|
public TileEntityIronChest applyUpgradeItem(ItemChestChanger itemChestChanger)
|
||||||
|
|
@ -410,8 +413,8 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
{
|
{
|
||||||
if (l != type.ordinal())
|
if (l != type.ordinal())
|
||||||
{
|
{
|
||||||
worldObj.setBlockTileEntity(xCoord, yCoord, zCoord, IronChestType.makeEntity(l));
|
worldObj.setTileEntity(xCoord, yCoord, zCoord, IronChestType.makeEntity(l));
|
||||||
return (TileEntityIronChest) worldObj.getBlockTileEntity(xCoord, yCoord, zCoord);
|
return (TileEntityIronChest) worldObj.getTileEntity(xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -441,7 +444,8 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
{
|
{
|
||||||
if (intData[pos + 2] != 0)
|
if (intData[pos + 2] != 0)
|
||||||
{
|
{
|
||||||
ItemStack is = new ItemStack(intData[pos], intData[pos + 2], intData[pos + 1]);
|
Item it = Item.getItemById(intData[pos]);
|
||||||
|
ItemStack is = new ItemStack(it, intData[pos + 2], intData[pos + 1]);
|
||||||
chest.topStacks[i] = is;
|
chest.topStacks[i] = is;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -463,7 +467,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
{
|
{
|
||||||
if (is != null)
|
if (is != null)
|
||||||
{
|
{
|
||||||
sortList[pos++] = is.itemID;
|
sortList[pos++] = Item.getIdFromItem(is.getItem());
|
||||||
sortList[pos++] = is.getItemDamage();
|
sortList[pos++] = is.getItemDamage();
|
||||||
sortList[pos++] = is.stackSize;
|
sortList[pos++] = is.stackSize;
|
||||||
}
|
}
|
||||||
|
|
@ -479,6 +483,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getStackInSlotOnClosing(int par1)
|
public ItemStack getStackInSlotOnClosing(int par1)
|
||||||
{
|
{
|
||||||
if (this.chestContents[par1] != null)
|
if (this.chestContents[par1] != null)
|
||||||
|
|
@ -505,7 +510,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInvNameLocalized()
|
public boolean hasCustomInventoryName()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -513,7 +518,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
void rotateAround(ForgeDirection axis)
|
void rotateAround(ForgeDirection axis)
|
||||||
{
|
{
|
||||||
setFacing((byte)ForgeDirection.getOrientation(facing).getRotation(axis).ordinal());
|
setFacing((byte)ForgeDirection.getOrientation(facing).getRotation(axis).ordinal());
|
||||||
worldObj.addBlockEvent(xCoord, yCoord, zCoord, IronChest.ironChestBlock.blockID, 2, getFacing());
|
worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, IronChest.ironChestBlock, 2, getFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void wasPlaced(EntityLivingBase entityliving, ItemStack itemStack)
|
public void wasPlaced(EntityLivingBase entityliving, ItemStack itemStack)
|
||||||
|
|
@ -13,6 +13,7 @@ public class Version {
|
||||||
private static String minor;
|
private static String minor;
|
||||||
private static String rev;
|
private static String rev;
|
||||||
private static String build;
|
private static String build;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static String mcversion;
|
private static String mcversion;
|
||||||
|
|
||||||
static void init(Properties properties)
|
static void init(Properties properties)
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest.client;
|
package cpw.mods.ironchest.client;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.ChestItemRenderHelper;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererChestHelper;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
@ -24,7 +24,7 @@ public class ClientProxy extends CommonProxy {
|
||||||
@Override
|
@Override
|
||||||
public void registerRenderInformation()
|
public void registerRenderInformation()
|
||||||
{
|
{
|
||||||
ChestItemRenderHelper.instance = new IronChestRenderHelper();
|
TileEntityRendererChestHelper.instance = new IronChestRenderHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -42,7 +42,7 @@ public class ClientProxy extends CommonProxy {
|
||||||
@Override
|
@Override
|
||||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
if (te != null && te instanceof TileEntityIronChest)
|
if (te != null && te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
|
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
|
||||||
|
|
@ -17,7 +17,7 @@ import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import cpw.mods.ironchest.ContainerIronChestBase;
|
import cpw.mods.ironchest.ContainerIronChest;
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class GUIChest extends GuiContainer {
|
||||||
|
|
||||||
protected Container makeContainer(IInventory player, IInventory chest)
|
protected Container makeContainer(IInventory player, IInventory chest)
|
||||||
{
|
{
|
||||||
return new ContainerIronChestBase(player, chest, mainType, xSize, ySize);
|
return new ContainerIronChest(player, chest, mainType, xSize, ySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GUIChest buildGUI(IronChestType type, IInventory playerInventory, TileEntityIronChest chestInventory)
|
public static GUIChest buildGUI(IronChestType type, IInventory playerInventory, TileEntityIronChest chestInventory)
|
||||||
|
|
@ -11,18 +11,15 @@
|
||||||
package cpw.mods.ironchest.client;
|
package cpw.mods.ironchest.client;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.ChestItemRenderHelper;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererChestHelper;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import cpw.mods.ironchest.IronChest;
|
import cpw.mods.ironchest.IronChest;
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
|
||||||
public class IronChestRenderHelper extends ChestItemRenderHelper {
|
public class IronChestRenderHelper extends TileEntityRendererChestHelper {
|
||||||
private Map<Integer, TileEntityIronChest> itemRenders = Maps.newHashMap();
|
private Map<Integer, TileEntityIronChest> itemRenders = Maps.newHashMap();
|
||||||
|
|
||||||
public IronChestRenderHelper()
|
public IronChestRenderHelper()
|
||||||
|
|
@ -38,7 +35,7 @@ public class IronChestRenderHelper extends ChestItemRenderHelper {
|
||||||
{
|
{
|
||||||
if (block == IronChest.ironChestBlock)
|
if (block == IronChest.ironChestBlock)
|
||||||
{
|
{
|
||||||
TileEntityRenderer.instance.renderTileEntityAt(itemRenders.get(i), 0.0D, 0.0D, 0.0D, 0.0F);
|
TileEntityRendererDispatcher.instance.renderTileEntityAt(itemRenders.get(i), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -18,11 +18,9 @@ import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||||
import static org.lwjgl.opengl.GL11.glScalef;
|
import static org.lwjgl.opengl.GL11.glScalef;
|
||||||
import static org.lwjgl.opengl.GL11.glTranslatef;
|
import static org.lwjgl.opengl.GL11.glTranslatef;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelChest;
|
import net.minecraft.client.model.ModelChest;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.entity.RenderItem;
|
import net.minecraft.client.renderer.entity.RenderItem;
|
||||||
|
|
@ -32,16 +30,15 @@ import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableMap.Builder;
|
import com.google.common.collect.ImmutableMap.Builder;
|
||||||
import com.google.common.primitives.SignedBytes;
|
import com.google.common.primitives.SignedBytes;
|
||||||
|
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import cpw.mods.ironchest.MappableItemStackWrapper;
|
import cpw.mods.ironchest.MappableItemStackWrapper;
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
|
||||||
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static Map<MappableItemStackWrapper, Integer> renderList = new HashMap<MappableItemStackWrapper, Integer>();
|
private static Map<MappableItemStackWrapper, Integer> renderList = new HashMap<MappableItemStackWrapper, Integer>();
|
||||||
|
|
||||||
private static Map<IronChestType, ResourceLocation> locations;
|
private static Map<IronChestType, ResourceLocation> locations;
|
||||||
|
|
@ -54,6 +51,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
}
|
}
|
||||||
private Random random;
|
private Random random;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private RenderBlocks renderBlocks;
|
private RenderBlocks renderBlocks;
|
||||||
|
|
||||||
private RenderItem itemRenderer;
|
private RenderItem itemRenderer;
|
||||||
|
|
@ -68,11 +66,11 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
renderBlocks = new RenderBlocks();
|
renderBlocks = new RenderBlocks();
|
||||||
itemRenderer = new RenderItem() {
|
itemRenderer = new RenderItem() {
|
||||||
@Override
|
@Override
|
||||||
public byte getMiniBlockCount(ItemStack stack) {
|
public byte getMiniBlockCount(ItemStack stack, byte original) {
|
||||||
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 15) + 1);
|
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 15) + 1);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public byte getMiniItemCount(ItemStack stack) {
|
public byte getMiniItemCount(ItemStack stack, byte original) {
|
||||||
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 7) + 1);
|
return SignedBytes.saturatedCast(Math.min(stack.stackSize / 32, 7) + 1);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -93,7 +91,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
}
|
}
|
||||||
int facing = 3;
|
int facing = 3;
|
||||||
IronChestType type = tile.getType();
|
IronChestType type = tile.getType();
|
||||||
if (tile != null && tile.getWorldObj() != null) {
|
if (tile != null && tile.hasWorldObj()) {
|
||||||
facing = tile.getFacing();
|
facing = tile.getFacing();
|
||||||
type = tile.getType();
|
type = tile.getType();
|
||||||
int typ = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
int typ = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||||
|
|
@ -130,7 +128,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
if (type.isTransparent() && tile.getDistanceFrom(this.tileEntityRenderer.playerX, this.tileEntityRenderer.playerY, this.tileEntityRenderer.playerZ) < 128d) {
|
if (type.isTransparent() && tile.getDistanceFrom(this.field_147501_a.field_147560_j, this.field_147501_a.field_147561_k, this.field_147501_a.field_147558_l) < 128d) {
|
||||||
random.setSeed(254L);
|
random.setSeed(254L);
|
||||||
float shiftX;
|
float shiftX;
|
||||||
float shiftY;
|
float shiftY;
|
||||||
|
|
@ -145,7 +143,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glDisable(2896 /* GL_LIGHTING */);
|
glDisable(2896 /* GL_LIGHTING */);
|
||||||
glTranslatef((float) x, (float) y, (float) z);
|
glTranslatef((float) x, (float) y, (float) z);
|
||||||
EntityItem customitem = new EntityItem(tileEntityRenderer.worldObj);
|
EntityItem customitem = new EntityItem(field_147501_a.field_147550_f);
|
||||||
customitem.hoverStart = 0f;
|
customitem.hoverStart = 0f;
|
||||||
for (ItemStack item : tile.getTopItemStacks()) {
|
for (ItemStack item : tile.getTopItemStacks()) {
|
||||||
if (shift > shifts.length) {
|
if (shift > shifts.length) {
|
||||||
|
|
@ -164,7 +162,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
glRotatef(timeD, 0.0F, 1.0F, 0.0F);
|
glRotatef(timeD, 0.0F, 1.0F, 0.0F);
|
||||||
glScalef(blockScale, blockScale, blockScale);
|
glScalef(blockScale, blockScale, blockScale);
|
||||||
customitem.setEntityItemStack(item);
|
customitem.setEntityItemStack(item);
|
||||||
itemRenderer.doRenderItem(customitem, 0, 0, 0, 0, 0);
|
itemRenderer.doRender(customitem, 0, 0, 0, 0, 0);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
glEnable(2896 /* GL_LIGHTING */);
|
glEnable(2896 /* GL_LIGHTING */);
|
||||||
|
|
@ -173,6 +171,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTick)
|
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTick)
|
||||||
{
|
{
|
||||||
render((TileEntityIronChest) tileentity, x, y, z, partialTick);
|
render((TileEntityIronChest) tileentity, x, y, z, partialTick);
|
||||||
|
Before Width: | Height: | Size: 679 B After Width: | Height: | Size: 679 B |
|
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
|
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 546 B |
|
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 382 B |
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 762 B |
|
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 719 B |
|
Before Width: | Height: | Size: 572 B After Width: | Height: | Size: 572 B |
|
Before Width: | Height: | Size: 784 B After Width: | Height: | Size: 784 B |
|
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 726 B |
|
Before Width: | Height: | Size: 572 B After Width: | Height: | Size: 572 B |
|
Before Width: | Height: | Size: 787 B After Width: | Height: | Size: 787 B |
|
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 726 B |
|
Before Width: | Height: | Size: 572 B After Width: | Height: | Size: 572 B |
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 593 B After Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 625 B After Width: | Height: | Size: 625 B |
|
Before Width: | Height: | Size: 608 B After Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 527 B |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 418 B |
|
Before Width: | Height: | Size: 466 B After Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 526 B |
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 526 B |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
|
@ -3,8 +3,8 @@
|
||||||
"modid": "IronChest",
|
"modid": "IronChest",
|
||||||
"name": "Iron Chest",
|
"name": "Iron Chest",
|
||||||
"description": "New chests with larger sizes, with in-place upgrade items.\nThe feature chest is the crystal chest, which is transparent - some inventory contents are visible without opening the chest",
|
"description": "New chests with larger sizes, with in-place upgrade items.\nThe feature chest is the crystal chest, which is transparent - some inventory contents are visible without opening the chest",
|
||||||
"version": "@VERSION@",
|
"version": "${version}",
|
||||||
"mcversion": "1.6.2",
|
"mcversion": ${mcversion}",
|
||||||
"url": "http://www.minecraftforum.net/topic/981855-",
|
"url": "http://www.minecraftforum.net/topic/981855-",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
"authors": [
|
"authors": [
|
||||||