package name changes
This commit is contained in:
parent
b7d6a8c6cf
commit
425edd2bd6
19 changed files with 128 additions and 125 deletions
|
@ -23,17 +23,17 @@ 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 CoreRegistry
|
||||
{
|
||||
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")
|
||||
@SidedProxy(clientSide = "com.dark.ClientRegistryProxy", serverSide = "com.dark.RegistryProxy")
|
||||
public static RegistryProxy proxy;
|
||||
|
||||
public static Configuration masterBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "Dark/EnabledBlocks.cfg"));
|
||||
public static Configuration masterBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "objects/EnabledBlocks.cfg"));
|
||||
|
||||
public static Block createNewBlock(String name, String modID, Class<? extends Block> blockClass)
|
||||
{
|
||||
|
@ -78,13 +78,14 @@ public class CoreRegistry
|
|||
return block;
|
||||
}
|
||||
|
||||
/** Finishes the creation of the block loading config files and tile entities */
|
||||
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"));
|
||||
Configuration extraBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "objects/blocks/" + block.getUnlocalizedName() + ".cfg"));
|
||||
extraBlockConfig.load();
|
||||
((IExtraInfo) block).loadExtraConfigs(extraBlockConfig);
|
||||
extraBlockConfig.save();
|
||||
|
@ -104,7 +105,7 @@ public class CoreRegistry
|
|||
}
|
||||
|
||||
/** Method to get block via name
|
||||
*
|
||||
*
|
||||
* @param blockName
|
||||
* @return Block requested */
|
||||
public static Block getBlock(String blockName)
|
||||
|
@ -120,22 +121,11 @@ public class CoreRegistry
|
|||
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;
|
||||
}
|
||||
|
||||
/** Creates a new fluid block using the prefab following a few conditions.
|
||||
*
|
||||
* @param modDomainPrefix - prefix of the mod, used for texture refrence and block registry
|
||||
* @param config - config file to pull the blockID from
|
||||
* @param fluid - fluid to link to this block */
|
||||
public static Block createNewFluidBlock(String modDomainPrefix, Configuration config, Fluid fluid)
|
||||
{
|
||||
Block fluidBlock = null;
|
||||
|
@ -165,7 +155,7 @@ public class CoreRegistry
|
|||
|
||||
/** 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
|
||||
|
@ -193,7 +183,7 @@ public class CoreRegistry
|
|||
{
|
||||
if (((IExtraInfo) item).hasExtraConfigs())
|
||||
{
|
||||
Configuration extraBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "Dark/items/" + item.getUnlocalizedName() + ".cfg"));
|
||||
Configuration extraBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "objects/items/" + item.getUnlocalizedName() + ".cfg"));
|
||||
extraBlockConfig.load();
|
||||
((IExtraInfo) item).loadExtraConfigs(extraBlockConfig);
|
||||
extraBlockConfig.save();
|
||||
|
|
|
@ -8,8 +8,8 @@ import universalelectricity.core.UniversalElectricity;
|
|||
|
||||
import com.dark.fluid.FluidHelper;
|
||||
import com.dark.helpers.PlayerKeyHandler;
|
||||
import com.dark.prefab.tile.network.NetworkUpdateHandler;
|
||||
import com.dark.save.SaveManager;
|
||||
import com.dark.tilenetwork.prefab.NetworkUpdateHandler;
|
||||
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
|
|
@ -15,12 +15,12 @@ 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 */
|
||||
/** Does this object need to generate a settings config */
|
||||
public boolean hasExtraConfigs();
|
||||
|
||||
/** Loads the config file for this block. This is a single config file that is tied to just this
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
package com.dark;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class IndustryCreativeTab extends CreativeTabs
|
||||
{
|
||||
public ItemStack itemStack = new ItemStack(Item.ingotIron, 1, 0);
|
||||
|
||||
private static IndustryCreativeTab tabAutomation = new IndustryCreativeTab("Automation");
|
||||
private static IndustryCreativeTab tabIndustrial = new IndustryCreativeTab("Industrial");
|
||||
private static IndustryCreativeTab tabHydrualic = new IndustryCreativeTab("Hydraulic");
|
||||
private static IndustryCreativeTab tabMining = new IndustryCreativeTab("Mining");
|
||||
|
||||
public IndustryCreativeTab(String label)
|
||||
{
|
||||
super(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
return this.itemStack;
|
||||
}
|
||||
|
||||
public void setIconItemStack(ItemStack stack)
|
||||
{
|
||||
this.itemStack = stack;
|
||||
}
|
||||
|
||||
public static IndustryCreativeTab tabAutomation()
|
||||
{
|
||||
if (tabAutomation == null)
|
||||
{
|
||||
tabAutomation = new IndustryCreativeTab("Automation");
|
||||
}
|
||||
return tabAutomation;
|
||||
}
|
||||
|
||||
public static IndustryCreativeTab tabIndustrial()
|
||||
{
|
||||
if (tabIndustrial == null)
|
||||
{
|
||||
tabIndustrial = new IndustryCreativeTab("Industrial");
|
||||
}
|
||||
return tabIndustrial;
|
||||
}
|
||||
|
||||
public static IndustryCreativeTab tabHydraulic()
|
||||
{
|
||||
if (tabHydrualic == null)
|
||||
{
|
||||
tabHydrualic = new IndustryCreativeTab("Hydraulic");
|
||||
}
|
||||
return tabHydrualic;
|
||||
}
|
||||
|
||||
public static IndustryCreativeTab tabMining()
|
||||
{
|
||||
if (tabMining == null)
|
||||
{
|
||||
tabMining = new IndustryCreativeTab("Mining");
|
||||
}
|
||||
return tabMining;
|
||||
}
|
||||
|
||||
}
|
68
src/com/dark/IndustryTabs.java
Normal file
68
src/com/dark/IndustryTabs.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
package com.dark;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class IndustryTabs extends CreativeTabs
|
||||
{
|
||||
public ItemStack itemStack = new ItemStack(Item.ingotIron, 1, 0);
|
||||
|
||||
private static IndustryTabs tabAutomation = new IndustryTabs("Automation");
|
||||
private static IndustryTabs tabIndustrial = new IndustryTabs("Industrial");
|
||||
private static IndustryTabs tabHydrualic = new IndustryTabs("Hydraulic");
|
||||
private static IndustryTabs tabMining = new IndustryTabs("Mining");
|
||||
|
||||
public IndustryTabs(String label)
|
||||
{
|
||||
super(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
return this.itemStack;
|
||||
}
|
||||
|
||||
public void setIconItemStack(ItemStack stack)
|
||||
{
|
||||
this.itemStack = stack;
|
||||
}
|
||||
|
||||
public static IndustryTabs tabAutomation()
|
||||
{
|
||||
if (tabAutomation == null)
|
||||
{
|
||||
tabAutomation = new IndustryTabs("Automation");
|
||||
}
|
||||
return tabAutomation;
|
||||
}
|
||||
|
||||
public static IndustryTabs tabIndustrial()
|
||||
{
|
||||
if (tabIndustrial == null)
|
||||
{
|
||||
tabIndustrial = new IndustryTabs("Industrial");
|
||||
}
|
||||
return tabIndustrial;
|
||||
}
|
||||
|
||||
public static IndustryTabs tabHydraulic()
|
||||
{
|
||||
if (tabHydrualic == null)
|
||||
{
|
||||
tabHydrualic = new IndustryTabs("Hydraulic");
|
||||
}
|
||||
return tabHydrualic;
|
||||
}
|
||||
|
||||
public static IndustryTabs tabMining()
|
||||
{
|
||||
if (tabMining == null)
|
||||
{
|
||||
tabMining = new IndustryTabs("Mining");
|
||||
}
|
||||
return tabMining;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,12 +2,9 @@ package com.dark.access;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.dark.save.IVirtualObject;
|
||||
import com.dark.save.NBTFileHelper;
|
||||
import com.dark.save.SaveManager;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -15,6 +12,10 @@ import net.minecraft.nbt.NBTTagList;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.dark.save.IVirtualObject;
|
||||
import com.dark.save.NBTFileHelper;
|
||||
import com.dark.save.SaveManager;
|
||||
|
||||
/** 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
|
||||
* global access. Which means it can save/load at will from the world file.
|
||||
|
@ -34,6 +35,8 @@ public class AccessProfile implements ISpecialAccess, IVirtualObject
|
|||
/** Save file by which this was loaded from. Mainly used to save it in the same location again. */
|
||||
protected File saveFile;
|
||||
|
||||
private static final Set<AccessProfile> globalList = new HashSet<AccessProfile>();
|
||||
|
||||
static
|
||||
{
|
||||
SaveManager.registerClass("AccessProfile", AccessProfile.class);
|
||||
|
@ -44,6 +47,7 @@ public class AccessProfile implements ISpecialAccess, IVirtualObject
|
|||
if (global)
|
||||
{
|
||||
SaveManager.register(this);
|
||||
AccessProfile.globalList.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,6 +73,18 @@ public class AccessProfile implements ISpecialAccess, IVirtualObject
|
|||
}
|
||||
}
|
||||
|
||||
public static AccessProfile get(String name)
|
||||
{
|
||||
for (AccessProfile profile : globalList)
|
||||
{
|
||||
if (profile.getID().equalsIgnoreCase(name))
|
||||
{
|
||||
return profile;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public AccessProfile generateNew(String name, Object object)
|
||||
{
|
||||
GroupRegistry.loadNewGroupSet(this);
|
||||
|
|
|
@ -24,14 +24,13 @@ import com.google.common.io.ByteStreams;
|
|||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import dark.machines.PacketManagerEffects;
|
||||
|
||||
/** Packet manager based off the PacketManager from UE created by Calclavia. However changed so it
|
||||
* can easily be extended without changing the base handler file. Instead of changing the base file
|
||||
* manager can be registered to the handle that pickup on ids and then handle there own data from
|
||||
* those ids. This lets new and complex handling to be created without many overlap or long methods
|
||||
* in the packet handler
|
||||
*
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class PacketHandler implements IPacketHandler, IPacketReceiver
|
||||
{
|
||||
|
@ -40,13 +39,11 @@ public class PacketHandler implements IPacketHandler, IPacketReceiver
|
|||
public static HashMap<Integer, IPacketManager> packetTypes = new HashMap<Integer, IPacketManager>();
|
||||
|
||||
public static PacketManagerTile tile = new PacketManagerTile();
|
||||
public static PacketManagerEffects effects = new PacketManagerEffects();
|
||||
|
||||
public static int maxID = 0;
|
||||
static
|
||||
{
|
||||
registerManager(new PacketManagerTile());
|
||||
registerManager(new PacketManagerEffects());
|
||||
registerManager(PacketManagerKeyEvent.instance());
|
||||
registerManager(new PacketManagerEntity());
|
||||
}
|
||||
|
@ -176,7 +173,7 @@ public class PacketHandler implements IPacketHandler, IPacketReceiver
|
|||
}
|
||||
|
||||
/** Gets a packet for the tile entity.
|
||||
*
|
||||
*
|
||||
* @return */
|
||||
@SuppressWarnings("resource")
|
||||
public Packet getTilePacket(String channelName, TileEntity sender, Object... sendData)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.dark.tile.network;
|
||||
package com.dark.tilenetwork;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import universalelectricity.core.vector.Vector3;
|
|
@ -1,4 +1,4 @@
|
|||
package com.dark.tile.network;
|
||||
package com.dark.tilenetwork;
|
||||
|
||||
/** Used on tiles that can contain more than one tile network. Currently WIP so don't use unless you
|
||||
* know what your doing. When using this use networks like items and store them in slots.
|
|
@ -1,4 +1,4 @@
|
|||
package com.dark.tile.network;
|
||||
package com.dark.tilenetwork;
|
||||
|
||||
import universalelectricity.core.block.IElectricalStorage;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.dark.tile.network;
|
||||
package com.dark.tilenetwork;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.dark.tile.network;
|
||||
package com.dark.tilenetwork;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.dark.tile.network;
|
||||
package com.dark.tilenetwork;
|
||||
|
||||
import java.util.Set;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.dark.prefab.tile.network;
|
||||
package com.dark.tilenetwork.prefab;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -10,8 +10,8 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
import com.builtbroken.common.Pair;
|
||||
import com.dark.tile.network.IMotionPath;
|
||||
import com.dark.tile.network.INetworkPart;
|
||||
import com.dark.tilenetwork.IMotionPath;
|
||||
import com.dark.tilenetwork.INetworkPart;
|
||||
|
||||
|
||||
/** Class that acts like the redpower pipes system. Each item is marked with a destination. Intended
|
|
@ -1,9 +1,9 @@
|
|||
package com.dark.prefab.tile.network;
|
||||
package com.dark.tilenetwork.prefab;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.dark.tile.network.INetworkPart;
|
||||
import com.dark.tilenetwork.INetworkPart;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,9 +1,9 @@
|
|||
package com.dark.prefab.tile.network;
|
||||
package com.dark.tilenetwork.prefab;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.dark.tile.network.INetworkPart;
|
||||
import com.dark.tilenetwork.INetworkPart;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,8 +1,8 @@
|
|||
package com.dark.prefab.tile.network;
|
||||
package com.dark.tilenetwork.prefab;
|
||||
|
||||
import com.dark.interfaces.IPowerLess;
|
||||
import com.dark.tile.network.INetworkEnergyPart;
|
||||
import com.dark.tile.network.INetworkPart;
|
||||
import com.dark.tilenetwork.INetworkEnergyPart;
|
||||
import com.dark.tilenetwork.INetworkPart;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import universalelectricity.core.block.IElectricalStorage;
|
|
@ -1,12 +1,12 @@
|
|||
package com.dark.prefab.tile.network;
|
||||
package com.dark.tilenetwork.prefab;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.dark.tile.network.INetworkPart;
|
||||
import com.dark.tile.network.ITileNetwork;
|
||||
import com.dark.tilenetwork.INetworkPart;
|
||||
import com.dark.tilenetwork.ITileNetwork;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package com.dark.prefab.tile.network;
|
||||
package com.dark.tilenetwork.prefab;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
@ -6,7 +6,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import com.dark.tile.network.ITileNetwork;
|
||||
import com.dark.tilenetwork.ITileNetwork;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.ITickHandler;
|
Loading…
Reference in a new issue