Clean up some code including how we register Blocks/Items, and fix issues getting the item from the registry.
This commit is contained in:
parent
282505120e
commit
9aecbfbf46
|
@ -13,7 +13,7 @@ package cpw.mods.ironchest;
|
|||
import java.util.Properties;
|
||||
|
||||
import cpw.mods.ironchest.common.CommonProxy;
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.lib.BlockLists;
|
||||
import cpw.mods.ironchest.common.network.MessageCrystalChestSync;
|
||||
import cpw.mods.ironchest.common.network.MessageCrystalShulkerSync;
|
||||
import cpw.mods.ironchest.common.util.MissingMappingsHandler;
|
||||
|
@ -57,8 +57,6 @@ public class IronChest
|
|||
event.getModMetadata().version = String.format("%s.%s.%s build %s", major, minor, rev, build);
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ICContent());
|
||||
|
||||
proxy.preInit();
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||
|
@ -74,6 +72,8 @@ public class IronChest
|
|||
int messageId = 0;
|
||||
packetHandler.registerMessage(MessageCrystalChestSync.Handler.class, MessageCrystalChestSync.class, messageId++, Side.CLIENT);
|
||||
packetHandler.registerMessage(MessageCrystalShulkerSync.Handler.class, MessageCrystalShulkerSync.class, messageId++, Side.CLIENT);
|
||||
|
||||
BlockLists.createShulkerItemList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ import java.util.Random;
|
|||
|
||||
import com.google.common.primitives.SignedBytes;
|
||||
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.blocks.chest.BlockIronChest;
|
||||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.tileentity.chest.TileEntityIronChest;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -61,7 +61,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
|||
EnumFacing facing = EnumFacing.SOUTH;
|
||||
IronChestType type = te.getType();
|
||||
|
||||
if (te.hasWorld() && te.getWorld().getBlockState(te.getPos()).getBlock() == ICContent.ironChestBlock)
|
||||
if (te.hasWorld() && te.getWorld().getBlockState(te.getPos()).getBlock() == IronChestBlocks.ironChestBlock)
|
||||
{
|
||||
facing = te.getFacing();
|
||||
IBlockState state = te.getWorld().getBlockState(te.getPos());
|
||||
|
|
|
@ -1,230 +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
|
||||
* <p>
|
||||
* Contributors:
|
||||
* cpw - initial API and implementation
|
||||
******************************************************************************/
|
||||
package cpw.mods.ironchest.common;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.blocks.chest.BlockIronChest;
|
||||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.blocks.shulker.BlockIronShulkerBox;
|
||||
import cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType;
|
||||
import cpw.mods.ironchest.common.items.ChestChangerType;
|
||||
import cpw.mods.ironchest.common.items.ShulkerBoxChangerType;
|
||||
import cpw.mods.ironchest.common.items.chest.ItemIronChest;
|
||||
import cpw.mods.ironchest.common.items.shulker.ItemIronShulkerBox;
|
||||
import cpw.mods.ironchest.common.lib.BlockLists;
|
||||
import cpw.mods.ironchest.common.util.BlockNames;
|
||||
import cpw.mods.ironchest.common.util.CreativeTab;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.event.RegistryEvent.Register;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
@ObjectHolder(IronChest.MOD_ID)
|
||||
public class ICContent
|
||||
{
|
||||
//@formatter:off
|
||||
public static CreativeTab tabGeneral = new CreativeTab("IronChest", new ItemStack(Item.getItemFromBlock(Blocks.SLIME_BLOCK)));
|
||||
|
||||
@ObjectHolder(BlockNames.IRON_CHEST)
|
||||
public static BlockIronChest ironChestBlock = new BlockIronChest();
|
||||
|
||||
@ObjectHolder(BlockNames.IRON_CHEST)
|
||||
public static Item ironChestItemBlock = new ItemIronChest(ironChestBlock);
|
||||
|
||||
@ObjectHolder(BlockNames.WHITE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxWhiteBlock = new BlockIronShulkerBox(EnumDyeColor.WHITE);
|
||||
@ObjectHolder(BlockNames.ORANGE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxOrangeBlock = new BlockIronShulkerBox(EnumDyeColor.ORANGE);
|
||||
@ObjectHolder(BlockNames.MAGENTA_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxMagentaBlock = new BlockIronShulkerBox(EnumDyeColor.MAGENTA);
|
||||
@ObjectHolder(BlockNames.LIGHT_BLUE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxLightBlueBlock = new BlockIronShulkerBox(EnumDyeColor.LIGHT_BLUE);
|
||||
@ObjectHolder(BlockNames.YELLOW_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxYellowBlock = new BlockIronShulkerBox(EnumDyeColor.YELLOW);
|
||||
@ObjectHolder(BlockNames.LIME_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxLimeBlock = new BlockIronShulkerBox(EnumDyeColor.LIME);
|
||||
@ObjectHolder(BlockNames.PINK_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxPinkBlock = new BlockIronShulkerBox(EnumDyeColor.PINK);
|
||||
@ObjectHolder(BlockNames.GRAY_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxGrayBlock = new BlockIronShulkerBox(EnumDyeColor.GRAY);
|
||||
@ObjectHolder(BlockNames.SILVER_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxSilverBlock = new BlockIronShulkerBox(EnumDyeColor.SILVER);
|
||||
@ObjectHolder(BlockNames.CYAN_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxCyanBlock = new BlockIronShulkerBox(EnumDyeColor.CYAN);
|
||||
@ObjectHolder(BlockNames.PURPLE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxPurpleBlock = new BlockIronShulkerBox(EnumDyeColor.PURPLE);
|
||||
@ObjectHolder(BlockNames.BLUE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxBlueBlock = new BlockIronShulkerBox(EnumDyeColor.BLUE);
|
||||
@ObjectHolder(BlockNames.BROWN_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxBrownBlock = new BlockIronShulkerBox(EnumDyeColor.BROWN);
|
||||
@ObjectHolder(BlockNames.GREEN_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxGreenBlock = new BlockIronShulkerBox(EnumDyeColor.GREEN);
|
||||
@ObjectHolder(BlockNames.RED_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxRedBlock = new BlockIronShulkerBox(EnumDyeColor.RED);
|
||||
@ObjectHolder(BlockNames.BLACK_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxBlackBlock = new BlockIronShulkerBox(EnumDyeColor.BLACK);
|
||||
|
||||
@ObjectHolder(BlockNames.WHITE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxWhiteItemBlock = new ItemIronShulkerBox(ironShulkerBoxWhiteBlock, EnumDyeColor.WHITE);
|
||||
@ObjectHolder(BlockNames.ORANGE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxOrangeItemBlock = new ItemIronShulkerBox(ironShulkerBoxOrangeBlock, EnumDyeColor.ORANGE);
|
||||
@ObjectHolder(BlockNames.MAGENTA_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxMagentaItemBlock = new ItemIronShulkerBox(ironShulkerBoxMagentaBlock, EnumDyeColor.MAGENTA);
|
||||
@ObjectHolder(BlockNames.LIGHT_BLUE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxLightBlueItemBlock = new ItemIronShulkerBox(ironShulkerBoxLightBlueBlock, EnumDyeColor.LIGHT_BLUE);
|
||||
@ObjectHolder(BlockNames.YELLOW_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxYellowItemBlock = new ItemIronShulkerBox(ironShulkerBoxYellowBlock, EnumDyeColor.YELLOW);
|
||||
@ObjectHolder(BlockNames.LIME_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxLimeItemBlock = new ItemIronShulkerBox(ironShulkerBoxLimeBlock, EnumDyeColor.LIME);
|
||||
@ObjectHolder(BlockNames.PINK_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxPinkItemBlock = new ItemIronShulkerBox(ironShulkerBoxPinkBlock, EnumDyeColor.PINK);
|
||||
@ObjectHolder(BlockNames.GRAY_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxGrayItemBlock = new ItemIronShulkerBox(ironShulkerBoxGrayBlock, EnumDyeColor.GRAY);
|
||||
@ObjectHolder(BlockNames.SILVER_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxSilverItemBlock = new ItemIronShulkerBox(ironShulkerBoxSilverBlock, EnumDyeColor.SILVER);
|
||||
@ObjectHolder(BlockNames.CYAN_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxCyanItemBlock = new ItemIronShulkerBox(ironShulkerBoxCyanBlock, EnumDyeColor.CYAN);
|
||||
@ObjectHolder(BlockNames.PURPLE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxPurpleItemBlock = new ItemIronShulkerBox(ironShulkerBoxPurpleBlock, EnumDyeColor.PURPLE);
|
||||
@ObjectHolder(BlockNames.BLUE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxBlueItemBlock = new ItemIronShulkerBox(ironShulkerBoxBlueBlock, EnumDyeColor.BLUE);
|
||||
@ObjectHolder(BlockNames.BROWN_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxBrownItemBlock = new ItemIronShulkerBox(ironShulkerBoxBrownBlock, EnumDyeColor.BROWN);
|
||||
@ObjectHolder(BlockNames.GREEN_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxGreenItemBlock = new ItemIronShulkerBox(ironShulkerBoxGreenBlock, EnumDyeColor.GREEN);
|
||||
@ObjectHolder(BlockNames.RED_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxRedItemBlock = new ItemIronShulkerBox(ironShulkerBoxRedBlock, EnumDyeColor.RED);
|
||||
@ObjectHolder(BlockNames.BLACK_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxBlackItemBlock = new ItemIronShulkerBox(ironShulkerBoxBlackBlock, EnumDyeColor.BLACK);
|
||||
//@formatter:on
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerBlocks(Register<Block> event)
|
||||
{
|
||||
// Chests Start
|
||||
event.getRegistry().register(ironChestBlock);
|
||||
|
||||
for (IronChestType typ : IronChestType.VALUES)
|
||||
{
|
||||
if (typ.clazz != null)
|
||||
{
|
||||
GameRegistry.registerTileEntity(typ.clazz, "IronChest." + typ.name());
|
||||
}
|
||||
}
|
||||
|
||||
tabGeneral.setDisplayIcon(new ItemStack(ironChestBlock, 1, IronChestType.IRON.ordinal()));
|
||||
// Chests End
|
||||
|
||||
// Shulkers Start
|
||||
BlockLists.createVanillaShulkerBlockList();
|
||||
|
||||
registerShulkerBlocks(event);
|
||||
|
||||
for (IronShulkerBoxType typ : IronShulkerBoxType.VALUES)
|
||||
{
|
||||
if (typ.clazz != null)
|
||||
{
|
||||
GameRegistry.registerTileEntity(typ.clazz, "IronShulkerBox." + typ.name());
|
||||
}
|
||||
}
|
||||
|
||||
BlockLists.createIronShulkerBlockList();
|
||||
// Shulkers End
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerItems(Register<Item> event)
|
||||
{
|
||||
// Chests Start
|
||||
event.getRegistry().register(ironChestItemBlock);
|
||||
|
||||
ChestChangerType.buildItems(event);
|
||||
// Chests End
|
||||
|
||||
// Shulkers Start
|
||||
registerShulkerItemBlocks(event);
|
||||
|
||||
ShulkerBoxChangerType.buildItems(event);
|
||||
|
||||
BlockLists.createShulkerItemList();
|
||||
|
||||
BlockLists.registerBlockBehavior();
|
||||
// Shulkers End
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
// Chests Start
|
||||
Item chestItem = Item.getItemFromBlock(ICContent.ironChestBlock);
|
||||
|
||||
for (IronChestType type : IronChestType.values())
|
||||
{
|
||||
if (type != IronChestType.WOOD)
|
||||
{
|
||||
//@formatter:off
|
||||
ModelLoader.setCustomModelResourceLocation(chestItem, type.ordinal(), new ModelResourceLocation(chestItem.getRegistryName(), "variant=" + type.getName()));
|
||||
//@formatter:on
|
||||
}
|
||||
}
|
||||
|
||||
for (ChestChangerType type : ChestChangerType.VALUES)
|
||||
{
|
||||
//@formatter:off
|
||||
ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "iron_chest_upgrades"), "variant=" + type.itemName.toLowerCase()));
|
||||
//@formatter:on
|
||||
}
|
||||
// Chests End
|
||||
|
||||
// Shulkers Start
|
||||
for (Block shulker : BlockLists.SHULKER_BLOCKS)
|
||||
{
|
||||
Item shulkerBoxItem = Item.getItemFromBlock(shulker);
|
||||
|
||||
for (IronShulkerBoxType type : IronShulkerBoxType.values())
|
||||
{
|
||||
if (type != IronShulkerBoxType.VANILLA)
|
||||
{
|
||||
//@formatter:off
|
||||
ModelLoader.setCustomModelResourceLocation(shulkerBoxItem, type.ordinal(), new ModelResourceLocation(shulkerBoxItem.getRegistryName(), "variant=" + type.getName()));
|
||||
//@formatter:on
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ShulkerBoxChangerType type : ShulkerBoxChangerType.VALUES)
|
||||
{
|
||||
//@formatter:off
|
||||
ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "iron_shulker_box_upgrades"), "variant=" + type.itemName.toLowerCase()));
|
||||
//@formatter:on
|
||||
}
|
||||
// Shulker End
|
||||
}
|
||||
|
||||
private static void registerShulkerBlocks(Register<Block> event)
|
||||
{
|
||||
event.getRegistry().registerAll(ironShulkerBoxWhiteBlock, ironShulkerBoxOrangeBlock, ironShulkerBoxMagentaBlock, ironShulkerBoxLightBlueBlock, ironShulkerBoxYellowBlock, ironShulkerBoxLimeBlock, ironShulkerBoxPinkBlock, ironShulkerBoxGrayBlock, ironShulkerBoxSilverBlock, ironShulkerBoxCyanBlock, ironShulkerBoxPurpleBlock, ironShulkerBoxBlueBlock, ironShulkerBoxBrownBlock, ironShulkerBoxGreenBlock, ironShulkerBoxRedBlock, ironShulkerBoxBlackBlock);
|
||||
}
|
||||
|
||||
private static void registerShulkerItemBlocks(Register<Item> event)
|
||||
{
|
||||
event.getRegistry().registerAll(ironShulkerBoxWhiteItemBlock, ironShulkerBoxOrangeItemBlock, ironShulkerBoxMagentaItemBlock, ironShulkerBoxLightBlueItemBlock, ironShulkerBoxYellowItemBlock, ironShulkerBoxLimeItemBlock, ironShulkerBoxPinkItemBlock, ironShulkerBoxGrayItemBlock, ironShulkerBoxSilverItemBlock, ironShulkerBoxCyanItemBlock, ironShulkerBoxPurpleItemBlock, ironShulkerBoxBlueItemBlock, ironShulkerBoxBrownItemBlock, ironShulkerBoxGreenItemBlock, ironShulkerBoxRedItemBlock, ironShulkerBoxBlackItemBlock);
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
******************************************************************************/
|
||||
package cpw.mods.ironchest.common.ai;
|
||||
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.tileentity.chest.TileEntityIronChest;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -42,7 +42,7 @@ public class IronChestAIOcelotSit extends EntityAIOcelotSit
|
|||
IBlockState iblockstate = worldIn.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (block == ICContent.ironChestBlock)
|
||||
if (block == IronChestBlocks.ironChestBlock)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ package cpw.mods.ironchest.common.blocks.chest;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.core.IronChestCreativeTabs;
|
||||
import cpw.mods.ironchest.common.tileentity.chest.TileEntityIronChest;
|
||||
import cpw.mods.ironchest.common.util.BlockNames;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -53,11 +53,11 @@ public class BlockIronChest extends Block
|
|||
{
|
||||
super(Material.IRON);
|
||||
|
||||
this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, BlockNames.IRON_CHEST));
|
||||
this.setRegistryName(new ResourceLocation(BlockNames.IRON_CHEST));
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronChestType.IRON));
|
||||
this.setHardness(3.0F);
|
||||
this.setUnlocalizedName("IronChest");
|
||||
this.setCreativeTab(ICContent.tabGeneral);
|
||||
this.setCreativeTab(IronChestCreativeTabs.tabIronChests);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,8 @@ import java.util.List;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.core.IronChestCreativeTabs;
|
||||
import cpw.mods.ironchest.common.tileentity.shulker.TileEntityIronShulkerBox;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.EnumPushReaction;
|
||||
|
@ -40,7 +41,6 @@ import net.minecraft.util.EnumBlockRenderType;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
@ -55,19 +55,21 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
public class BlockIronShulkerBox extends Block
|
||||
{
|
||||
public static final PropertyEnum<IronShulkerBoxType> VARIANT_PROP = PropertyEnum.create("variant", IronShulkerBoxType.class);
|
||||
|
||||
private final EnumDyeColor color;
|
||||
|
||||
private EnumFacing facingDirection;
|
||||
|
||||
public BlockIronShulkerBox(EnumDyeColor colorIn)
|
||||
public BlockIronShulkerBox(EnumDyeColor colorIn, String nameIn)
|
||||
{
|
||||
super(Material.IRON);
|
||||
|
||||
this.color = colorIn;
|
||||
this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "iron_shulker_box_" + colorIn.getName()));
|
||||
this.setRegistryName(nameIn);
|
||||
this.setUnlocalizedName("IronShulkerBox" + colorIn.getName());
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, IronShulkerBoxType.IRON));
|
||||
this.setHardness(3.0F);
|
||||
this.setCreativeTab(ICContent.tabGeneral);
|
||||
this.setCreativeTab(IronChestCreativeTabs.tabIronChests);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -459,38 +461,38 @@ public class BlockIronShulkerBox extends Block
|
|||
switch (colorIn)
|
||||
{
|
||||
case WHITE:
|
||||
return ICContent.ironShulkerBoxWhiteBlock;
|
||||
return IronChestBlocks.ironShulkerBoxWhiteBlock;
|
||||
case ORANGE:
|
||||
return ICContent.ironShulkerBoxOrangeBlock;
|
||||
return IronChestBlocks.ironShulkerBoxOrangeBlock;
|
||||
case MAGENTA:
|
||||
return ICContent.ironShulkerBoxMagentaBlock;
|
||||
return IronChestBlocks.ironShulkerBoxMagentaBlock;
|
||||
case LIGHT_BLUE:
|
||||
return ICContent.ironShulkerBoxLightBlueBlock;
|
||||
return IronChestBlocks.ironShulkerBoxLightBlueBlock;
|
||||
case YELLOW:
|
||||
return ICContent.ironShulkerBoxYellowBlock;
|
||||
return IronChestBlocks.ironShulkerBoxYellowBlock;
|
||||
case LIME:
|
||||
return ICContent.ironShulkerBoxLimeBlock;
|
||||
return IronChestBlocks.ironShulkerBoxLimeBlock;
|
||||
case PINK:
|
||||
return ICContent.ironShulkerBoxPinkBlock;
|
||||
return IronChestBlocks.ironShulkerBoxPinkBlock;
|
||||
case GRAY:
|
||||
return ICContent.ironShulkerBoxGrayBlock;
|
||||
return IronChestBlocks.ironShulkerBoxGrayBlock;
|
||||
case SILVER:
|
||||
return ICContent.ironShulkerBoxSilverBlock;
|
||||
return IronChestBlocks.ironShulkerBoxSilverBlock;
|
||||
case CYAN:
|
||||
return ICContent.ironShulkerBoxCyanBlock;
|
||||
return IronChestBlocks.ironShulkerBoxCyanBlock;
|
||||
case PURPLE:
|
||||
default:
|
||||
return ICContent.ironShulkerBoxPurpleBlock;
|
||||
return IronChestBlocks.ironShulkerBoxPurpleBlock;
|
||||
case BLUE:
|
||||
return ICContent.ironShulkerBoxBlueBlock;
|
||||
return IronChestBlocks.ironShulkerBoxBlueBlock;
|
||||
case BROWN:
|
||||
return ICContent.ironShulkerBoxBrownBlock;
|
||||
return IronChestBlocks.ironShulkerBoxBrownBlock;
|
||||
case GREEN:
|
||||
return ICContent.ironShulkerBoxGreenBlock;
|
||||
return IronChestBlocks.ironShulkerBoxGreenBlock;
|
||||
case RED:
|
||||
return ICContent.ironShulkerBoxRedBlock;
|
||||
return IronChestBlocks.ironShulkerBoxRedBlock;
|
||||
case BLACK:
|
||||
return ICContent.ironShulkerBoxBlackBlock;
|
||||
return IronChestBlocks.ironShulkerBoxBlackBlock;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -521,4 +523,4 @@ public class BlockIronShulkerBox extends Block
|
|||
|
||||
return tileentity != null && tileentity.receiveClientEvent(id, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
package cpw.mods.ironchest.common.core;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.blocks.chest.BlockIronChest;
|
||||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.blocks.shulker.BlockIronShulkerBox;
|
||||
import cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType;
|
||||
import cpw.mods.ironchest.common.items.chest.ItemIronChest;
|
||||
import cpw.mods.ironchest.common.items.shulker.ItemIronShulkerBox;
|
||||
import cpw.mods.ironchest.common.lib.BlockLists;
|
||||
import cpw.mods.ironchest.common.util.BlockNames;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.event.RegistryEvent.Register;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
public class IronChestBlocks
|
||||
{
|
||||
@ObjectHolder(BlockNames.IRON_CHEST)
|
||||
public static BlockIronChest ironChestBlock;
|
||||
|
||||
@ObjectHolder(BlockNames.IRON_CHEST)
|
||||
public static Item ironChestItemBlock;
|
||||
|
||||
//@formatter:off
|
||||
@ObjectHolder(BlockNames.WHITE_SHULKER)
|
||||
public static final BlockIronShulkerBox ironShulkerBoxWhiteBlock = null;
|
||||
@ObjectHolder(BlockNames.ORANGE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxOrangeBlock;
|
||||
@ObjectHolder(BlockNames.MAGENTA_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxMagentaBlock;
|
||||
@ObjectHolder(BlockNames.LIGHT_BLUE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxLightBlueBlock;
|
||||
@ObjectHolder(BlockNames.YELLOW_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxYellowBlock;
|
||||
@ObjectHolder(BlockNames.LIME_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxLimeBlock;
|
||||
@ObjectHolder(BlockNames.PINK_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxPinkBlock;
|
||||
@ObjectHolder(BlockNames.GRAY_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxGrayBlock;
|
||||
@ObjectHolder(BlockNames.SILVER_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxSilverBlock;
|
||||
@ObjectHolder(BlockNames.CYAN_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxCyanBlock;
|
||||
@ObjectHolder(BlockNames.PURPLE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxPurpleBlock;
|
||||
@ObjectHolder(BlockNames.BLUE_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxBlueBlock;
|
||||
@ObjectHolder(BlockNames.BROWN_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxBrownBlock;
|
||||
@ObjectHolder(BlockNames.GREEN_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxGreenBlock;
|
||||
@ObjectHolder(BlockNames.RED_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxRedBlock;
|
||||
@ObjectHolder(BlockNames.BLACK_SHULKER)
|
||||
public static BlockIronShulkerBox ironShulkerBoxBlackBlock;
|
||||
|
||||
@ObjectHolder(BlockNames.WHITE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxWhiteItemBlock;
|
||||
@ObjectHolder(BlockNames.ORANGE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxOrangeItemBlock;
|
||||
@ObjectHolder(BlockNames.MAGENTA_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxMagentaItemBlock;
|
||||
@ObjectHolder(BlockNames.LIGHT_BLUE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxLightBlueItemBlock;
|
||||
@ObjectHolder(BlockNames.YELLOW_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxYellowItemBlock;
|
||||
@ObjectHolder(BlockNames.LIME_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxLimeItemBlock;
|
||||
@ObjectHolder(BlockNames.PINK_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxPinkItemBlock;
|
||||
@ObjectHolder(BlockNames.GRAY_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxGrayItemBlock;
|
||||
@ObjectHolder(BlockNames.SILVER_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxSilverItemBlock;
|
||||
@ObjectHolder(BlockNames.CYAN_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxCyanItemBlock;
|
||||
@ObjectHolder(BlockNames.PURPLE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxPurpleItemBlock;
|
||||
@ObjectHolder(BlockNames.BLUE_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxBlueItemBlock;
|
||||
@ObjectHolder(BlockNames.BROWN_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxBrownItemBlock;
|
||||
@ObjectHolder(BlockNames.GREEN_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxGreenItemBlock;
|
||||
@ObjectHolder(BlockNames.RED_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxRedItemBlock;
|
||||
@ObjectHolder(BlockNames.BLACK_SHULKER)
|
||||
public static ItemIronShulkerBox ironShulkerBoxBlackItemBlock;
|
||||
//@formatter:on
|
||||
|
||||
@EventBusSubscriber(modid = IronChest.MOD_ID)
|
||||
public static class Registration
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(Register<Block> event)
|
||||
{
|
||||
IForgeRegistry<Block> blockRegistry = event.getRegistry();
|
||||
|
||||
// Chest Start
|
||||
blockRegistry.register(new BlockIronChest());
|
||||
|
||||
for (IronChestType typ : IronChestType.VALUES)
|
||||
{
|
||||
if (typ.clazz != null)
|
||||
{
|
||||
GameRegistry.registerTileEntity(typ.clazz, "IronChest." + typ.name());
|
||||
}
|
||||
}
|
||||
// Chest End
|
||||
|
||||
// Shulker Start
|
||||
for (EnumDyeColor color : EnumDyeColor.values())
|
||||
{
|
||||
blockRegistry.register(new BlockIronShulkerBox(color, BlockNames.SHULKER_NAMES[color.getMetadata()]));
|
||||
}
|
||||
|
||||
for (IronShulkerBoxType typ : IronShulkerBoxType.VALUES)
|
||||
{
|
||||
if (typ.clazz != null)
|
||||
{
|
||||
GameRegistry.registerTileEntity(typ.clazz, "IronShulkerBox." + typ.name());
|
||||
}
|
||||
}
|
||||
// Shulker End
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(Register<Item> event)
|
||||
{
|
||||
BlockLists.createIronShulkerBlockList();
|
||||
|
||||
IForgeRegistry<Item> itemRegistry = event.getRegistry();
|
||||
|
||||
// Chest Start
|
||||
itemRegistry.register(new ItemIronChest(IronChestBlocks.ironChestBlock));
|
||||
// Chest End
|
||||
|
||||
// Shulker Start
|
||||
for (EnumDyeColor color : EnumDyeColor.values())
|
||||
{
|
||||
itemRegistry.register(new ItemIronShulkerBox(BlockLists.SHULKER_BLOCKS.get(color.getMetadata()), color));
|
||||
}
|
||||
// Shulker End
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
// Chest Start
|
||||
Item chestItem = Item.getItemFromBlock(IronChestBlocks.ironChestBlock);
|
||||
|
||||
for (IronChestType type : IronChestType.values())
|
||||
{
|
||||
if (type != IronChestType.WOOD)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(chestItem, type.ordinal(), new ModelResourceLocation(chestItem.getRegistryName(), "variant=" + type.getName()));
|
||||
}
|
||||
}
|
||||
// Chest End
|
||||
|
||||
// Shulker Start
|
||||
for (Block shulker : BlockLists.SHULKER_BLOCKS)
|
||||
{
|
||||
Item shulkerBoxItem = Item.getItemFromBlock(shulker);
|
||||
|
||||
for (IronShulkerBoxType type : IronShulkerBoxType.values())
|
||||
{
|
||||
if (type != IronShulkerBoxType.VANILLA)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(shulkerBoxItem, type.ordinal(), new ModelResourceLocation(shulkerBoxItem.getRegistryName(), "variant=" + type.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Shulker End
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package cpw.mods.ironchest.common.core;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.util.CreativeTabItems;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public final class IronChestCreativeTabs
|
||||
{
|
||||
private IronChestCreativeTabs()
|
||||
{
|
||||
}
|
||||
|
||||
public static final CreativeTabs tabIronChests = new CreativeTabs("ironchest")
|
||||
{
|
||||
@Override
|
||||
@Nonnull
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem()
|
||||
{
|
||||
return new ItemStack(Item.getItemFromBlock(IronChestBlocks.ironChestBlock), 1, IronChestType.IRON.ordinal());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void displayAllRelevantItems(NonNullList<ItemStack> listIn)
|
||||
{
|
||||
CreativeTabItems.getSubItems(listIn);
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package cpw.mods.ironchest.common.core;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.items.ChestChangerType;
|
||||
import cpw.mods.ironchest.common.items.ShulkerBoxChangerType;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.event.RegistryEvent.Register;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
public class IronChestItems
|
||||
{
|
||||
@EventBusSubscriber(modid = IronChest.MOD_ID)
|
||||
public static class Registration
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerItems(Register<Item> event)
|
||||
{
|
||||
IForgeRegistry<Item> itemRegistry = event.getRegistry();
|
||||
|
||||
// Chest Start
|
||||
ChestChangerType.buildItems(itemRegistry);
|
||||
// Chest End
|
||||
|
||||
// Shulker Start
|
||||
ShulkerBoxChangerType.buildItems(itemRegistry);
|
||||
// Shulker End
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
// Chest Start
|
||||
for (ChestChangerType type : ChestChangerType.VALUES)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "iron_chest_upgrades"), "variant=" + type.itemName.toLowerCase()));
|
||||
}
|
||||
// Chest End
|
||||
|
||||
// Shulker Start
|
||||
for (ShulkerBoxChangerType type : ShulkerBoxChangerType.VALUES)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(type.item, 0, new ModelResourceLocation(new ResourceLocation(IronChest.MOD_ID, "iron_shulker_box_upgrades"), "variant=" + type.itemName.toLowerCase()));
|
||||
}
|
||||
// Shulker End
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* cpw - initial API and implementation
|
||||
******************************************************************************/
|
||||
package cpw.mods.ironchest.common.crafting;
|
||||
package cpw.mods.ironchest.common.crafting.condition;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* cpw - initial API and implementation
|
||||
******************************************************************************/
|
||||
package cpw.mods.ironchest.common.crafting;
|
||||
package cpw.mods.ironchest.common.crafting.recipe;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* cpw - initial API and implementation
|
||||
******************************************************************************/
|
||||
package cpw.mods.ironchest.common.crafting;
|
||||
package cpw.mods.ironchest.common.crafting.recipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
|
@ -18,7 +18,7 @@ import static cpw.mods.ironchest.common.blocks.chest.IronChestType.WOOD;
|
|||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.items.chest.ItemChestChanger;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.event.RegistryEvent.Register;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
public enum ChestChangerType
|
||||
{
|
||||
|
@ -56,22 +56,22 @@ public enum ChestChangerType
|
|||
return from == this.source;
|
||||
}
|
||||
|
||||
public ItemChestChanger buildItem(Register<Item> event)
|
||||
public ItemChestChanger buildItem(IForgeRegistry<Item> itemRegistry)
|
||||
{
|
||||
this.item = new ItemChestChanger(this);
|
||||
|
||||
this.item.setRegistryName(this.itemName);
|
||||
|
||||
event.getRegistry().register(this.item);
|
||||
itemRegistry.register(this.item);
|
||||
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public static void buildItems(Register<Item> event)
|
||||
public static void buildItems(IForgeRegistry<Item> itemRegistry)
|
||||
{
|
||||
for (ChestChangerType type : VALUES)
|
||||
{
|
||||
type.buildItem(event);
|
||||
type.buildItem(itemRegistry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import static cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType.VANILL
|
|||
import cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType;
|
||||
import cpw.mods.ironchest.common.items.shulker.ItemShulkerBoxChanger;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.event.RegistryEvent.Register;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
public enum ShulkerBoxChangerType
|
||||
{
|
||||
|
@ -56,22 +56,22 @@ public enum ShulkerBoxChangerType
|
|||
return from == this.source;
|
||||
}
|
||||
|
||||
public ItemShulkerBoxChanger buildItem(Register<Item> event)
|
||||
public ItemShulkerBoxChanger buildItem(IForgeRegistry<Item> itemRegistry)
|
||||
{
|
||||
this.item = new ItemShulkerBoxChanger(this);
|
||||
|
||||
this.item.setRegistryName(this.itemName);
|
||||
|
||||
event.getRegistry().register(this.item);
|
||||
itemRegistry.register(this.item);
|
||||
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public static void buildItems(Register<Item> event)
|
||||
public static void buildItems(IForgeRegistry<Item> itemRegistry)
|
||||
{
|
||||
for (ShulkerBoxChangerType type : VALUES)
|
||||
{
|
||||
type.buildItem(event);
|
||||
type.buildItem(itemRegistry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ package cpw.mods.ironchest.common.items.chest;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.blocks.chest.BlockIronChest;
|
||||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.core.IronChestCreativeTabs;
|
||||
import cpw.mods.ironchest.common.items.ChestChangerType;
|
||||
import cpw.mods.ironchest.common.tileentity.chest.TileEntityIronChest;
|
||||
import cpw.mods.ironchest.common.util.ItemTooltip;
|
||||
|
@ -40,7 +41,7 @@ public class ItemChestChanger extends ItemTooltip
|
|||
this.type = type;
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("ironchest.chest." + type.name().toLowerCase(Locale.US));
|
||||
this.setCreativeTab(ICContent.tabGeneral);
|
||||
this.setCreativeTab(IronChestCreativeTabs.tabIronChests);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +69,7 @@ public class ItemChestChanger extends ItemTooltip
|
|||
else
|
||||
{
|
||||
//@formatter:off
|
||||
if (worldIn.getBlockState(pos) != ICContent.ironChestBlock.getStateFromMeta(IronChestType.valueOf(this.type.source.getName().toUpperCase()).ordinal()))
|
||||
if (worldIn.getBlockState(pos) != IronChestBlocks.ironChestBlock.getStateFromMeta(IronChestType.valueOf(this.type.source.getName().toUpperCase()).ordinal()))
|
||||
//@formatter:on
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
|
@ -130,7 +131,7 @@ public class ItemChestChanger extends ItemTooltip
|
|||
worldIn.removeTileEntity(pos);
|
||||
worldIn.setBlockToAir(pos);
|
||||
|
||||
IBlockState iblockstate = ICContent.ironChestBlock.getDefaultState().withProperty(BlockIronChest.VARIANT_PROP, this.type.target);
|
||||
IBlockState iblockstate = IronChestBlocks.ironChestBlock.getDefaultState().withProperty(BlockIronChest.VARIANT_PROP, this.type.target);
|
||||
|
||||
worldIn.setTileEntity(pos, newchest);
|
||||
worldIn.setBlockState(pos, iblockstate, 3);
|
||||
|
|
|
@ -12,13 +12,10 @@ package cpw.mods.ironchest.common.items.chest;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.util.BlockNames;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ItemIronChest extends ItemBlock
|
||||
{
|
||||
|
@ -26,7 +23,7 @@ public class ItemIronChest extends ItemBlock
|
|||
{
|
||||
super(block);
|
||||
|
||||
this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, BlockNames.IRON_CHEST));
|
||||
this.setRegistryName(block.getRegistryName());
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
|
|
@ -12,13 +12,11 @@ package cpw.mods.ironchest.common.items.shulker;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ItemIronShulkerBox extends ItemBlock
|
||||
{
|
||||
|
@ -28,7 +26,7 @@ public class ItemIronShulkerBox extends ItemBlock
|
|||
{
|
||||
super(block);
|
||||
|
||||
this.setRegistryName(new ResourceLocation(IronChest.MOD_ID, "iron_shulker_box_" + colorIn.getName()));
|
||||
this.setRegistryName(block.getRegistryName());
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxStackSize(1);
|
||||
|
@ -46,4 +44,4 @@ public class ItemIronShulkerBox extends ItemBlock
|
|||
{
|
||||
return "tile.ironchest.shulker_box." + IronShulkerBoxType.VALUES[itemstack.getMetadata()].name().toLowerCase(Locale.US) + "." + this.colorName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ package cpw.mods.ironchest.common.items.shulker;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.blocks.shulker.BlockIronShulkerBox;
|
||||
import cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType;
|
||||
import cpw.mods.ironchest.common.core.IronChestCreativeTabs;
|
||||
import cpw.mods.ironchest.common.items.ShulkerBoxChangerType;
|
||||
import cpw.mods.ironchest.common.lib.BlockLists;
|
||||
import cpw.mods.ironchest.common.tileentity.shulker.TileEntityIronShulkerBox;
|
||||
|
@ -44,7 +44,7 @@ public class ItemShulkerBoxChanger extends ItemTooltip
|
|||
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("ironchest.shulker_box." + type.name().toLowerCase(Locale.US));
|
||||
this.setCreativeTab(ICContent.tabGeneral);
|
||||
this.setCreativeTab(IronChestCreativeTabs.tabIronChests);
|
||||
}
|
||||
|
||||
public EnumDyeColor getColorFromTileEntity(TileEntity te, World worldIn)
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.util.BehaviorDispenseIronShulkerBox;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
|
@ -62,42 +62,46 @@ public class BlockLists
|
|||
|
||||
public static void createIronShulkerBlockList()
|
||||
{
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxWhiteBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxOrangeBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxMagentaBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxLightBlueBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxYellowBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxLimeBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxPinkBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxGrayBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxSilverBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxCyanBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxPurpleBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxBlueBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxBrownBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxGreenBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxRedBlock);
|
||||
SHULKER_BLOCKS.add(ICContent.ironShulkerBoxBlackBlock);
|
||||
BlockLists.createVanillaShulkerBlockList();
|
||||
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxWhiteBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxOrangeBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxMagentaBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxLightBlueBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxYellowBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxLimeBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxPinkBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxGrayBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxSilverBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxCyanBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxPurpleBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxBlueBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxBrownBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxGreenBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxRedBlock);
|
||||
SHULKER_BLOCKS.add(IronChestBlocks.ironShulkerBoxBlackBlock);
|
||||
}
|
||||
|
||||
public static void createShulkerItemList()
|
||||
{
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxWhiteItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxOrangeItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxMagentaItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxLightBlueItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxYellowItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxLimeItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxPinkItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxGrayItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxSilverItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxCyanItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxPurpleItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxBlueItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxBrownItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxGreenItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxRedItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(ICContent.ironShulkerBoxBlackItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxWhiteItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxOrangeItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxMagentaItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxLightBlueItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxYellowItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxLimeItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxPinkItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxGrayItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxSilverItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxCyanItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxPurpleItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxBlueItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxBrownItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxGreenItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxRedItemBlock);
|
||||
SHULKER_ITEM_BLOCKS.add(IronChestBlocks.ironShulkerBoxBlackItemBlock);
|
||||
|
||||
BlockLists.registerBlockBehavior();
|
||||
}
|
||||
|
||||
public static void registerBlockBehavior()
|
||||
|
|
|
@ -14,9 +14,9 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.ICContent;
|
||||
import cpw.mods.ironchest.common.blocks.chest.BlockIronChest;
|
||||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.gui.chest.ContainerIronChest;
|
||||
import cpw.mods.ironchest.common.network.MessageCrystalChestSync;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -120,7 +120,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
{
|
||||
IBlockState state = this.world.getBlockState(this.pos);
|
||||
|
||||
if (state.getBlock() == ICContent.ironChestBlock)
|
||||
if (state.getBlock() == IronChestBlocks.ironChestBlock)
|
||||
{
|
||||
type = state.getValue(BlockIronChest.VARIANT_PROP);
|
||||
}
|
||||
|
@ -160,7 +160,8 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
int compressedIdx = 0;
|
||||
|
||||
mainLoop: for (int i = 0; i < this.getSizeInventory(); i++)
|
||||
mainLoop:
|
||||
for (int i = 0; i < this.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemStack = this.getItems().get(i);
|
||||
|
||||
|
@ -210,7 +211,8 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
this.hadStuff = true;
|
||||
|
||||
Collections.sort(tempCopy, new Comparator<ItemStack>() {
|
||||
Collections.sort(tempCopy, new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
|
@ -368,7 +370,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
if (this.world != null && !this.world.isRemote && this.ticksSinceSync < 0)
|
||||
{
|
||||
this.world.addBlockEvent(this.pos, ICContent.ironChestBlock, 3, ((this.numPlayersUsing << 3) & 0xF8) | (this.facing.ordinal() & 0x7));
|
||||
this.world.addBlockEvent(this.pos, IronChestBlocks.ironChestBlock, 3, ((this.numPlayersUsing << 3) & 0xF8) | (this.facing.ordinal() & 0x7));
|
||||
}
|
||||
|
||||
if (!this.world.isRemote && this.inventoryTouched)
|
||||
|
@ -466,9 +468,9 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
++this.numPlayersUsing;
|
||||
|
||||
this.world.addBlockEvent(this.pos, ICContent.ironChestBlock, 1, this.numPlayersUsing);
|
||||
this.world.notifyNeighborsOfStateChange(this.pos, ICContent.ironChestBlock, false);
|
||||
this.world.notifyNeighborsOfStateChange(this.pos.down(), ICContent.ironChestBlock, false);
|
||||
this.world.addBlockEvent(this.pos, IronChestBlocks.ironChestBlock, 1, this.numPlayersUsing);
|
||||
this.world.notifyNeighborsOfStateChange(this.pos, IronChestBlocks.ironChestBlock, false);
|
||||
this.world.notifyNeighborsOfStateChange(this.pos.down(), IronChestBlocks.ironChestBlock, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,9 +486,9 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
|
||||
--this.numPlayersUsing;
|
||||
|
||||
this.world.addBlockEvent(this.pos, ICContent.ironChestBlock, 1, this.numPlayersUsing);
|
||||
this.world.notifyNeighborsOfStateChange(this.pos, ICContent.ironChestBlock, false);
|
||||
this.world.notifyNeighborsOfStateChange(this.pos.down(), ICContent.ironChestBlock, false);
|
||||
this.world.addBlockEvent(this.pos, IronChestBlocks.ironChestBlock, 1, this.numPlayersUsing);
|
||||
this.world.notifyNeighborsOfStateChange(this.pos, IronChestBlocks.ironChestBlock, false);
|
||||
this.world.notifyNeighborsOfStateChange(this.pos.down(), IronChestBlocks.ironChestBlock, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -554,7 +556,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
|||
{
|
||||
this.setFacing(this.facing.rotateY());
|
||||
|
||||
this.world.addBlockEvent(this.pos, ICContent.ironChestBlock, 2, this.facing.ordinal());
|
||||
this.world.addBlockEvent(this.pos, IronChestBlocks.ironChestBlock, 2, this.facing.ordinal());
|
||||
}
|
||||
|
||||
public void wasPlaced(EntityLivingBase entityliving, ItemStack stack)
|
||||
|
|
|
@ -1,38 +1,42 @@
|
|||
package cpw.mods.ironchest.common.util;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
|
||||
public class BlockNames
|
||||
{
|
||||
public static final String IRON_CHEST = "iron_chest";
|
||||
public static final String IRON_CHEST = IronChest.MOD_ID + ":iron_chest";
|
||||
|
||||
public static final String WHITE_SHULKER = "iron_shulker_box_white";
|
||||
public static final String WHITE_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_white";
|
||||
|
||||
public static final String ORANGE_SHULKER = "iron_shulker_box_orange";
|
||||
public static final String ORANGE_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_orange";
|
||||
|
||||
public static final String MAGENTA_SHULKER = "iron_shulker_box_magenta";
|
||||
public static final String MAGENTA_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_magenta";
|
||||
|
||||
public static final String LIGHT_BLUE_SHULKER = "iron_shulker_box_light_blue";
|
||||
public static final String LIGHT_BLUE_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_light_blue";
|
||||
|
||||
public static final String YELLOW_SHULKER = "iron_shulker_box_yellow";
|
||||
public static final String YELLOW_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_yellow";
|
||||
|
||||
public static final String LIME_SHULKER = "iron_shulker_box_lime";
|
||||
public static final String LIME_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_lime";
|
||||
|
||||
public static final String PINK_SHULKER = "iron_shulker_box_pink";
|
||||
public static final String PINK_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_pink";
|
||||
|
||||
public static final String GRAY_SHULKER = "iron_shulker_box_gray";
|
||||
public static final String GRAY_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_gray";
|
||||
|
||||
public static final String SILVER_SHULKER = "iron_shulker_box_silver";
|
||||
public static final String SILVER_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_silver";
|
||||
|
||||
public static final String CYAN_SHULKER = "iron_shulker_box_cyan";
|
||||
public static final String CYAN_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_cyan";
|
||||
|
||||
public static final String PURPLE_SHULKER = "iron_shulker_box_purple";
|
||||
public static final String PURPLE_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_purple";
|
||||
|
||||
public static final String BLUE_SHULKER = "iron_shulker_box_blue";
|
||||
public static final String BLUE_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_blue";
|
||||
|
||||
public static final String BROWN_SHULKER = "iron_shulker_box_brown";
|
||||
public static final String BROWN_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_brown";
|
||||
|
||||
public static final String GREEN_SHULKER = "iron_shulker_box_green";
|
||||
public static final String GREEN_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_green";
|
||||
|
||||
public static final String RED_SHULKER = "iron_shulker_box_red";
|
||||
public static final String RED_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_red";
|
||||
|
||||
public static final String BLACK_SHULKER = "iron_shulker_box_black";
|
||||
public static final String BLACK_SHULKER = IronChest.MOD_ID + ":iron_shulker_box_black";
|
||||
|
||||
public static final String[] SHULKER_NAMES = { WHITE_SHULKER, ORANGE_SHULKER, MAGENTA_SHULKER, LIGHT_BLUE_SHULKER, YELLOW_SHULKER, LIME_SHULKER, PINK_SHULKER, GRAY_SHULKER, SILVER_SHULKER, CYAN_SHULKER, PURPLE_SHULKER, BLUE_SHULKER, BROWN_SHULKER, GREEN_SHULKER, RED_SHULKER, BLACK_SHULKER };
|
||||
}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Public License v3.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
* <p>
|
||||
* Contributors:
|
||||
* cpw - initial API and implementation
|
||||
******************************************************************************/
|
||||
package cpw.mods.ironchest.common.util;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class CreativeTab extends CreativeTabs
|
||||
{
|
||||
private ItemStack icon;
|
||||
|
||||
// a vanilla icon in case the other one isn't present
|
||||
public CreativeTab(String label, ItemStack backupIcon)
|
||||
{
|
||||
super(label);
|
||||
|
||||
this.icon = backupIcon;
|
||||
}
|
||||
|
||||
public void setDisplayIcon(ItemStack displayIcon)
|
||||
{
|
||||
if (!displayIcon.isEmpty())
|
||||
{
|
||||
this.icon = displayIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public ItemStack getTabIconItem()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package cpw.mods.ironchest.common.util;
|
||||
|
||||
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
|
||||
import cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.items.ChestChangerType;
|
||||
import cpw.mods.ironchest.common.items.ShulkerBoxChangerType;
|
||||
import cpw.mods.ironchest.common.lib.BlockLists;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class CreativeTabItems
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void getSubItems(NonNullList<ItemStack> subItems)
|
||||
{
|
||||
for (ChestChangerType type : ChestChangerType.VALUES)
|
||||
{
|
||||
subItems.add(new ItemStack(type.item));
|
||||
}
|
||||
|
||||
for (ShulkerBoxChangerType type : ShulkerBoxChangerType.VALUES)
|
||||
{
|
||||
subItems.add(new ItemStack(type.item));
|
||||
}
|
||||
|
||||
for (IronChestType type : IronChestType.VALUES)
|
||||
{
|
||||
if (type.isValidForCreativeMode())
|
||||
{
|
||||
subItems.add(new ItemStack(IronChestBlocks.ironChestBlock, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
for (Block shulker : BlockLists.SHULKER_BLOCKS)
|
||||
{
|
||||
for (IronShulkerBoxType type : IronShulkerBoxType.VALUES)
|
||||
{
|
||||
if (type.isValidForCreativeMode())
|
||||
{
|
||||
subItems.add(new ItemStack(shulker, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -174,4 +174,4 @@ item.ironchest.shulker_box.diamond_obsidian.tooltip=Used to upgrade a Diamond Sh
|
|||
# GUIs #
|
||||
##############
|
||||
|
||||
itemGroup.IronChest=Iron Chests
|
||||
itemGroup.ironchest=Iron Chests
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"recipes": {
|
||||
"shulker_box": "cpw.mods.ironchest.common.crafting.ShulkerBoxRecipeFactory",
|
||||
"shulker_box_coloring": "cpw.mods.ironchest.common.crafting.ShulkerBoxColorRecipeFactory"
|
||||
"shulker_box": "cpw.mods.ironchest.common.crafting.recipe.ShulkerBoxRecipeFactory",
|
||||
"shulker_box_coloring": "cpw.mods.ironchest.common.crafting.recipe.ShulkerBoxColorRecipeFactory"
|
||||
},
|
||||
"conditions": {
|
||||
"ore_dict_entry_exists": "cpw.mods.ironchest.common.crafting.OreDictEntryExistsConditionFactory"
|
||||
"ore_dict_entry_exists": "cpw.mods.ironchest.common.crafting.condition.OreDictEntryExistsConditionFactory"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue