package name changes & added registry
This commit is contained in:
parent
fbfcd89d95
commit
7449c78567
19 changed files with 528 additions and 29 deletions
|
@ -1,15 +0,0 @@
|
||||||
package com.coremachine;
|
|
||||||
|
|
||||||
public class CoreMachine
|
|
||||||
{
|
|
||||||
private static CoreMachine instance;
|
|
||||||
|
|
||||||
public static CoreMachine instance()
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
instance = new CoreMachine();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
51
src/com/dark/BlockFluid.java
Normal file
51
src/com/dark/BlockFluid.java
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
package com.dark;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
import net.minecraft.util.Icon;
|
||||||
|
import net.minecraftforge.common.Configuration;
|
||||||
|
import net.minecraftforge.fluids.BlockFluidFinite;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class BlockFluid extends BlockFluidFinite
|
||||||
|
{
|
||||||
|
Icon flowing;
|
||||||
|
Icon still;
|
||||||
|
Fluid fluid;
|
||||||
|
String prefix = "";
|
||||||
|
|
||||||
|
public BlockFluid(String prefix, Fluid fluid, Configuration config)
|
||||||
|
{
|
||||||
|
this(prefix, DarkCore.getNextID(), fluid, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockFluid(String prefix, int id, Fluid fluid, Configuration config)
|
||||||
|
{
|
||||||
|
super(config.getBlock("BlockFluid" + fluid.getName(), id).getInt(), fluid, Material.water);
|
||||||
|
this.fluid = fluid;
|
||||||
|
if (prefix != null && prefix.contains(":"))
|
||||||
|
{
|
||||||
|
this.prefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
|
{
|
||||||
|
this.flowing = par1IconRegister.registerIcon(prefix + this.getUnlocalizedName().replace("tile.", "") + "_flowing");
|
||||||
|
this.still = par1IconRegister.registerIcon(prefix + this.getUnlocalizedName().replace("tile.", "") + "_still");
|
||||||
|
fluid.setIcons(still, flowing);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public Icon getIcon(int par1, int par2)
|
||||||
|
{
|
||||||
|
return still;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
42
src/com/dark/ClientRegistryProxy.java
Normal file
42
src/com/dark/ClientRegistryProxy.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package com.dark;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import com.builtbroken.common.Pair;
|
||||||
|
import com.dark.IExtraInfo.IExtraBlockInfo;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class ClientRegistryProxy extends RegistryProxy
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void registerBlock(Block block, Class<? extends ItemBlock> itemClass, String name, String modID)
|
||||||
|
{
|
||||||
|
super.registerBlock(block, itemClass, name, modID);
|
||||||
|
if (block instanceof IExtraBlockInfo)
|
||||||
|
{
|
||||||
|
List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> set = new ArrayList<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>>();
|
||||||
|
((IExtraBlockInfo) block).getClientTileEntityRenderers(set);
|
||||||
|
for (Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer> par : set)
|
||||||
|
{
|
||||||
|
ClientRegistry.bindTileEntitySpecialRenderer(par.left(), par.right());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void regiserTileEntity(String name, Class<? extends TileEntity> clazz)
|
||||||
|
{
|
||||||
|
super.regiserTileEntity(name, clazz);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
66
src/com/dark/DarkCore.java
Normal file
66
src/com/dark/DarkCore.java
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
package com.dark;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
|
public class DarkCore
|
||||||
|
{
|
||||||
|
private static DarkCore instance;
|
||||||
|
|
||||||
|
public static final String TEXTURE_DIRECTORY = "textures/";
|
||||||
|
public static final String BLOCK_DIRECTORY = TEXTURE_DIRECTORY + "blocks/";
|
||||||
|
public static final String ITEM_DIRECTORY = TEXTURE_DIRECTORY + "items/";
|
||||||
|
public static final String MODEL_DIRECTORY = TEXTURE_DIRECTORY + "models/";
|
||||||
|
public static final String GUI_DIRECTORY = TEXTURE_DIRECTORY + "gui/";
|
||||||
|
|
||||||
|
/* START IDS */
|
||||||
|
public static int BLOCK_ID_PRE = 3100;
|
||||||
|
public static int ITEM_ID_PREFIX = 13200;
|
||||||
|
|
||||||
|
public static DarkCore instance()
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new DarkCore();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the next unused ID in the block list. Does not prevent config file issues after the file
|
||||||
|
* has been made */
|
||||||
|
public static int getNextID()
|
||||||
|
{
|
||||||
|
int id = BLOCK_ID_PRE;
|
||||||
|
|
||||||
|
while (id > 255 && id < (Block.blocksList.length - 1))
|
||||||
|
{
|
||||||
|
Block block = Block.blocksList[id];
|
||||||
|
if (block == null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
BLOCK_ID_PRE = id + 1;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the next unused ID in the item list. Does not prevent config file issues after the file
|
||||||
|
* has been made */
|
||||||
|
public static int getNextItemId()
|
||||||
|
{
|
||||||
|
int id = ITEM_ID_PREFIX;
|
||||||
|
|
||||||
|
while (id > 255 && id < (Item.itemsList.length - 1))
|
||||||
|
{
|
||||||
|
Item item = Item.itemsList[id];
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
ITEM_ID_PREFIX = id + 1;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
65
src/com/dark/ExternalModHandler.java
Normal file
65
src/com/dark/ExternalModHandler.java
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
package com.dark;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
|
||||||
|
/** Handles working with other mod without or without the need of the APIs.
|
||||||
|
*
|
||||||
|
* @author DarkGuardsman */
|
||||||
|
public class ExternalModHandler
|
||||||
|
{
|
||||||
|
private static boolean init = false;
|
||||||
|
|
||||||
|
/** Calls this to load all external mod settings and handling */
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
if (!init)
|
||||||
|
{
|
||||||
|
for (MOD_ID mod : MOD_ID.values())
|
||||||
|
{
|
||||||
|
mod.loaded = Loader.isModLoaded(mod.modID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Checks to see if something can run powerless based on mods loaded
|
||||||
|
*
|
||||||
|
* @param optional - power system that the device can use
|
||||||
|
* @return true if free power is to be generated */
|
||||||
|
public static boolean runPowerLess()
|
||||||
|
{
|
||||||
|
for (MOD_ID mod : MOD_ID.values())
|
||||||
|
{
|
||||||
|
if (mod.validPowerSystem)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Enum storing MOD_IDs and some general info on mods */
|
||||||
|
public static enum MOD_ID
|
||||||
|
{
|
||||||
|
BUILCRAFT_MOD("BuildCraft|Core", false),
|
||||||
|
BUILCRAFT_ENERGY_MOD("BuildCraft|Energy", true),
|
||||||
|
BUILCRAFT_FACTORY_MOD("BuildCraft|Factory", false),
|
||||||
|
BUILCRAFT_SILICON_MOD("BuildCraft|Silicon", false),
|
||||||
|
BUILCRAFT_BUILDERS_MOD("BuildCraft|Builders", false),
|
||||||
|
BUILCRAFT_TRANSPORT_MOD("BuildCraft|Transport", false),
|
||||||
|
INDUSTRIALCRAFT_MOD("IC2", true),
|
||||||
|
MEKANISM_MOD("Mekanism", true); //TODO add mek sub mods
|
||||||
|
|
||||||
|
public final String modID;
|
||||||
|
public String modNAME;
|
||||||
|
public boolean loaded;
|
||||||
|
public boolean validPowerSystem;
|
||||||
|
|
||||||
|
private MOD_ID(String modID, boolean power)
|
||||||
|
{
|
||||||
|
this.modID = modID;
|
||||||
|
this.validPowerSystem = power;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
56
src/com/dark/IExtraInfo.java
Normal file
56
src/com/dark/IExtraInfo.java
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
package com.dark;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.Configuration;
|
||||||
|
|
||||||
|
import com.builtbroken.common.Pair;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
/** Used to handle info about the block that would normally be handled by the mod main class. Use the
|
||||||
|
* BlockRegistry in order for these methods to be called on load of the mod.
|
||||||
|
*
|
||||||
|
* @author DarkGuardsman */
|
||||||
|
public interface IExtraInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
/** True will cause a config file to be generated for this block */
|
||||||
|
public boolean hasExtraConfigs();
|
||||||
|
|
||||||
|
/** Loads the config file for this block. This is a single config file that is tied to just this
|
||||||
|
* block alone. Anything can be stored in the config file but its suggested to use it for
|
||||||
|
* advanced settings for the block/tile. Things like power, update rate, optional features,
|
||||||
|
* graphics, or crafting cost */
|
||||||
|
public void loadExtraConfigs(Configuration config);
|
||||||
|
|
||||||
|
public static interface IExtraBlockInfo extends IExtraInfo, ITileEntityProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
/** Loads the names used to reference this item in a recipe */
|
||||||
|
public void loadOreNames();
|
||||||
|
|
||||||
|
/** List of all tileEntities this block needs */
|
||||||
|
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list);
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getClientTileEntityRenderers(List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface IExtraTileEntityInfo extends IExtraInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface IExtraItemInfo extends IExtraInfo
|
||||||
|
{
|
||||||
|
/** Loads the names used to reference this item in a recipe */
|
||||||
|
public void loadOreNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
210
src/com/dark/ModObjectRegistry.java
Normal file
210
src/com/dark/ModObjectRegistry.java
Normal file
|
@ -0,0 +1,210 @@
|
||||||
|
package com.dark;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.Configuration;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
|
||||||
|
import com.builtbroken.common.Pair;
|
||||||
|
import com.dark.IExtraInfo.IExtraBlockInfo;
|
||||||
|
import com.dark.IExtraInfo.IExtraItemInfo;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
|
/** Handler to make registering all parts of a mod's objects that are loaded into the game by forge
|
||||||
|
*
|
||||||
|
* @author DarkGuardsman */
|
||||||
|
public class ModObjectRegistry
|
||||||
|
{
|
||||||
|
public static HashMap<Block, String> registredBlocks = new HashMap<Block, String>();
|
||||||
|
public static HashMap<Item, String> registredItems = new HashMap<Item, String>();
|
||||||
|
|
||||||
|
@SidedProxy(clientSide = "dark.core.ClientRegistryProxy", serverSide = "dark.core.RegistryProxy")
|
||||||
|
public static RegistryProxy proxy;
|
||||||
|
|
||||||
|
public static Configuration masterBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "Dark/EnabledBlocks.cfg"));
|
||||||
|
|
||||||
|
public static Block createNewBlock(String name, String modID, Class<? extends Block> blockClass)
|
||||||
|
{
|
||||||
|
return ModObjectRegistry.createNewBlock(name, modID, blockClass, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block createNewBlock(String name, String modID, Class<? extends Block> blockClass, boolean canDisable)
|
||||||
|
{
|
||||||
|
return ModObjectRegistry.createNewBlock(name, modID, blockClass, null, canDisable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block createNewBlock(String name, String modID, Class<? extends Block> blockClass, Class<? extends ItemBlock> itemClass)
|
||||||
|
{
|
||||||
|
return createNewBlock(name, modID, blockClass, itemClass, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block createNewBlock(String name, String modID, Class<? extends Block> blockClass, Class<? extends ItemBlock> itemClass, boolean canDisable)
|
||||||
|
{
|
||||||
|
Block block = null;
|
||||||
|
if (blockClass != null && (!canDisable || canDisable && masterBlockConfig.get("Enabled_List", "Enabled_" + name, true).getBoolean(true)))
|
||||||
|
{
|
||||||
|
//TODO redesign to catch blockID conflict
|
||||||
|
try
|
||||||
|
{
|
||||||
|
block = blockClass.newInstance();
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (block != null)
|
||||||
|
{
|
||||||
|
registredBlocks.put(block, name);
|
||||||
|
proxy.registerBlock(block, itemClass, name, modID);
|
||||||
|
ModObjectRegistry.finishCreation(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void finishCreation(Block block)
|
||||||
|
{
|
||||||
|
if (block instanceof IExtraInfo)
|
||||||
|
{
|
||||||
|
if (((IExtraInfo) block).hasExtraConfigs())
|
||||||
|
{
|
||||||
|
Configuration extraBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "Dark/blocks/" + block.getUnlocalizedName() + ".cfg"));
|
||||||
|
extraBlockConfig.load();
|
||||||
|
((IExtraInfo) block).loadExtraConfigs(extraBlockConfig);
|
||||||
|
extraBlockConfig.save();
|
||||||
|
}
|
||||||
|
if (block instanceof IExtraBlockInfo)
|
||||||
|
{
|
||||||
|
((IExtraBlockInfo) block).loadOreNames();
|
||||||
|
Set<Pair<String, Class<? extends TileEntity>>> tileListNew = new HashSet<Pair<String, Class<? extends TileEntity>>>();
|
||||||
|
((IExtraBlockInfo) block).getTileEntities(block.blockID, tileListNew);
|
||||||
|
for (Pair<String, Class<? extends TileEntity>> par : tileListNew)
|
||||||
|
{
|
||||||
|
proxy.regiserTileEntity(par.left(), par.right());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Method to get block via name
|
||||||
|
*
|
||||||
|
* @param blockName
|
||||||
|
* @return Block requested */
|
||||||
|
public static Block getBlock(String blockName)
|
||||||
|
{
|
||||||
|
for (Entry<Block, String> entry : registredBlocks.entrySet())
|
||||||
|
{
|
||||||
|
String name = entry.getKey().getUnlocalizedName().replace("tile.", "");
|
||||||
|
if (name.equalsIgnoreCase(blockName))
|
||||||
|
{
|
||||||
|
return entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Method to get block via id
|
||||||
|
*
|
||||||
|
* @param blockID
|
||||||
|
* @return Block requested */
|
||||||
|
public static Block getBlock(int blockID)
|
||||||
|
{
|
||||||
|
for (Entry<Block, String> entry : registredBlocks.entrySet())
|
||||||
|
{
|
||||||
|
if (entry.getKey().blockID == blockID)
|
||||||
|
{
|
||||||
|
return entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block createNewFluidBlock(String modDomainPrefix, Configuration config, Fluid fluid)
|
||||||
|
{
|
||||||
|
Block fluidBlock = null;
|
||||||
|
Fluid fluidActual = null;
|
||||||
|
if (config != null && fluid != null && config.get("general", "EnableFluid_" + fluid.getName(), true).getBoolean(true) && FluidRegistry.getFluid(fluid.getName()) == null)
|
||||||
|
{
|
||||||
|
FluidRegistry.registerFluid(fluid);
|
||||||
|
fluidActual = FluidRegistry.getFluid(fluid.getName());
|
||||||
|
if (fluidActual == null)
|
||||||
|
{
|
||||||
|
fluidActual = fluid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fluidActual.getBlockID() == -1 && masterBlockConfig.get("Enabled_List", "Enabled_" + fluid.getName() + "Block", true).getBoolean(true))
|
||||||
|
{
|
||||||
|
fluidBlock = new BlockFluid(modDomainPrefix, fluidActual, config).setUnlocalizedName("tile.Fluid." + fluid.getName());
|
||||||
|
proxy.registerBlock(fluidBlock, null, "DMBlockFluid" + fluid.getName(), modDomainPrefix);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fluidBlock = Block.blocksList[fluid.getBlockID()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fluidBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates a new item using reflection as well runs it threw some check to activate any
|
||||||
|
* interface methods
|
||||||
|
*
|
||||||
|
* @param name - name to register the item with
|
||||||
|
* @param modid - mods that the item comes from
|
||||||
|
* @param clazz - item class
|
||||||
|
* @param canDisable - can a user disable this item
|
||||||
|
* @return the new item */
|
||||||
|
public static Item createNewItem(String name, String modid, Class<? extends Item> clazz, boolean canDisable)
|
||||||
|
{
|
||||||
|
Item item = null;
|
||||||
|
if (clazz != null && (!canDisable || canDisable && masterBlockConfig.get("Enabled_List", "Enabled_" + name, true).getBoolean(true)))
|
||||||
|
{
|
||||||
|
//TODO redesign to catch blockID conflict
|
||||||
|
try
|
||||||
|
{
|
||||||
|
item = clazz.newInstance();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
registredItems.put(item, name);
|
||||||
|
GameRegistry.registerItem(item, name, modid);
|
||||||
|
if (item instanceof IExtraInfo)
|
||||||
|
{
|
||||||
|
if (((IExtraInfo) item).hasExtraConfigs())
|
||||||
|
{
|
||||||
|
Configuration extraBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "Dark/items/" + item.getUnlocalizedName() + ".cfg"));
|
||||||
|
extraBlockConfig.load();
|
||||||
|
((IExtraInfo) item).loadExtraConfigs(extraBlockConfig);
|
||||||
|
extraBlockConfig.save();
|
||||||
|
}
|
||||||
|
if (item instanceof IExtraItemInfo)
|
||||||
|
{
|
||||||
|
((IExtraItemInfo) item).loadOreNames();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
22
src/com/dark/RegistryProxy.java
Normal file
22
src/com/dark/RegistryProxy.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package com.dark;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
|
public class RegistryProxy
|
||||||
|
{
|
||||||
|
public void registerBlock(Block block, Class<? extends ItemBlock> itemClass, String name, String modID)
|
||||||
|
{
|
||||||
|
if (block != null && name != null)
|
||||||
|
{
|
||||||
|
GameRegistry.registerBlock(block, itemClass == null ? ItemBlock.class : itemClass, name, modID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void regiserTileEntity(String name, Class<? extends TileEntity> clazz)
|
||||||
|
{
|
||||||
|
GameRegistry.registerTileEntityWithAlternatives(clazz, name, "DM" + name);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.access;
|
package com.dark.access;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,17 +1,19 @@
|
||||||
package dark.api.access;
|
package com.dark.access;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.dark.save.IVirtualObject;
|
||||||
|
import com.dark.save.NBTFileHelper;
|
||||||
|
import com.dark.save.SaveManager;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import dark.api.save.IVirtualObject;
|
|
||||||
import dark.api.save.NBTFileHelper;
|
|
||||||
import dark.api.save.SaveManager;
|
|
||||||
|
|
||||||
/** Designed to be used as a container for AccessGroups and AccessUser. If you plan to use this make
|
/** Designed to be used as a container for AccessGroups and AccessUser. If you plan to use this make
|
||||||
* sure to use it correctly. This is designed to be saved separate from the world save if marked for
|
* sure to use it correctly. This is designed to be saved separate from the world save if marked for
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.access;
|
package com.dark.access;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.access;
|
package com.dark.access;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.access;
|
package com.dark.access;
|
||||||
|
|
||||||
/** Applied to tileEntities that contain an access profile that describes how the tile interacts with
|
/** Applied to tileEntities that contain an access profile that describes how the tile interacts with
|
||||||
* users
|
* users
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.access;
|
package com.dark.access;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.access;
|
package com.dark.access;
|
||||||
|
|
||||||
/** Constants that represent nodes by which machines and entities used in combination with
|
/** Constants that represent nodes by which machines and entities used in combination with
|
||||||
* ISpecialAccess to limit users on what they can do. These nodes should be used in the same way by
|
* ISpecialAccess to limit users on what they can do. These nodes should be used in the same way by
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.save;
|
package com.dark.save;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.save;
|
package com.dark.save;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.save;
|
package com.dark.save;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
|
@ -1,4 +1,4 @@
|
||||||
package dark.api.save;
|
package com.dark.save;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
Loading…
Reference in a new issue