Updated MCP
This commit is contained in:
parent
a4669540b6
commit
9fd053a0f4
|
@ -11,6 +11,7 @@
|
|||
package cpw.mods.ironchest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -34,6 +35,7 @@ import net.minecraft.util.MathHelper;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import static net.minecraftforge.common.ForgeDirection.*;
|
||||
|
||||
public class BlockIronChest extends BlockContainer {
|
||||
|
||||
|
@ -108,7 +110,7 @@ public class BlockIronChest extends BlockContainer {
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Icon getBlockTextureFromSideAndMetadata(int i, int j)
|
||||
public Icon getIcon(int i, int j)
|
||||
{
|
||||
if (j < IronChestType.values().length)
|
||||
{
|
||||
|
@ -276,4 +278,30 @@ public class BlockIronChest extends BlockContainer {
|
|||
typ.makeIcons(par1IconRegister);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ForgeDirection[] validRotationAxes = new ForgeDirection[] { UP, DOWN };
|
||||
@Override
|
||||
public ForgeDirection[] getValidRotations(World worldObj, int x, int y, int z)
|
||||
{
|
||||
return validRotationAxes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis)
|
||||
{
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (axis == UP || axis == DOWN)
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getBlockTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityIronChest) {
|
||||
TileEntityIronChest icte = (TileEntityIronChest) tileEntity;
|
||||
icte.rotateAround(axis);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class IronChest {
|
|||
{
|
||||
LanguageRegistry.instance().addStringLocalization("item." + typ.itemName + ".name", "en_US", typ.descriptiveName);
|
||||
}
|
||||
IronChestType.generateTieredRecipes(ironChestBlock);
|
||||
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
||||
ChestChangerType.generateRecipes();
|
||||
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
|
||||
proxy.registerRenderInformation();
|
||||
|
|
|
@ -98,13 +98,15 @@ public enum IronChestType {
|
|||
{
|
||||
}
|
||||
|
||||
public static void generateTieredRecipes(BlockIronChest blockResult)
|
||||
public static void registerBlocksAndRecipes(BlockIronChest blockResult)
|
||||
{
|
||||
ItemStack previous = new ItemStack(Block.chest);
|
||||
for (IronChestType typ : values())
|
||||
{
|
||||
generateRecipesForType(blockResult, previous, typ);
|
||||
if (typ.tieredChest) previous = new ItemStack(blockResult, 1, typ.ordinal());
|
||||
ItemStack chest = new ItemStack(blockResult, 1, typ.ordinal());
|
||||
if (typ.isValidForCreativeMode()) GameRegistry.registerCustomItemStack(typ.friendlyName, chest);
|
||||
if (typ.tieredChest) previous = chest;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ public class ItemChestChanger extends Item {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateIcons(IconRegister par1IconRegister)
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
this.iconIndex = par1IconRegister.registerIcon("ironchest:"+type.itemName);
|
||||
this.itemIcon = par1IconRegister.registerIcon("ironchest:"+type.itemName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.nbt.NBTTagList;
|
|||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||
private int ticksSinceSync = -1;
|
||||
|
@ -509,4 +510,10 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void rotateAround(ForgeDirection axis)
|
||||
{
|
||||
setFacing((byte)ForgeDirection.getOrientation(facing).getRotation(axis).ordinal());
|
||||
worldObj.addBlockEvent(xCoord, yCoord, zCoord, IronChest.ironChestBlock.blockID, 2, getFacing());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue