Moved appropriate classes to Electrical module
This commit is contained in:
parent
dc950d7989
commit
660288b230
21 changed files with 167 additions and 393 deletions
|
@ -2,15 +2,21 @@ package resonantinduction.core;
|
|||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import org.modstats.ModstatInfo;
|
||||
import org.modstats.Modstats;
|
||||
|
||||
import resonantinduction.core.link.LinkEventHandler;
|
||||
import resonantinduction.core.handler.FluidEventHandler;
|
||||
import resonantinduction.core.handler.LinkEventHandler;
|
||||
import resonantinduction.core.prefab.part.PacketMultiPart;
|
||||
import resonantinduction.core.resource.ItemDust;
|
||||
import resonantinduction.core.resource.ResourceGenerator;
|
||||
import resonantinduction.core.resource.fluid.BlockFluidMixture;
|
||||
import resonantinduction.core.resource.fluid.TileFluidMixture;
|
||||
import resonantinduction.core.resource.item.ItemDust;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.network.PacketTile;
|
||||
import calclavia.lib.utility.LanguageUtility;
|
||||
|
@ -60,6 +66,9 @@ public class ResonantInduction
|
|||
* Blocks and Items
|
||||
*/
|
||||
public static ItemDust itemDust;
|
||||
public static Block blockFluidMixture;
|
||||
|
||||
public static Fluid MIXTURE = null;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
|
@ -72,13 +81,21 @@ public class ResonantInduction
|
|||
// Register Forge Events
|
||||
MinecraftForge.EVENT_BUS.register(ResourceGenerator.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(new LinkEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new FluidEventHandler());
|
||||
|
||||
Settings.CONFIGURATION.load();
|
||||
|
||||
MIXTURE = new Fluid("mixture");
|
||||
FluidRegistry.registerFluid(MIXTURE);
|
||||
blockFluidMixture = new BlockFluidMixture(Settings.getNextBlockID(), MIXTURE);
|
||||
|
||||
// Items
|
||||
itemDust = new ItemDust(Settings.getNextItemID());
|
||||
GameRegistry.registerItem(itemDust, itemDust.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerBlock(blockFluidMixture, blockFluidMixture.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileFluidMixture.class, blockFluidMixture.getUnlocalizedName());
|
||||
|
||||
Settings.CONFIGURATION.save();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package resonantinduction.core.handler;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class FluidEventHandler
|
||||
{
|
||||
public static final HashMap<String, Icon> fluidIconMap = new HashMap<String, Icon>();
|
||||
|
||||
public void registerIcon(String name, TextureStitchEvent.Pre event)
|
||||
{
|
||||
fluidIconMap.put(name, event.map.registerIcon(name));
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preTextureHook(TextureStitchEvent.Pre event)
|
||||
{
|
||||
if (event.map.textureType == 0)
|
||||
{
|
||||
registerIcon(Reference.PREFIX + "mixture", event);
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void textureHook(TextureStitchEvent.Post event)
|
||||
{
|
||||
ResonantInduction.MIXTURE.setIcons(fluidIconMap.get(Reference.PREFIX + "mixture"));
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.core.link;
|
||||
package resonantinduction.core.handler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import universalelectricity.api.vector.VectorWorld;
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package resonantinduction.core.link;
|
||||
package resonantinduction.core.handler;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.old.mechanics;
|
||||
package resonantinduction.core.part;
|
||||
|
||||
import resonantinduction.core.prefab.block.BlockBase;
|
||||
|
||||
|
@ -10,8 +10,8 @@ import resonantinduction.core.prefab.block.BlockBase;
|
|||
*/
|
||||
public class BlockMachinePart extends BlockBase
|
||||
{
|
||||
public BlockMachinePart(int id)
|
||||
public BlockMachinePart()
|
||||
{
|
||||
super("machinePart", id);
|
||||
super("machinePart");
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import net.minecraft.network.packet.Packet;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.network.ISimplePacketReceiver;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
|
@ -191,7 +192,7 @@ public abstract class TileEntityMachine extends TileEntityInv implements ISidedI
|
|||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
PacketHandler.instance().sendPacketToClients(PacketHandler.instance().getTilePacket(this.getChannel(), SimplePacketTypes.RUNNING.name, this, this.functioning), worldObj, new Vector3(this), 64);
|
||||
PacketHandler.sendPacketToClients(PacketHandler.getTilePacket(this.getChannel(), SimplePacketTypes.RUNNING.name, this, this.functioning), worldObj, new Vector3(this), 64);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,7 +225,7 @@ public abstract class TileEntityMachine extends TileEntityInv implements ISidedI
|
|||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return PacketHandler.instance().getTilePacket(this.getChannel(), SimplePacketTypes.RUNNING.name, this, this.functioning);
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, this.functioning);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@ import resonantinduction.api.recipe.MachineRecipes.RecipeType;
|
|||
import resonantinduction.api.recipe.OreDetectionBlackList;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.resource.item.ItemDust;
|
||||
import codechicken.lib.colour.Colour;
|
||||
import codechicken.lib.colour.ColourRGBA;
|
||||
import codechicken.lib.render.TextureUtils;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.core.resource;
|
||||
package resonantinduction.core.resource.fluid;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.core.resource;
|
||||
package resonantinduction.core.resource.fluid;
|
||||
|
||||
import java.util.TreeSet;
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package resonantinduction.core.resource;
|
||||
package resonantinduction.core.resource.item;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.resource.BlockOre;
|
||||
import resonantinduction.core.resource.BlockOre.OreData;
|
||||
|
||||
public class ItemBlockOre extends ItemBlock
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.core.resource;
|
||||
package resonantinduction.core.resource.item;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -10,6 +10,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.item.ItemBase;
|
||||
import resonantinduction.core.resource.ResourceGenerator;
|
||||
import calclavia.lib.utility.LanguageUtility;
|
||||
import calclavia.lib.utility.NBTUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.core.resource;
|
||||
package resonantinduction.core.resource.item;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,15 +1,21 @@
|
|||
package resonantinduction.electrical;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import ic2.api.item.Items;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.ResonantInductionTabs;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.part.BlockMachinePart;
|
||||
import resonantinduction.core.resource.fluid.TileFluidMixture;
|
||||
import resonantinduction.electrical.battery.BlockBattery;
|
||||
import resonantinduction.electrical.battery.ItemBlockBattery;
|
||||
import resonantinduction.electrical.battery.TileBattery;
|
||||
|
@ -19,10 +25,20 @@ import resonantinduction.electrical.tesla.TileTesla;
|
|||
import resonantinduction.electrical.transformer.ItemTransformer;
|
||||
import resonantinduction.electrical.wire.EnumWireMaterial;
|
||||
import resonantinduction.electrical.wire.ItemWire;
|
||||
import resonantinduction.mechanical.grinder.BlockGrinderWheel;
|
||||
import resonantinduction.mechanical.grinder.TileGrinderWheel;
|
||||
import resonantinduction.mechanical.grinder.TilePurifier;
|
||||
import resonantinduction.old.mechanics.furnace.BlockAdvancedFurnace;
|
||||
import resonantinduction.old.mechanics.furnace.TileAdvancedFurnace;
|
||||
import resonantinduction.old.mechanics.purifier.BlockPurifier;
|
||||
import resonantinduction.old.transport.levitator.BlockLevitator;
|
||||
import resonantinduction.old.transport.levitator.ItemBlockContractor;
|
||||
import resonantinduction.old.transport.levitator.TileEMLevitator;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.recipe.UniversalRecipe;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
|
@ -57,15 +73,19 @@ public class Electrical
|
|||
@Mod.Metadata(ID)
|
||||
public static ModMetadata metadata;
|
||||
|
||||
// Items
|
||||
// Energy
|
||||
private static Item itemPartWire;
|
||||
public static Item itemMultimeter;
|
||||
public static Item itemTransformer;
|
||||
|
||||
// Blocks
|
||||
public static Block blockTesla;
|
||||
public static Block blockBattery;
|
||||
|
||||
// Transport
|
||||
public static Block blockEMContractor;
|
||||
|
||||
// Machines
|
||||
public static Block blockAdvancedFurnace, blockMachinePart, blockGrinderWheel, blockPurifier;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
{
|
||||
|
@ -73,26 +93,49 @@ public class Electrical
|
|||
|
||||
Settings.CONFIGURATION.load();
|
||||
|
||||
// Items
|
||||
// Energy
|
||||
itemPartWire = new ItemWire(Settings.getNextItemID());
|
||||
itemMultimeter = new ItemMultimeter(Settings.getNextItemID());
|
||||
itemTransformer = new ItemTransformer(Settings.getNextItemID());
|
||||
|
||||
// Blocks
|
||||
blockTesla = new BlockTesla(Settings.getNextBlockID());
|
||||
blockBattery = new BlockBattery(Settings.getNextBlockID());
|
||||
|
||||
// Transport
|
||||
blockEMContractor = new BlockLevitator();
|
||||
|
||||
// Machines
|
||||
blockMachinePart = new BlockMachinePart();
|
||||
blockGrinderWheel = new BlockGrinderWheel(Settings.getNextBlockID());
|
||||
blockPurifier = new BlockPurifier(Settings.getNextBlockID());
|
||||
|
||||
if (Settings.REPLACE_FURNACE)
|
||||
{
|
||||
blockAdvancedFurnace = BlockAdvancedFurnace.createNew(false);
|
||||
GameRegistry.registerBlock(blockAdvancedFurnace, "ri_" + blockAdvancedFurnace.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileAdvancedFurnace.class, "ri_" + blockAdvancedFurnace.getUnlocalizedName());
|
||||
}
|
||||
|
||||
Settings.CONFIGURATION.save();
|
||||
|
||||
GameRegistry.registerItem(itemMultimeter, itemMultimeter.getUnlocalizedName());
|
||||
GameRegistry.registerItem(itemTransformer, itemTransformer.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerBlock(blockTesla, blockTesla.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockBattery, ItemBlockBattery.class, blockBattery.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockGrinderWheel, blockGrinderWheel.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockPurifier, blockPurifier.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockMachinePart, blockMachinePart.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockEMContractor, ItemBlockContractor.class, blockEMContractor.getUnlocalizedName());
|
||||
|
||||
// Tiles
|
||||
GameRegistry.registerTileEntity(TileTesla.class, blockTesla.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileBattery.class, blockBattery.getUnlocalizedName());
|
||||
|
||||
// Tiles
|
||||
GameRegistry.registerTileEntity(TilePurifier.class, blockPurifier.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileGrinderWheel.class, blockGrinderWheel.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileEMLevitator.class, blockEMContractor.getUnlocalizedName());
|
||||
|
||||
/**
|
||||
* Set reference itemstacks
|
||||
*/
|
||||
|
@ -102,7 +145,9 @@ public class Electrical
|
|||
{
|
||||
material.setWire(itemPartWire);
|
||||
}
|
||||
|
||||
proxy.preInit();
|
||||
Settings.CONFIGURATION.save();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -154,5 +199,35 @@ public class Electrical
|
|||
}
|
||||
|
||||
proxy.postInit();
|
||||
/** Inject new furnace tile class */
|
||||
replaceTileEntity(TileEntityFurnace.class, TileAdvancedFurnace.class);
|
||||
}
|
||||
|
||||
public static void replaceTileEntity(Class<? extends TileEntity> findTile, Class<? extends TileEntity> replaceTile)
|
||||
{
|
||||
try
|
||||
{
|
||||
Map<String, Class> nameToClassMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_a", "nameToClassMap", "a");
|
||||
Map<Class, String> classToNameMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_b", "classToNameMap", "b");
|
||||
|
||||
String findTileID = classToNameMap.get(findTile);
|
||||
|
||||
if (findTileID != null)
|
||||
{
|
||||
nameToClassMap.put(findTileID, replaceTile);
|
||||
classToNameMap.put(replaceTile, findTileID);
|
||||
classToNameMap.remove(findTile);
|
||||
ResonantInduction.LOGGER.fine("Replaced TileEntity: " + findTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
ResonantInduction.LOGGER.severe("Failed to replace TileEntity: " + findTile);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ResonantInduction.LOGGER.severe("Failed to replace TileEntity: " + findTile);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.link.ILinkable;
|
||||
import resonantinduction.core.handler.ILinkable;
|
||||
import resonantinduction.electrical.Electrical;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.entity.item.EntityItem;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.resource.ItemDust;
|
||||
import resonantinduction.core.resource.item.ItemDust;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.tile.TileElectrical;
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraftforge.common.Configuration;
|
|||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import resonantinduction.core.resource.ItemParts.Parts;
|
||||
import resonantinduction.core.resource.item.ItemParts.Parts;
|
||||
import resonantinduction.old.core.ItemOreDirv;
|
||||
import resonantinduction.old.core.misc.EnumTool;
|
||||
import resonantinduction.old.mechanics.processor.BlockProcessor;
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
package resonantinduction.old.mechanics;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.electrical.fx.FXElectricBolt;
|
||||
import resonantinduction.electrical.multimeter.GuiMultimeter;
|
||||
import resonantinduction.electrical.multimeter.PartMultimeter;
|
||||
import resonantinduction.old.core.render.BlockRenderingHandler;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
@Override
|
||||
public void preInit()
|
||||
{
|
||||
RenderingRegistry.registerBlockHandler(BlockRenderingHandler.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileMultipart)
|
||||
{
|
||||
TMultiPart part = ((TileMultipart) tileEntity).partMap(id);
|
||||
|
||||
if (part instanceof PartMultimeter)
|
||||
{
|
||||
return new GuiMultimeter(player.inventory, (PartMultimeter) part);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPaused()
|
||||
{
|
||||
if (FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient().getIntegratedServer().getPublic())
|
||||
{
|
||||
GuiScreen screen = FMLClientHandler.instance().getClient().currentScreen;
|
||||
|
||||
if (screen != null)
|
||||
{
|
||||
if (screen.doesGuiPauseGame())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFancy()
|
||||
{
|
||||
return FMLClientHandler.instance().getClient().gameSettings.fancyGraphics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderElectricShock(World world, Vector3 start, Vector3 target, float r, float g, float b, boolean split)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new FXElectricBolt(world, start, target, split).setColor(r, g, b));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package resonantinduction.old.mechanics;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.electrical.multimeter.ContainerMultimeter;
|
||||
import resonantinduction.electrical.multimeter.PartMultimeter;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class CommonProxy implements IGuiHandler
|
||||
{
|
||||
public void preInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileMultipart)
|
||||
{
|
||||
TMultiPart part = ((TileMultipart) tileEntity).partMap(id);
|
||||
if (part instanceof PartMultimeter)
|
||||
{
|
||||
return new ContainerMultimeter(player.inventory, ((PartMultimeter) part));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,213 +0,0 @@
|
|||
package resonantinduction.old.mechanics;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import org.modstats.Modstats;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.prefab.part.PacketMultiPart;
|
||||
import resonantinduction.core.resource.BlockFluidMixture;
|
||||
import resonantinduction.core.resource.ResourceGenerator;
|
||||
import resonantinduction.core.resource.TileFluidMixture;
|
||||
import resonantinduction.electrical.MultipartElectrical;
|
||||
import resonantinduction.mechanical.grinder.BlockGrinderWheel;
|
||||
import resonantinduction.mechanical.grinder.TileGrinderWheel;
|
||||
import resonantinduction.mechanical.grinder.TilePurifier;
|
||||
import resonantinduction.old.mechanics.furnace.BlockAdvancedFurnace;
|
||||
import resonantinduction.old.mechanics.furnace.TileAdvancedFurnace;
|
||||
import resonantinduction.old.mechanics.purifier.BlockPurifier;
|
||||
import calclavia.lib.network.PacketTile;
|
||||
import calclavia.lib.utility.LanguageUtility;
|
||||
import codechicken.lib.colour.ColourRGBA;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* The core module of Resonant Induction
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
//@Mod(modid = ResonantInductionMechanics.ID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:ResonantInduction|Core")
|
||||
//@NetworkMod(channels = Reference.CHANNEL, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class ResonantInductionMechanics
|
||||
{
|
||||
/**
|
||||
* Mod Information
|
||||
*/
|
||||
public static final String ID = "ResonantInduction|Mechanics";
|
||||
|
||||
@Instance(ID)
|
||||
public static ResonantInductionMechanics INSTANCE;
|
||||
|
||||
//@SidedProxy(clientSide = "resonantinduction.mechanics.ClientProxy", serverSide = "resonantinduction.mechanics.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Mod.Metadata(ID)
|
||||
public static ModMetadata metadata;
|
||||
|
||||
// Items
|
||||
|
||||
/**
|
||||
* Machines
|
||||
*/
|
||||
|
||||
// Blocks
|
||||
public static Block blockAdvancedFurnace, blockMachinePart, blockGrinderWheel, blockPurifier,
|
||||
blockFluidMixture;
|
||||
|
||||
public static Fluid MIXTURE;
|
||||
|
||||
/**
|
||||
* Packets
|
||||
*/
|
||||
public static final PacketTile PACKET_TILE = new PacketTile(Reference.CHANNEL);
|
||||
public static final PacketMultiPart PACKET_MULTIPART = new PacketMultiPart(Reference.CHANNEL);
|
||||
public static final ColourRGBA[] DYE_COLORS = new ColourRGBA[] { new ColourRGBA(255, 255, 255, 255), new ColourRGBA(1, 0, 0, 1d), new ColourRGBA(0, 0.608, 0.232, 1d), new ColourRGBA(0.588, 0.294, 0, 1d), new ColourRGBA(0, 0, 1, 1d), new ColourRGBA(0.5, 0, 05, 1d), new ColourRGBA(0, 1, 1, 1d), new ColourRGBA(0.8, 0.8, 0.8, 1d), new ColourRGBA(0.3, 0.3, 0.3, 1d), new ColourRGBA(1, 0.412, 0.706, 1d), new ColourRGBA(0.616, 1, 0, 1d), new ColourRGBA(1, 1, 0, 1d), new ColourRGBA(0.46f, 0.932, 1, 1d), new ColourRGBA(0.5, 0.2, 0.5, 1d), new ColourRGBA(0.7, 0.5, 0.1, 1d), new ColourRGBA(1, 1, 1, 1d) };
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
{
|
||||
ResonantInduction.LOGGER.setParent(FMLLog.getLogger());
|
||||
NetworkRegistry.instance().registerGuiHandler(this, ResonantInductionMechanics.proxy);
|
||||
Modstats.instance().getReporter().registerMod(this);
|
||||
Settings.CONFIGURATION.load();
|
||||
|
||||
// Blocks
|
||||
blockMachinePart = new BlockMachinePart(Settings.getNextBlockID());
|
||||
blockGrinderWheel = new BlockGrinderWheel(Settings.getNextBlockID());
|
||||
blockPurifier = new BlockPurifier(Settings.getNextBlockID());
|
||||
|
||||
MIXTURE = new Fluid("mixture");
|
||||
FluidRegistry.registerFluid(MIXTURE);
|
||||
blockFluidMixture = new BlockFluidMixture(Settings.getNextBlockID(), MIXTURE);
|
||||
|
||||
if (Settings.REPLACE_FURNACE)
|
||||
{
|
||||
blockAdvancedFurnace = BlockAdvancedFurnace.createNew(false);
|
||||
GameRegistry.registerBlock(blockAdvancedFurnace, "ri_" + blockAdvancedFurnace.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileAdvancedFurnace.class, "ri_" + blockAdvancedFurnace.getUnlocalizedName());
|
||||
}
|
||||
|
||||
Settings.CONFIGURATION.save();
|
||||
|
||||
GameRegistry.registerBlock(blockGrinderWheel, blockGrinderWheel.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockPurifier, blockPurifier.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockFluidMixture, blockFluidMixture.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockMachinePart, blockMachinePart.getUnlocalizedName());
|
||||
|
||||
// Tiles
|
||||
GameRegistry.registerTileEntity(TilePurifier.class, blockPurifier.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileGrinderWheel.class, blockGrinderWheel.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileFluidMixture.class, blockFluidMixture.getUnlocalizedName());
|
||||
|
||||
ResonantInductionMechanics.proxy.preInit();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent evt)
|
||||
{
|
||||
metadata.modId = ID;
|
||||
metadata.name = Reference.NAME;
|
||||
metadata.description = LanguageUtility.getLocal("meta.resonantinduction.description");
|
||||
metadata.url = "http://calclavia.com/resonant-induction";
|
||||
metadata.logoFile = "ri_logo.png";
|
||||
metadata.version = Reference.VERSION + "." + Reference.BUILD_VERSION;
|
||||
metadata.authorList = Arrays.asList(new String[] { "Calclavia", "DarkCow" });
|
||||
metadata.credits = LanguageUtility.getLocal("meta.resonantinduction.credits");
|
||||
metadata.autogenerated = false;
|
||||
|
||||
MultipartElectrical.INSTANCE = new MultipartElectrical();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent evt)
|
||||
{
|
||||
/**
|
||||
* Recipes
|
||||
*/
|
||||
/** Auto-gen dusts */
|
||||
ResourceGenerator.generateDusts();
|
||||
ResonantInductionMechanics.proxy.postInit();
|
||||
|
||||
/** Inject new furnace tile class */
|
||||
replaceTileEntity(TileEntityFurnace.class, TileAdvancedFurnace.class);
|
||||
}
|
||||
|
||||
public static void replaceTileEntity(Class<? extends TileEntity> findTile, Class<? extends TileEntity> replaceTile)
|
||||
{
|
||||
try
|
||||
{
|
||||
Map<String, Class> nameToClassMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_a", "nameToClassMap", "a");
|
||||
Map<Class, String> classToNameMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_b", "classToNameMap", "b");
|
||||
|
||||
String findTileID = classToNameMap.get(findTile);
|
||||
|
||||
if (findTileID != null)
|
||||
{
|
||||
nameToClassMap.put(findTileID, replaceTile);
|
||||
classToNameMap.put(replaceTile, findTileID);
|
||||
classToNameMap.remove(findTile);
|
||||
ResonantInduction.LOGGER.fine("Replaced TileEntity: " + findTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
ResonantInduction.LOGGER.severe("Failed to replace TileEntity: " + findTile);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ResonantInduction.LOGGER.severe("Failed to replace TileEntity: " + findTile);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static final HashMap<String, Icon> fluidIconMap = new HashMap<String, Icon>();
|
||||
|
||||
public void registerIcon(String name, TextureStitchEvent.Pre event)
|
||||
{
|
||||
fluidIconMap.put(name, event.map.registerIcon(name));
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preTextureHook(TextureStitchEvent.Pre event)
|
||||
{
|
||||
if (event.map.textureType == 0)
|
||||
{
|
||||
registerIcon(Reference.PREFIX + "mixture", event);
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void textureHook(TextureStitchEvent.Post event)
|
||||
{
|
||||
MIXTURE.setIcons(fluidIconMap.get(Reference.PREFIX + "mixture"));
|
||||
}
|
||||
|
||||
}
|
|
@ -28,9 +28,9 @@ import resonantinduction.core.resource.BlockGasOre;
|
|||
import resonantinduction.core.resource.BlockOre;
|
||||
import resonantinduction.core.resource.BlockOre.OreData;
|
||||
import resonantinduction.core.resource.GasOreGenerator;
|
||||
import resonantinduction.core.resource.ItemBlockOre;
|
||||
import resonantinduction.core.resource.ItemParts;
|
||||
import resonantinduction.core.resource.ItemParts.Parts;
|
||||
import resonantinduction.core.resource.item.ItemBlockOre;
|
||||
import resonantinduction.core.resource.item.ItemParts;
|
||||
import resonantinduction.core.resource.item.ItemParts.Parts;
|
||||
import resonantinduction.core.tilenetwork.prefab.NetworkUpdateHandler;
|
||||
import resonantinduction.electrical.armbot.BlockArmbot;
|
||||
import resonantinduction.electrical.armbot.command.TaskBreak;
|
||||
|
@ -135,7 +135,8 @@ public class ResonantInductionTransport
|
|||
public static String LANGUAGE_PATH = DIRECTORY + "languages/";
|
||||
public static String SOUND_PATH = DIRECTORY + "audio/";
|
||||
|
||||
//@SidedProxy(clientSide = "com.builtbroken.assemblyline.client.ClientProxy", serverSide = "com.builtbroken.assemblyline.CommonProxy")
|
||||
// @SidedProxy(clientSide = "com.builtbroken.assemblyline.client.ClientProxy", serverSide =
|
||||
// "com.builtbroken.assemblyline.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Instance(ResonantInductionTransport.MOD_ID)
|
||||
|
@ -156,8 +157,6 @@ public class ResonantInductionTransport
|
|||
|
||||
private static PacketIDTile tilePacket;
|
||||
|
||||
public static Block blockEMContractor;
|
||||
|
||||
public static PacketIDTile getTilePacket()
|
||||
{
|
||||
if (tilePacket == null)
|
||||
|
@ -172,10 +171,6 @@ public class ResonantInductionTransport
|
|||
{
|
||||
CONFIGURATION.load();
|
||||
|
||||
blockEMContractor = new BlockLevitator(Settings.getNextBlockID());
|
||||
GameRegistry.registerBlock(blockEMContractor, ItemBlockContractor.class, blockEMContractor.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileEMLevitator.class, blockEMContractor.getUnlocalizedName());
|
||||
|
||||
DarkCore.instance().preLoad();
|
||||
Modstats.instance().getReporter().registerMod(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.link.ILinkable;
|
||||
import resonantinduction.core.handler.ILinkable;
|
||||
import resonantinduction.electrical.tesla.TileTesla;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.api.vector.VectorWorld;
|
||||
|
|
Loading…
Add table
Reference in a new issue