2017-02-26 13:56:36 +01:00
|
|
|
/*
|
2016-09-29 16:19:16 +02:00
|
|
|
* This file is part of Industrial Wires.
|
2017-02-26 13:56:36 +01:00
|
|
|
* Copyright (C) 2016-2017 malte0811
|
2016-09-29 16:19:16 +02:00
|
|
|
*
|
|
|
|
* Industrial Wires is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Industrial Wires is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
|
2017-02-26 13:56:36 +01:00
|
|
|
*/
|
2016-09-15 20:43:18 +02:00
|
|
|
package malte0811.industrialWires;
|
|
|
|
|
2017-02-26 13:56:36 +01:00
|
|
|
import malte0811.industrialWires.blocks.BlockJacobsLadder;
|
|
|
|
import malte0811.industrialWires.blocks.TileEntityJacobsLadder;
|
2017-06-30 21:04:02 +02:00
|
|
|
import malte0811.industrialWires.blocks.controlpanel.*;
|
2016-12-13 21:00:07 +01:00
|
|
|
import malte0811.industrialWires.blocks.converter.BlockMechanicalConverter;
|
|
|
|
import malte0811.industrialWires.blocks.converter.TileEntityIEMotor;
|
|
|
|
import malte0811.industrialWires.blocks.converter.TileEntityMechICtoIE;
|
|
|
|
import malte0811.industrialWires.blocks.converter.TileEntityMechIEtoIC;
|
2017-04-04 17:07:45 +02:00
|
|
|
import malte0811.industrialWires.blocks.wire.*;
|
2016-09-15 20:43:18 +02:00
|
|
|
import malte0811.industrialWires.items.ItemIC2Coil;
|
2017-05-18 18:13:08 +02:00
|
|
|
import malte0811.industrialWires.items.ItemKey;
|
2017-04-13 17:14:05 +02:00
|
|
|
import malte0811.industrialWires.items.ItemPanelComponent;
|
2017-04-09 16:59:57 +02:00
|
|
|
import malte0811.industrialWires.network.MessageGUIInteract;
|
2017-05-18 18:13:08 +02:00
|
|
|
import malte0811.industrialWires.network.MessageItemSync;
|
2017-04-04 17:07:45 +02:00
|
|
|
import malte0811.industrialWires.network.MessagePanelInteract;
|
2017-02-26 13:56:36 +01:00
|
|
|
import malte0811.industrialWires.network.MessageTileSyncIW;
|
2016-09-15 20:43:18 +02:00
|
|
|
import malte0811.industrialWires.wires.IC2Wiretype;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
2017-05-13 20:13:40 +02:00
|
|
|
import net.minecraft.item.Item;
|
2016-09-15 20:43:18 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
|
|
|
import net.minecraftforge.fml.common.SidedProxy;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
2017-05-13 20:13:40 +02:00
|
|
|
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
|
2016-09-15 20:43:18 +02:00
|
|
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
2017-02-26 13:56:36 +01:00
|
|
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
|
|
|
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
2016-09-15 20:43:18 +02:00
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
2017-02-26 13:56:36 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
2017-04-04 17:07:45 +02:00
|
|
|
|
2017-05-10 17:56:05 +02:00
|
|
|
@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies = "required-after:immersiveengineering@[0.10-58,);required-after:ic2")
|
2016-09-15 20:43:18 +02:00
|
|
|
public class IndustrialWires {
|
|
|
|
public static final String MODID = "industrialwires";
|
|
|
|
public static final String VERSION = "${version}";
|
|
|
|
public static BlockIC2Connector ic2conn;
|
2016-12-13 21:00:07 +01:00
|
|
|
public static BlockMechanicalConverter mechConv;
|
2017-02-26 13:56:36 +01:00
|
|
|
public static BlockJacobsLadder jacobsLadder;
|
2017-03-24 17:40:05 +01:00
|
|
|
public static BlockPanel panel;
|
2016-09-15 20:43:18 +02:00
|
|
|
public static ItemIC2Coil coil;
|
2017-04-13 17:14:05 +02:00
|
|
|
public static ItemPanelComponent panelComponent;
|
2017-05-18 18:13:08 +02:00
|
|
|
public static ItemKey key;
|
2017-02-26 13:56:36 +01:00
|
|
|
public static final SimpleNetworkWrapper packetHandler = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
|
2017-04-09 16:59:57 +02:00
|
|
|
@Mod.Instance(MODID)
|
|
|
|
public static IndustrialWires instance = new IndustrialWires();
|
2016-09-15 20:43:18 +02:00
|
|
|
public static CreativeTabs creativeTab = new CreativeTabs(MODID) {
|
2016-12-19 18:16:46 +01:00
|
|
|
|
2016-09-15 20:43:18 +02:00
|
|
|
@Override
|
2017-05-10 17:56:05 +02:00
|
|
|
public ItemStack getTabIconItem() {
|
2016-09-15 20:43:18 +02:00
|
|
|
return new ItemStack(coil, 1, 2);
|
|
|
|
}
|
|
|
|
};
|
2017-05-11 16:39:20 +02:00
|
|
|
@SidedProxy(clientSide = "malte0811.industrialWires.client.ClientProxy", serverSide = "malte0811.industrialWires.CommonProxy")
|
2016-09-15 20:43:18 +02:00
|
|
|
public static CommonProxy proxy;
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void preInit(FMLPreInitializationEvent e) {
|
2016-12-13 21:00:07 +01:00
|
|
|
new IWConfig();
|
2016-09-15 20:43:18 +02:00
|
|
|
ic2conn = new BlockIC2Connector();
|
2016-12-20 17:05:20 +01:00
|
|
|
if (IWConfig.enableConversion)
|
|
|
|
mechConv = new BlockMechanicalConverter();
|
2017-02-26 13:56:36 +01:00
|
|
|
jacobsLadder = new BlockJacobsLadder();
|
2017-05-18 18:13:08 +02:00
|
|
|
panel = new BlockPanel();
|
|
|
|
|
2016-09-15 20:43:18 +02:00
|
|
|
coil = new ItemIC2Coil();
|
2017-04-13 17:14:05 +02:00
|
|
|
panelComponent = new ItemPanelComponent();
|
2017-05-18 18:13:08 +02:00
|
|
|
key = new ItemKey();
|
|
|
|
|
2017-05-10 17:56:05 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, MODID + "ic2ConnectorTin");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, MODID + "ic2ConnectorCopper");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, MODID + "ic2ConnectorGold");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorHV.class, MODID + "ic2ConnectorHV");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGlass.class, MODID + "ic2ConnectorGlass");
|
2017-05-11 16:39:20 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityJacobsLadder.class, MODID + ":jacobsLadder");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityPanel.class, MODID + ":control_panel");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityRSPanelConn.class, MODID + ":control_panel_rs");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityPanelCreator.class, MODID + ":panel_creator");
|
2017-06-30 21:04:02 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityUnfinishedPanel.class, MODID + ":unfinished_panel");
|
2017-05-11 16:39:20 +02:00
|
|
|
if (mechConv != null) {
|
|
|
|
GameRegistry.registerTileEntity(TileEntityIEMotor.class, MODID + ":ieMotor");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityMechICtoIE.class, MODID + ":mechIcToIe");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityMechIEtoIC.class, MODID + ":mechIeToIc");
|
2016-12-20 17:05:20 +01:00
|
|
|
}
|
2017-05-11 16:39:20 +02:00
|
|
|
if (IC2Wiretype.IC2_TYPES == null) {
|
2016-09-15 20:43:18 +02:00
|
|
|
throw new IllegalStateException("No IC2 wires registered");
|
|
|
|
}
|
|
|
|
proxy.preInit();
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void init(FMLInitializationEvent e) {
|
2017-05-19 17:45:30 +02:00
|
|
|
Recipes.addRecipes();
|
2017-03-03 19:04:08 +01:00
|
|
|
|
2017-05-15 21:40:43 +02:00
|
|
|
ExtraIC2Compat.addToolConmpat();
|
|
|
|
|
2017-02-26 13:56:36 +01:00
|
|
|
packetHandler.registerMessage(MessageTileSyncIW.HandlerClient.class, MessageTileSyncIW.class, 0, Side.CLIENT);
|
2017-04-04 17:07:45 +02:00
|
|
|
packetHandler.registerMessage(MessagePanelInteract.HandlerServer.class, MessagePanelInteract.class, 1, Side.SERVER);
|
2017-04-09 16:59:57 +02:00
|
|
|
packetHandler.registerMessage(MessageGUIInteract.HandlerServer.class, MessageGUIInteract.class, 2, Side.SERVER);
|
2017-05-18 18:13:08 +02:00
|
|
|
packetHandler.registerMessage(MessageItemSync.HandlerServer.class, MessageItemSync.class, 3, Side.SERVER);
|
2017-04-09 16:59:57 +02:00
|
|
|
|
|
|
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
2016-09-15 20:43:18 +02:00
|
|
|
}
|
2017-05-11 16:39:20 +02:00
|
|
|
|
2016-09-15 20:43:18 +02:00
|
|
|
@EventHandler
|
2017-05-11 16:39:20 +02:00
|
|
|
public void postInit(FMLPostInitializationEvent e) {
|
2016-09-15 20:43:18 +02:00
|
|
|
proxy.postInit();
|
|
|
|
}
|
2017-05-11 16:39:20 +02:00
|
|
|
|
2017-05-13 20:13:40 +02:00
|
|
|
@EventHandler
|
|
|
|
public void remap(FMLMissingMappingsEvent ev) {
|
|
|
|
for (FMLMissingMappingsEvent.MissingMapping miss : ev.get()) {
|
2017-05-20 17:14:43 +02:00
|
|
|
String name = miss.resourceLocation.getResourcePath();
|
|
|
|
switch (name) {
|
|
|
|
case "ic2connector":
|
|
|
|
if (miss.type == GameRegistry.Type.ITEM) {
|
2017-05-13 20:13:40 +02:00
|
|
|
miss.remap(Item.getItemFromBlock(IndustrialWires.ic2conn));
|
|
|
|
} else {
|
|
|
|
miss.remap(IndustrialWires.ic2conn);
|
|
|
|
}
|
2017-05-20 17:14:43 +02:00
|
|
|
break;
|
|
|
|
case "ic2wirecoil":
|
|
|
|
miss.remap(IndustrialWires.coil);
|
|
|
|
break;
|
2017-05-13 20:13:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-09-15 20:43:18 +02:00
|
|
|
}
|