diff --git a/src/api/java/appeng/api/AEApi.java b/src/api/java/appeng/api/AEApi.java index baa06a573..daea9cfd1 100644 --- a/src/api/java/appeng/api/AEApi.java +++ b/src/api/java/appeng/api/AEApi.java @@ -31,8 +31,6 @@ import appeng.api.exceptions.CoreInaccessibleException; /** * Entry point for api. - * - * Available IMCs: */ public enum AEApi { diff --git a/src/api/java/appeng/api/movable/IMovableRegistry.java b/src/api/java/appeng/api/movable/IMovableRegistry.java index be11050b5..c4dbb3c35 100644 --- a/src/api/java/appeng/api/movable/IMovableRegistry.java +++ b/src/api/java/appeng/api/movable/IMovableRegistry.java @@ -33,12 +33,10 @@ import net.minecraft.tileentity.TileEntity; * * 1. The Tile or its super classes have been white listed with whiteListTileEntity. * - * 2. The Tile has been register with the IMC ( which basically calls whiteListTileEntity. ) + * 2. The Tile implements IMovableTile * - * 3. The Tile implements IMovableTile 4. A IMovableHandler is register that returns canHandle = true for the Tile - * Entity Class + * 3. A IMovableHandler is register that returns canHandle = true for the {@link TileEntity} subclass * - * IMC Example: FMLInterModComms.sendMessage( "appliedenergistics2", "movabletile", "appeng.common.AppEngTile" ); * * The movement process is as follows, * @@ -61,9 +59,6 @@ public interface IMovableRegistry /** * Black list a block from movement, please only use this to prevent exploits. * - * You can also use the IMC, FMLInterModComms.sendMessage( "appliedenergistics2", "whitelist-spatial", - * "appeng.common.AppEngTile" ); - * * @param blk block */ void blacklistBlock( Block blk ); @@ -71,9 +66,6 @@ public interface IMovableRegistry /** * White list your tile entity with the registry. * - * You can also use the IMC, FMLInterModComms.sendMessage( "appliedenergistics2", "blacklist-block-spatial", new - * ItemStack(...) ); - * * If you tile is handled with IMovableHandler or IMovableTile you do not need to white list it. */ void whiteListTileEntity( Class c ); diff --git a/src/main/java/appeng/core/AppEng.java b/src/main/java/appeng/core/AppEng.java index cb951e5b4..b137fa965 100644 --- a/src/main/java/appeng/core/AppEng.java +++ b/src/main/java/appeng/core/AppEng.java @@ -323,14 +323,6 @@ public final class AppEng AELog.info( "Post Initialization ( ended after " + start.elapsed( TimeUnit.MILLISECONDS ) + "ms )" ); } -// @EventHandler -// private void handleIMCEvent( final FMLInterModComms.IMCEvent event ) -// { -// final IMCHandler imcHandler = new IMCHandler(); -// -// imcHandler.handleIMCEvent( event ); -// } - private void serverAboutToStart( final FMLServerStartedEvent evt ) { WorldData.onServerAboutToStart( evt.getServer() ); diff --git a/src/main/java/appeng/core/IMCHandler.java b/src/main/java/appeng/core/IMCHandler.java deleted file mode 100644 index 592da5cae..000000000 --- a/src/main/java/appeng/core/IMCHandler.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.core; - - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -import net.minecraftforge.fml.common.event.FMLInterModComms; - -import appeng.api.config.TunnelType; -import appeng.core.api.IIMCProcessor; -import appeng.core.api.imc.IMCBlackListSpatial; -import appeng.core.api.imc.IMCGrinder; -import appeng.core.api.imc.IMCMatterCannon; -import appeng.core.api.imc.IMCP2PAttunement; -import appeng.core.api.imc.IMCSpatial; - - -/** - * Handles the delegation of the corresponding IMC messages to the suitable IMC processors - * - * @author thatsIch - * @version rv3 - 10.08.2015 - * @since rv1 - */ -public class IMCHandler -{ - private static final int INITIAL_PROCESSORS_CAPACITY = 20; - - /** - * Contains the processors, - * - * is mutable, but write access only by the constructor - */ - private final Map processors; - - /** - * Initializes the processors - */ - public IMCHandler() - { - this.processors = new HashMap<>( INITIAL_PROCESSORS_CAPACITY ); - - this.processors.put( "blacklist-block-spatial", new IMCBlackListSpatial() ); - this.processors.put( "whitelist-spatial", new IMCSpatial() ); - this.processors.put( "add-grindable", new IMCGrinder() ); - this.processors.put( "add-mattercannon-ammo", new IMCMatterCannon() ); - - for( final TunnelType type : TunnelType.values() ) - { - this.processors.put( "add-p2p-attunement-" + type.name().replace( '_', '-' ).toLowerCase( Locale.ENGLISH ), new IMCP2PAttunement() ); - } - } - - /** - * Tries to find every message matching the internal IMC keys. When found the corresponding handler will process the - * attached message. - * - * @param event Event carrying the identifier and message for the handlers - */ - void handleIMCEvent( final FMLInterModComms.IMCEvent event ) - { - for( final FMLInterModComms.IMCMessage message : event.getMessages() ) - { - final String key = message.key; - - try - { - final IIMCProcessor handler = this.processors.get( key ); - if( handler != null ) - { - handler.process( message ); - } - else - { - throw new IllegalStateException( "Invalid IMC Called: " + key ); - } - } - catch( final Exception t ) - { - AELog.warn( "Problem detected when processing IMC " + key + " from " + message.getSender() ); - AELog.debug( t ); - } - } - } -} diff --git a/src/main/java/appeng/core/api/IIMCProcessor.java b/src/main/java/appeng/core/api/IIMCProcessor.java deleted file mode 100644 index 77e41ac02..000000000 --- a/src/main/java/appeng/core/api/IIMCProcessor.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.core.api; - -import net.minecraftforge.fml.InterModComms.IMCMessage; - -public interface IIMCProcessor -{ - void process( IMCMessage m ); -}