Moved Item/Block Registration
This commit is contained in:
parent
c959f92558
commit
0223f6ae1d
6 changed files with 81 additions and 32 deletions
|
@ -11,6 +11,8 @@ import techreborn.client.TechRebornCreativeTab;
|
|||
import techreborn.tiles.TileQuantumChest;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.itemblocks.ItemBlockOre;
|
||||
import techreborn.items.ItemDusts;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
|
@ -22,37 +24,17 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||
@Mod(modid = "techreborn", name = "TechReborn", version = "@MODVERSION@")
|
||||
public class Core {
|
||||
|
||||
public static Block thermalGenerator;
|
||||
public static Block quantumTank;
|
||||
public static Block quantumChest;
|
||||
public static Block ore;
|
||||
|
||||
public static Item dusts;
|
||||
|
||||
|
||||
@Mod.Instance
|
||||
public static Core INSTANCE;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLPreInitializationEvent event){
|
||||
thermalGenerator = new BlockThermalGenerator().setBlockName("techreborn.thermalGenerator").setBlockTextureName("techreborn:ThermalGenerator_other").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(thermalGenerator, "techreborn.thermalGenerator");
|
||||
GameRegistry.registerTileEntity(TileThermalGenerator.class, "TileThermalGenerator");
|
||||
|
||||
quantumTank = new BlockQuantumTank().setBlockName("techreborn.quantumTank").setBlockTextureName("techreborn:quantumTank").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumTank, "techreborn.quantumTank");
|
||||
GameRegistry.registerTileEntity(TileQuantumTank.class, "TileQuantumTank");
|
||||
|
||||
quantumChest = new BlockQuantumChest().setBlockName("techreborn.quantumChest").setBlockTextureName("techreborn:quantumChest").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumChest, "techreborn.quantumChest");
|
||||
GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChest");
|
||||
|
||||
ore = new BlockOre(Material.rock);
|
||||
GameRegistry.registerBlock(ore, ItemBlockOre.class, "ore");
|
||||
|
||||
dusts = new ItemDusts();
|
||||
GameRegistry.registerItem(dusts, "dust");
|
||||
|
||||
public void init(FMLPreInitializationEvent event)
|
||||
{
|
||||
//Register ModBlocks
|
||||
ModBlocks.init();
|
||||
//Register ModItems
|
||||
ModItems.init();
|
||||
//Register Gui Handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package techreborn.client;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.Core;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TechRebornCreativeTab extends CreativeTabs {
|
||||
|
||||
|
@ -14,6 +15,6 @@ public class TechRebornCreativeTab extends CreativeTabs {
|
|||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(Core.thermalGenerator);
|
||||
return Item.getItemFromBlock(ModBlocks.thermalGenerator);
|
||||
}
|
||||
}
|
||||
|
|
43
src/main/java/techreborn/init/ModBlocks.java
Normal file
43
src/main/java/techreborn/init/ModBlocks.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
package techreborn.init;
|
||||
|
||||
import techreborn.blocks.BlockOre;
|
||||
import techreborn.blocks.BlockQuantumChest;
|
||||
import techreborn.blocks.BlockQuantumTank;
|
||||
import techreborn.blocks.BlockThermalGenerator;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.itemblocks.ItemBlockOre;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class ModBlocks {
|
||||
|
||||
public static Block thermalGenerator;
|
||||
public static Block quantumTank;
|
||||
public static Block quantumChest;
|
||||
public static Block ore;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
|
||||
thermalGenerator = new BlockThermalGenerator().setBlockName("techreborn.thermalGenerator").setBlockTextureName("techreborn:ThermalGenerator_other").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(thermalGenerator, "techreborn.thermalGenerator");
|
||||
GameRegistry.registerTileEntity(TileThermalGenerator.class, "TileThermalGenerator");
|
||||
|
||||
quantumTank = new BlockQuantumTank().setBlockName("techreborn.quantumTank").setBlockTextureName("techreborn:quantumTank").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumTank, "techreborn.quantumTank");
|
||||
GameRegistry.registerTileEntity(TileQuantumTank.class, "TileQuantumTank");
|
||||
|
||||
quantumChest = new BlockQuantumChest().setBlockName("techreborn.quantumChest").setBlockTextureName("techreborn:quantumChest").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumChest, "techreborn.quantumChest");
|
||||
GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChest");
|
||||
|
||||
ore = new BlockOre(Material.rock);
|
||||
GameRegistry.registerBlock(ore, ItemBlockOre.class, "ore");
|
||||
|
||||
}
|
||||
|
||||
}
|
17
src/main/java/techreborn/init/ModItems.java
Normal file
17
src/main/java/techreborn/init/ModItems.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package techreborn.init;
|
||||
|
||||
import techreborn.items.ItemDusts;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ModItems {
|
||||
|
||||
public static Item dusts;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
dusts = new ItemDusts();
|
||||
GameRegistry.registerItem(dusts, "dust");
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package techreborn.itemblocks;
|
|||
|
||||
import techreborn.Core;
|
||||
import techreborn.blocks.BlockOre;
|
||||
import techreborn.init.ModBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemMultiTexture;
|
||||
|
||||
|
@ -9,7 +10,7 @@ public class ItemBlockOre extends ItemMultiTexture{
|
|||
|
||||
public ItemBlockOre(Block block)
|
||||
{
|
||||
super(Core.ore, Core.ore, BlockOre.types);
|
||||
super(ModBlocks.ore, ModBlocks.ore, BlockOre.types);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,8 +11,13 @@ import net.minecraft.network.Packet;
|
|||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import techreborn.Core;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.util.FluidUtils;
|
||||
import techreborn.util.Inventory;
|
||||
import techreborn.util.Tank;
|
||||
|
@ -55,7 +60,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
|
|||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(Core.thermalGenerator, 1);
|
||||
return new ItemStack(ModBlocks.thermalGenerator, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue