From c4fa21c193d89d9ea16e3eaf958c1b2e4f44cf98 Mon Sep 17 00:00:00 2001 From: yueh Date: Thu, 17 Aug 2017 21:16:57 +0200 Subject: [PATCH] Removes coremod (#3038) From now on every integration must not rely on method stripping through a coremod or @Optional. Notable example for a very good solution is IC2. As consequence this drops all support for RF and mods must support on of our supported energy types. At the time of writing, ForgeEnergy and IC2/EU. --- build.gradle | 3 - .../java/appeng/api/config/TunnelType.java | 1 - .../java/appeng/api/definitions/IParts.java | 2 - src/main/java/appeng/client/ClientHelper.java | 7 - src/main/java/appeng/core/AppEng.java | 12 +- src/main/java/appeng/core/CommonHelper.java | 2 - src/main/java/appeng/core/Registration.java | 10 - .../appeng/core/api/definitions/ApiParts.java | 8 - .../java/appeng/core/features/AEFeature.java | 1 - .../registries/P2PTunnelRegistry.java | 34 +- .../appeng/core/localization/GuiText.java | 1 - src/main/java/appeng/coremod/AppEngCore.java | 133 ------- .../java/appeng/coremod/MissingCoreMod.java | 100 ------ .../coremod/annotations/Integration.java | 54 --- .../coremod/transformer/ASMIntegration.java | 255 -------------- .../appeng/integration/IntegrationType.java | 19 - .../java/appeng/integration/Integrations.java | 9 - .../appeng/integration/abstraction/IRF.java | 34 -- .../integration/modules/rf/RFModule.java | 39 --- .../java/appeng/items/parts/PartType.java | 11 - .../tools/powered/powersink/RedstoneFlux.java | 66 ---- .../parts/layers/LayerIEnergyHandler.java | 95 ----- .../java/appeng/parts/p2p/PartP2PRFPower.java | 236 ------------- .../java/appeng/parts/p2p/PartP2PTunnel.java | 4 - src/main/java/appeng/server/ServerHelper.java | 6 - .../tile/powersink/AEBasePoweredTile.java | 303 +++++++++++++++- .../tile/powersink/AERootPoweredTile.java | 326 ------------------ .../appeng/tile/powersink/RedstoneFlux.java | 65 ---- .../appliedenergistics2/lang/cs_cz.lang | 1 - .../appliedenergistics2/lang/de_de.lang | 1 - .../appliedenergistics2/lang/en_us.lang | 1 - .../appliedenergistics2/lang/es_es.lang | 1 - .../appliedenergistics2/lang/fr_fr.lang | 1 - .../appliedenergistics2/lang/hu_hu.lang | 1 - .../appliedenergistics2/lang/it_it.lang | 1 - .../appliedenergistics2/lang/ko_kr.lang | 1 - .../appliedenergistics2/lang/pt_br.lang | 1 - .../appliedenergistics2/lang/ru_ru.lang | 1 - .../appliedenergistics2/lang/zh_cn.lang | 1 - .../appliedenergistics2/lang/zh_tw.lang | 1 - .../models/item/part/p2p_tunnel_rf.json | 6 - .../models/part/p2p/p2p_tunnel_rf.json | 6 - .../java/appeng/coremod/AppEngCoreTest.java | 56 --- 43 files changed, 320 insertions(+), 1596 deletions(-) delete mode 100644 src/main/java/appeng/coremod/AppEngCore.java delete mode 100644 src/main/java/appeng/coremod/MissingCoreMod.java delete mode 100644 src/main/java/appeng/coremod/annotations/Integration.java delete mode 100644 src/main/java/appeng/coremod/transformer/ASMIntegration.java delete mode 100644 src/main/java/appeng/integration/abstraction/IRF.java delete mode 100644 src/main/java/appeng/integration/modules/rf/RFModule.java delete mode 100644 src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java delete mode 100644 src/main/java/appeng/parts/layers/LayerIEnergyHandler.java delete mode 100644 src/main/java/appeng/parts/p2p/PartP2PRFPower.java delete mode 100644 src/main/java/appeng/tile/powersink/AERootPoweredTile.java delete mode 100644 src/main/java/appeng/tile/powersink/RedstoneFlux.java delete mode 100644 src/main/resources/assets/appliedenergistics2/models/item/part/p2p_tunnel_rf.json delete mode 100644 src/main/resources/assets/appliedenergistics2/models/part/p2p/p2p_tunnel_rf.json delete mode 100644 src/test/java/appeng/coremod/AppEngCoreTest.java diff --git a/build.gradle b/build.gradle index 4169292f6..53e49e0cc 100644 --- a/build.gradle +++ b/build.gradle @@ -58,7 +58,6 @@ archivesBaseName = aebasename // Add Coremod Manifest jar { manifest { - attributes 'FMLCorePluginContainsFMLMod': 'true' attributes 'FMLAT': 'appeng_at.cfg' } @@ -74,8 +73,6 @@ jar { } minecraft { - coreMod = "appeng.coremod.AppEngCore" - version = minecraft_version + "-" + forge_version replaceIn "AEConfig.java" diff --git a/src/api/java/appeng/api/config/TunnelType.java b/src/api/java/appeng/api/config/TunnelType.java index a53f390f6..fb6ff2f73 100644 --- a/src/api/java/appeng/api/config/TunnelType.java +++ b/src/api/java/appeng/api/config/TunnelType.java @@ -28,7 +28,6 @@ public enum TunnelType { ME, // Network Tunnel IC2_POWER, // EU Tunnel - RF_POWER, // RF Tunnel FE_POWER, // Forge Energy tunnel REDSTONE, // Redstone Tunnel FLUID, // Fluid Tunnel diff --git a/src/api/java/appeng/api/definitions/IParts.java b/src/api/java/appeng/api/definitions/IParts.java index f9cfaafa9..324721283 100644 --- a/src/api/java/appeng/api/definitions/IParts.java +++ b/src/api/java/appeng/api/definitions/IParts.java @@ -82,8 +82,6 @@ public interface IParts IItemDefinition p2PTunnelEU(); - IItemDefinition p2PTunnelRF(); - IItemDefinition p2PTunnelFE(); IItemDefinition p2PTunnelLight(); diff --git a/src/main/java/appeng/client/ClientHelper.java b/src/main/java/appeng/client/ClientHelper.java index d5be5c672..0ec590c8a 100644 --- a/src/main/java/appeng/client/ClientHelper.java +++ b/src/main/java/appeng/client/ClientHelper.java @@ -62,7 +62,6 @@ import appeng.core.AppEng; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketAssemblerAnimation; import appeng.core.sync.packets.PacketValueConfig; -import appeng.coremod.MissingCoreMod; import appeng.entity.EntityFloatingItem; import appeng.entity.EntityTinyTNTPrimed; import appeng.entity.RenderFloatingItem; @@ -241,12 +240,6 @@ public class ClientHelper extends ServerHelper mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range ); } - @Override - public void missingCoreMod() - { - throw new MissingCoreMod(); - } - @SubscribeEvent public void postPlayerRender( final RenderLivingEvent.Pre p ) { diff --git a/src/main/java/appeng/core/AppEng.java b/src/main/java/appeng/core/AppEng.java index 674521ec4..facae5acc 100644 --- a/src/main/java/appeng/core/AppEng.java +++ b/src/main/java/appeng/core/AppEng.java @@ -33,7 +33,6 @@ import net.minecraft.world.biome.Biome; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; @@ -57,6 +56,7 @@ import appeng.core.sync.network.NetworkHandler; import appeng.core.worlddata.WorldData; import appeng.hooks.TickHandler; import appeng.integration.IntegrationRegistry; +import appeng.integration.IntegrationType; import appeng.recipes.CustomRecipeConfig; import appeng.recipes.CustomRecipeForgeConfiguration; import appeng.server.AECommand; @@ -139,11 +139,6 @@ public final class AppEng @EventHandler private void preInit( final FMLPreInitializationEvent event ) { - if( !Loader.isModLoaded( "appliedenergistics2-core" ) ) - { - AppEng.proxy.missingCoreMod(); - } - final Stopwatch watch = Stopwatch.createStarted(); this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" ); this.recipeDirectory = new File( this.configDirectory, "aerecipes" ); @@ -171,6 +166,11 @@ public final class AppEng CreativeTabFacade.init(); } + for( final IntegrationType type : IntegrationType.values() ) + { + IntegrationRegistry.INSTANCE.add( type ); + } + this.registration.preInitialize( event ); if( Platform.isClient() ) diff --git a/src/main/java/appeng/core/CommonHelper.java b/src/main/java/appeng/core/CommonHelper.java index 9002a4c39..80bce3bf7 100644 --- a/src/main/java/appeng/core/CommonHelper.java +++ b/src/main/java/appeng/core/CommonHelper.java @@ -62,6 +62,4 @@ public abstract class CommonHelper public abstract void updateRenderMode( EntityPlayer player ); - public abstract void missingCoreMod(); - } diff --git a/src/main/java/appeng/core/Registration.java b/src/main/java/appeng/core/Registration.java index 787237dc0..f6c984208 100644 --- a/src/main/java/appeng/core/Registration.java +++ b/src/main/java/appeng/core/Registration.java @@ -240,16 +240,6 @@ final class Registration // final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler ); // recipeLoader.run(); - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RF ) ) - { - partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.redstoneflux.api.IEnergyReceiver" ); - } - - // if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.RF)) { - // partHelper.registerNewLayer("appeng.parts.layers.LayerIEnergyStorager", - // "net.minecraftforge.common.capabilities.ICapabilityProvider"); - // } - // // if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) ) // { // partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment", diff --git a/src/main/java/appeng/core/api/definitions/ApiParts.java b/src/main/java/appeng/core/api/definitions/ApiParts.java index 77dc0288d..e77233690 100644 --- a/src/main/java/appeng/core/api/definitions/ApiParts.java +++ b/src/main/java/appeng/core/api/definitions/ApiParts.java @@ -64,7 +64,6 @@ public final class ApiParts implements IParts private final IItemDefinition p2PTunnelItems; private final IItemDefinition p2PTunnelFluids; private final IItemDefinition p2PTunnelEU; - private final IItemDefinition p2PTunnelRF; private final IItemDefinition p2PTunnelFE; private final IItemDefinition p2PTunnelLight; // private final IItemDefinition p2PTunnelOpenComputers; @@ -118,7 +117,6 @@ public final class ApiParts implements IParts this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2P_TUNNEL_ITEMS ) ); this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2P_TUNNEL_FLUIDS ) ); this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2P_TUNNEL_IC2 ) ); - this.p2PTunnelRF = new DamagedItemDefinition( "part.tunnel.rf", itemPart.createPart( PartType.P2P_TUNNEL_RF ) ); this.p2PTunnelFE = new DamagedItemDefinition( "part.tunnel.fe", itemPart.createPart( PartType.P2P_TUNNEL_FE ) ); this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2P_TUNNEL_LIGHT ) ); // this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart( @@ -303,12 +301,6 @@ public final class ApiParts implements IParts return this.p2PTunnelEU; } - @Override - public IItemDefinition p2PTunnelRF() - { - return this.p2PTunnelRF; - } - @Override public IItemDefinition p2PTunnelFE() { diff --git a/src/main/java/appeng/core/features/AEFeature.java b/src/main/java/appeng/core/features/AEFeature.java index 7af36163f..245a84efc 100644 --- a/src/main/java/appeng/core/features/AEFeature.java +++ b/src/main/java/appeng/core/features/AEFeature.java @@ -113,7 +113,6 @@ public enum AEFeature DENSE_ENERGY_CELLS( "DenseEnergyCells", Constants.CATEGORY_HIGHER_CAPACITY ), DENSE_CABLES( "DenseCables", Constants.CATEGORY_HIGHER_CAPACITY ), - P2P_TUNNEL_RF( "P2PTunnelRF", Constants.CATEGORY_P2P_TUNNELS ), P2P_TUNNEL_ME( "P2PTunnelME", Constants.CATEGORY_P2P_TUNNELS ), P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ), P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ), diff --git a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java index 36a11b70e..09f56e8a5 100644 --- a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java +++ b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java @@ -73,22 +73,12 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry this.addNewAttunement( blocks.energyCell(), TunnelType.FE_POWER ); this.addNewAttunement( blocks.energyCellCreative(), TunnelType.FE_POWER ); - /** - * RF tunnel items - */ - - this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.RF_POWER ); // leadstone - // fluxduct - this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.RF_POWER ); // hardened - // fluxduct - this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.RF_POWER ); // redstone - // fluxduct - this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.RF_POWER ); // signalum - // fluxduct - this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.RF_POWER ); // resonant - // fluxduct - this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.RF_POWER ); // cryo-stabilized - // fluxduct + this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.FE_POWER ); + this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.FE_POWER ); + this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.FE_POWER ); + this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.FE_POWER ); + this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.FE_POWER ); + this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.FE_POWER ); /** * EU tunnel items @@ -174,15 +164,15 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry * attune based on the ItemStack's modId */ - this.addNewAttunement( "thermaldynamics", TunnelType.RF_POWER ); - this.addNewAttunement( "thermalexpansion", TunnelType.RF_POWER ); - this.addNewAttunement( "thermalfoundation", TunnelType.RF_POWER ); + this.addNewAttunement( "thermaldynamics", TunnelType.FE_POWER ); + this.addNewAttunement( "thermalexpansion", TunnelType.FE_POWER ); + this.addNewAttunement( "thermalfoundation", TunnelType.FE_POWER ); // TODO: Remove when confirmed that the official 1.12 version of EnderIO will support FE. - this.addNewAttunement( "enderio", TunnelType.RF_POWER ); + this.addNewAttunement( "enderio", TunnelType.FE_POWER ); // TODO: Remove when confirmed that the official 1.12 version of Mekanism will support FE. - this.addNewAttunement( "mekanism", TunnelType.RF_POWER ); + this.addNewAttunement( "mekanism", TunnelType.FE_POWER ); // TODO: Remove when support for RFTools' Powercells support is added - this.addNewAttunement( "rftools", TunnelType.RF_POWER ); + this.addNewAttunement( "rftools", TunnelType.FE_POWER ); this.addNewAttunement( "ic2", TunnelType.IC2_POWER ); } diff --git a/src/main/java/appeng/core/localization/GuiText.java b/src/main/java/appeng/core/localization/GuiText.java index 14dd3b184..1e952980e 100644 --- a/src/main/java/appeng/core/localization/GuiText.java +++ b/src/main/java/appeng/core/localization/GuiText.java @@ -89,7 +89,6 @@ public enum GuiText FluidTunnel, OCTunnel, LightTunnel, - RFTunnel, FETunnel, PressureTunnel, diff --git a/src/main/java/appeng/coremod/AppEngCore.java b/src/main/java/appeng/coremod/AppEngCore.java deleted file mode 100644 index ef53b0076..000000000 --- a/src/main/java/appeng/coremod/AppEngCore.java +++ /dev/null @@ -1,133 +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.coremod; - - -import java.util.Map; - -import javax.annotation.Nullable; - -import com.google.common.eventbus.EventBus; - -import org.apache.logging.log4j.Level; - -import net.minecraftforge.fml.common.DummyModContainer; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.LoadController; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.ModMetadata; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion; - -import appeng.core.AEConfig; - - -@MCVersion( "1.12" ) -public final class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin -{ - private final ModMetadata metadata = new ModMetadata(); - - public AppEngCore() - { - FMLLog.log( "AE2-CORE", Level.INFO, "[AppEng] Core Init" ); - this.metadata.autogenerated = false; - this.metadata.authorList.add( "AlgorithmX2" ); - this.metadata.credits = "AlgorithmX2"; - this.metadata.modId = this.getModId(); - this.metadata.version = this.getVersion(); - this.metadata.name = this.getName(); - this.metadata.url = "http://ae2.ae-mod.info"; - this.metadata.logoFile = "assets/appliedenergistics2/meta/logo.png"; - this.metadata.description = "Embedded Coremod for Applied Energistics 2"; - } - - @EventHandler - public void load( final FMLInitializationEvent event ) - { - } - - @Override - public String[] getASMTransformerClass() - { - return new String[] { "appeng.coremod.transformer.ASMIntegration" }; - } - - @Override - public String getModContainerClass() - { - return "appeng.coremod.AppEngCore"; - } - - @Nullable - @Override - public String getSetupClass() - { - return null; - } - - @Override - public void injectData( final Map data ) - { - - } - - @Override - public String getAccessTransformerClass() - { - return null; - } - - @Override - public ModMetadata getMetadata() - { - return this.metadata; - } - - @Override - public String getModId() - { - return "appliedenergistics2-core"; - } - - @Override - public String getName() - { - return "Applied Energistics 2 Core"; - } - - @Override - public String getVersion() - { - return AEConfig.VERSION; - } - - @Override - public boolean registerBus( final EventBus bus, final LoadController controller ) - { - return true; - } - - @Override - public String getDisplayVersion() - { - return this.getVersion(); - } - -} diff --git a/src/main/java/appeng/coremod/MissingCoreMod.java b/src/main/java/appeng/coremod/MissingCoreMod.java deleted file mode 100644 index 2bb4b5fb0..000000000 --- a/src/main/java/appeng/coremod/MissingCoreMod.java +++ /dev/null @@ -1,100 +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.coremod; - - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiErrorScreen; -import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - - -@SideOnly( Side.CLIENT ) -public final class MissingCoreMod extends CustomModLoadingErrorDisplayException -{ - private static final int SHADOW_WHITE = 0xeeeeee; - private static final int COLOR_WHITE = 0xffffff; - private static final long serialVersionUID = -966774766922821652L; - private static final int SCREEN_OFFSET = 15; - - private boolean deobf = false; - - @Override - public void initGui( final GuiErrorScreen errorScreen, final FontRenderer fontRenderer ) - { - final Class clz = errorScreen.getClass(); - try - { - clz.getField( "mc" ); - this.deobf = true; - } - catch( final Throwable ignored ) - { - - } - } - - @Override - public void drawScreen( final GuiErrorScreen errorScreen, final FontRenderer fontRenderer, final int mouseRelX, final int mouseRelY, final float tickTime ) - { - int offset = 10; - this.drawCenteredString( fontRenderer, "Sorry, couldn't load AE2 properly.", errorScreen.width / 2, offset, COLOR_WHITE ); - - offset += SCREEN_OFFSET; - this.drawCenteredString( fontRenderer, "Please make sure that AE2 is installed into your mods folder.", errorScreen.width / 2, offset, SHADOW_WHITE ); - - offset += 2 * SCREEN_OFFSET; - - if( this.deobf ) - { - offset += SCREEN_OFFSET; - this.drawCenteredString( fontRenderer, "In a developer environment add the following too your args,", errorScreen.width / 2, offset, COLOR_WHITE ); - - offset += SCREEN_OFFSET; - this.drawCenteredString( fontRenderer, "-Dfml.coreMods.load=appeng.coremod.AppEngCore", errorScreen.width / 2, offset, SHADOW_WHITE ); - } - else - { - this.drawCenteredString( fontRenderer, "Your launcher may refer to this by different names,", errorScreen.width / 2, offset, COLOR_WHITE ); - - offset += SCREEN_OFFSET + 5; - - this.drawCenteredString( fontRenderer, "MultiMC calls this tab \"Loader Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE ); - - offset += SCREEN_OFFSET; - this.drawCenteredString( fontRenderer, "Magic Launcher calls this tab \"External Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE ); - - offset += SCREEN_OFFSET; - this.drawCenteredString( fontRenderer, "Most other launchers refer to this tab as just \"Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE ); - - offset += 2 * SCREEN_OFFSET; - this.drawCenteredString( fontRenderer, "Also make sure that the AE2 file is a .jar, and not a .zip", errorScreen.width / 2, offset, COLOR_WHITE ); - } - } - - private void drawCenteredString( final FontRenderer fontRenderer, final String string, final int x, final int y, final int colour ) - { - final String reEncoded = string.replaceAll( "\\P{InBasic_Latin}", "" ); - final int reEncodedWidth = fontRenderer.getStringWidth( reEncoded ); - final int centeredX = x - reEncodedWidth / 2; - - fontRenderer.drawStringWithShadow( string, centeredX, y, colour ); - } -} \ No newline at end of file diff --git a/src/main/java/appeng/coremod/annotations/Integration.java b/src/main/java/appeng/coremod/annotations/Integration.java deleted file mode 100644 index ac75a083b..000000000 --- a/src/main/java/appeng/coremod/annotations/Integration.java +++ /dev/null @@ -1,54 +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.coremod.annotations; - - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import appeng.integration.IntegrationType; - - -public @interface Integration -{ - @Retention( RetentionPolicy.RUNTIME ) - @Target( ElementType.TYPE ) - @interface InterfaceList - { - Interface[] value(); - } - - @Retention( RetentionPolicy.RUNTIME ) - @Target( ElementType.TYPE ) - @interface Interface - { - String iface(); - - IntegrationType iname(); - } - - @Retention( RetentionPolicy.RUNTIME ) - @Target( ElementType.METHOD ) - @interface Method - { - IntegrationType iname(); - } -} \ No newline at end of file diff --git a/src/main/java/appeng/coremod/transformer/ASMIntegration.java b/src/main/java/appeng/coremod/transformer/ASMIntegration.java deleted file mode 100644 index c9f238f60..000000000 --- a/src/main/java/appeng/coremod/transformer/ASMIntegration.java +++ /dev/null @@ -1,255 +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.coremod.transformer; - - -import java.util.Iterator; - -import javax.annotation.Nullable; - -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.AnnotationNode; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.MethodNode; - -import net.minecraft.launchwrapper.IClassTransformer; -import net.minecraftforge.fml.common.FMLLog; - -import appeng.coremod.annotations.Integration; -import appeng.helpers.Reflected; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; - - -@Reflected -public final class ASMIntegration implements IClassTransformer -{ - @Reflected - public ASMIntegration() - { - - /** - * Side, Display Name, ModID ClassPostFix - */ - - for( final IntegrationType type : IntegrationType.values() ) - { - IntegrationRegistry.INSTANCE.add( type ); - } - - // integrationModules.add( IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", IntegrationType.TE ); - // integrationModules.add( IntegrationSide.BOTH, "Mystcraft", "Mystcraft", IntegrationType.Mystcraft ); - // integrationModules.add( IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", IntegrationType.GT ); - // integrationModules.add( IntegrationSide.BOTH, "Universal Electricity", null, IntegrationType.UE ); - // integrationModules.add( IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", IntegrationType.LP ); - // integrationModules.add( IntegrationSide.BOTH, "Better Storage", IntegrationType.betterstorage ); - // integrationModules.add( IntegrationSide.BOTH, "Forestry", "Forestry", IntegrationType.Forestry ); - // integrationModules.add( IntegrationSide.BOTH, "Mekanism", "Mekanism", IntegrationType.Mekanism ); - - } - - @Nullable - @Override - public byte[] transform( final String name, final String transformedName, final byte[] basicClass ) - { - if( basicClass == null || transformedName.startsWith( "appeng.coremod" ) ) - { - return basicClass; - } - - if( transformedName.startsWith( "appeng." ) ) - { - final ClassNode classNode = new ClassNode(); - final ClassReader classReader = new ClassReader( basicClass ); - classReader.accept( classNode, 0 ); - - try - { - final boolean reWrite = this.removeOptionals( classNode ); - - if( reWrite ) - { - final ClassWriter writer = new ClassWriter( ClassWriter.COMPUTE_MAXS ); - classNode.accept( writer ); - return writer.toByteArray(); - } - } - catch( final Throwable t ) - { - t.printStackTrace(); - } - } - return basicClass; - } - - private boolean removeOptionals( final ClassNode classNode ) - { - boolean changed = false; - - if( classNode.visibleAnnotations != null ) - { - for( final AnnotationNode an : classNode.visibleAnnotations ) - { - if( this.hasAnnotation( an, Integration.Interface.class ) ) - { - if( this.stripInterface( classNode, Integration.Interface.class, an ) ) - { - changed = true; - } - } - else if( this.hasAnnotation( an, Integration.InterfaceList.class ) ) - { - for( final Object o : ( (Iterable) an.values.get( 1 ) ) ) - { - if( this.stripInterface( classNode, Integration.InterfaceList.class, (AnnotationNode) o ) ) - { - changed = true; - } - } - } - } - } - - final Iterator i = classNode.methods.iterator(); - while( i.hasNext() ) - { - final MethodNode mn = i.next(); - - if( mn.visibleAnnotations != null ) - { - for( final AnnotationNode an : mn.visibleAnnotations ) - { - if( this.hasAnnotation( an, Integration.Method.class ) ) - { - if( this.stripMethod( classNode, mn, i, Integration.Method.class, an ) ) - { - changed = true; - } - } - } - } - } - - if( changed ) - { - this.log( "Updated " + classNode.name ); - } - - return changed; - } - - private boolean hasAnnotation( final AnnotationNode ann, final Class annotation ) - { - return ann.desc.equals( Type.getDescriptor( annotation ) ); - } - - private boolean stripInterface( final ClassNode classNode, final Class class1, final AnnotationNode an ) - { - if( an.values.size() != 4 ) - { - throw new IllegalArgumentException( "Unable to handle Interface annotation on " + classNode.name ); - } - - String iFace = null; - - if( an.values.get( 0 ).equals( "iface" ) ) - { - iFace = (String) an.values.get( 1 ); - } - else if( an.values.get( 2 ).equals( "iface" ) ) - { - iFace = (String) an.values.get( 3 ); - } - - String iName = null; - if( an.values.get( 0 ).equals( "iname" ) ) - { - iName = ( (String[]) an.values.get( 1 ) )[1]; - } - else if( an.values.get( 2 ).equals( "iname" ) ) - { - iName = ( (String[]) an.values.get( 3 ) )[1]; - } - - if( iName != null && iFace != null ) - { - final IntegrationType type = IntegrationType.valueOf( iName ); - if( !IntegrationRegistry.INSTANCE.isEnabled( type ) ) - { - this.log( "Removing Interface " + iFace + " from " + classNode.name + " because " + iName + " integration is disabled." ); - classNode.interfaces.remove( iFace.replace( '.', '/' ) ); - return true; - } - else - { - this.log( "Allowing Interface " + iFace + " from " + classNode.name + " because " + iName + " integration is enabled." ); - } - } - else - { - throw new IllegalStateException( "Unable to handle Method annotation on " + classNode.name ); - } - - return false; - } - - private boolean stripMethod( final ClassNode classNode, final MethodNode mn, final Iterator i, final Class class1, final AnnotationNode an ) - { - if( an.values.size() != 2 ) - { - throw new IllegalArgumentException( "Unable to handle Method annotation on " + classNode.name ); - } - - String iName = null; - - if( an.values.get( 0 ).equals( "iname" ) ) - { - iName = ( (String[]) an.values.get( 1 ) )[1]; - } - - if( iName != null ) - { - final IntegrationType type = IntegrationType.valueOf( iName ); - if( !IntegrationRegistry.INSTANCE.isEnabled( type ) ) - { - this.log( "Removing Method " + mn.name + " from " + classNode.name + " because " + iName + " integration is disabled." ); - i.remove(); - return true; - } - else - { - this.log( "Allowing Method " + mn.name + " from " + classNode.name + " because " + iName + " integration is enabled." ); - } - } - else - { - throw new IllegalStateException( "Unable to handle Method annotation on " + classNode.name ); - } - - return false; - } - - private void log( final String string ) - { - FMLLog.log( "AE2-CORE", Level.INFO, string ); - } -} diff --git a/src/main/java/appeng/integration/IntegrationType.java b/src/main/java/appeng/integration/IntegrationType.java index b37478618..61ba97ab1 100644 --- a/src/main/java/appeng/integration/IntegrationType.java +++ b/src/main/java/appeng/integration/IntegrationType.java @@ -21,7 +21,6 @@ package appeng.integration; import appeng.integration.modules.ic2.IC2Module; import appeng.integration.modules.jei.JEIModule; -import appeng.integration.modules.rf.RFModule; import appeng.integration.modules.theoneprobe.TheOneProbeModule; import appeng.integration.modules.waila.WailaModule; @@ -39,24 +38,6 @@ public enum IntegrationType RC( IntegrationSide.BOTH, "Railcraft", "railcraft" ), - RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "redstoneflux" ) - { - @Override - public IIntegrationModule createInstance() - { - return new RFModule(); - } - }, - - RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "redstoneflux" ) - { - @Override - public IIntegrationModule createInstance() - { - return new RFModule(); - } - }, - MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "minefactoryreloaded" ), Waila( IntegrationSide.BOTH, "Waila", "waila" ) diff --git a/src/main/java/appeng/integration/Integrations.java b/src/main/java/appeng/integration/Integrations.java index 759b07058..871b4cb06 100644 --- a/src/main/java/appeng/integration/Integrations.java +++ b/src/main/java/appeng/integration/Integrations.java @@ -24,7 +24,6 @@ import appeng.integration.abstraction.IInvTweaks; import appeng.integration.abstraction.IJEI; import appeng.integration.abstraction.IMekanism; import appeng.integration.abstraction.IRC; -import appeng.integration.abstraction.IRF; /** @@ -43,8 +42,6 @@ public final class Integrations static IInvTweaks invTweaks = new IInvTweaks.Stub(); - static IRF redstoneflux = new IRF.Stub(); - private Integrations() { } @@ -104,10 +101,4 @@ public final class Integrations return invTweaks; } - static IRF setRedstoneFlux( IRF redstoneflux ) - { - Integrations.redstoneflux = redstoneflux; - return redstoneflux; - } - } diff --git a/src/main/java/appeng/integration/abstraction/IRF.java b/src/main/java/appeng/integration/abstraction/IRF.java deleted file mode 100644 index 1a4b7bfde..000000000 --- a/src/main/java/appeng/integration/abstraction/IRF.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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.integration.abstraction; - - -import appeng.integration.IIntegrationModule; - - -/** - * @author GuntherDW - */ -public interface IRF -{ - class Stub extends IIntegrationModule.Stub implements IRF - { - - } -} diff --git a/src/main/java/appeng/integration/modules/rf/RFModule.java b/src/main/java/appeng/integration/modules/rf/RFModule.java deleted file mode 100644 index 703a05fc6..000000000 --- a/src/main/java/appeng/integration/modules/rf/RFModule.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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.integration.modules.rf; - - -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; - - -/** - * @author GuntherDW - */ -public class RFModule implements IIntegrationModule -{ - public RFModule() - { - IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyContainerItem.class ); - IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyProvider.class ); - IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyConnection.class ); - IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyContainerItem.class ); - } - -} diff --git a/src/main/java/appeng/items/parts/PartType.java b/src/main/java/appeng/items/parts/PartType.java index 0941f8f4d..e72c3925d 100644 --- a/src/main/java/appeng/items/parts/PartType.java +++ b/src/main/java/appeng/items/parts/PartType.java @@ -65,7 +65,6 @@ import appeng.parts.p2p.PartP2PFluids; import appeng.parts.p2p.PartP2PIC2Power; import appeng.parts.p2p.PartP2PItems; import appeng.parts.p2p.PartP2PLight; -import appeng.parts.p2p.PartP2PRFPower; import appeng.parts.p2p.PartP2PRedstone; import appeng.parts.p2p.PartP2PTunnelME; import appeng.parts.reporting.PartConversionMonitor; @@ -270,16 +269,6 @@ public enum PartType } }, - P2P_TUNNEL_RF( 466, "p2p_tunnel_rf", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_RF ), EnumSet - .of( IntegrationType.RF ), PartP2PRFPower.class, GuiText.RFTunnel ) - { - @Override - String getUnlocalizedName() - { - return "p2p_tunnel"; - } - }, - P2P_TUNNEL_LIGHT( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet .noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel ) { diff --git a/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java b/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java deleted file mode 100644 index ca61bcb6e..000000000 --- a/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java +++ /dev/null @@ -1,66 +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.items.tools.powered.powersink; - - -import net.minecraft.item.ItemStack; - -import cofh.redstoneflux.api.IEnergyContainerItem; - -import appeng.api.config.Actionable; -import appeng.api.config.PowerUnits; -import appeng.coremod.annotations.Integration.Interface; -import appeng.integration.IntegrationType; - - -@Interface( iface = "cofh.redstoneflux.api.IEnergyContainerItem", iname = IntegrationType.RFItem ) -public abstract class RedstoneFlux extends AEBasePoweredItem implements IEnergyContainerItem -{ - public RedstoneFlux( final double powerCapacity ) - { - super( powerCapacity ); - } - - @Override - public int receiveEnergy( final ItemStack is, final int maxReceive, final boolean simulate ) - { - final double convertedPower = PowerUnits.RF.convertTo( PowerUnits.AE, maxReceive ); - final double overflow = (int) this.injectAEPower( is, convertedPower, simulate ? Actionable.SIMULATE : Actionable.MODULATE ); - - return (int) ( maxReceive - overflow ); - } - - @Override - public int extractEnergy( final ItemStack container, final int maxExtract, final boolean simulate ) - { - return 0; - } - - @Override - public int getEnergyStored( final ItemStack is ) - { - return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) ); - } - - @Override - public int getMaxEnergyStored( final ItemStack is ) - { - return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) ); - } -} diff --git a/src/main/java/appeng/parts/layers/LayerIEnergyHandler.java b/src/main/java/appeng/parts/layers/LayerIEnergyHandler.java deleted file mode 100644 index 063588326..000000000 --- a/src/main/java/appeng/parts/layers/LayerIEnergyHandler.java +++ /dev/null @@ -1,95 +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.parts.layers; - - -import net.minecraft.util.EnumFacing; - -import cofh.redstoneflux.api.IEnergyConnection; -import cofh.redstoneflux.api.IEnergyHandler; -import cofh.redstoneflux.api.IEnergyProvider; -import cofh.redstoneflux.api.IEnergyReceiver; - -import appeng.api.parts.IPart; -import appeng.api.parts.LayerBase; - - -public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler, IEnergyReceiver, IEnergyProvider -{ - - @Override - public int receiveEnergy( EnumFacing from, int maxReceive, boolean simulate ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyReceiver ) - { - return ( (IEnergyReceiver) part ).receiveEnergy( from, maxReceive, simulate ); - } - - return 0; - } - - @Override - public int extractEnergy( EnumFacing from, int maxExtract, boolean simulate ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyProvider ) - { - return ( (IEnergyProvider) part ).extractEnergy( from, maxExtract, simulate ); - } - - return 0; - } - - @Override - public int getEnergyStored( EnumFacing from ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyProvider ) - { - return ( (IEnergyProvider) part ).getEnergyStored( from ); - } - - return 0; - } - - @Override - public int getMaxEnergyStored( EnumFacing from ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyProvider ) - { - return ( (IEnergyProvider) part ).getMaxEnergyStored( from ); - } - - return 0; - } - - @Override - public boolean canConnectEnergy( EnumFacing from ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyConnection ) - { - return ( (IEnergyConnection) part ).canConnectEnergy( from ); - } - - return false; - } -} diff --git a/src/main/java/appeng/parts/p2p/PartP2PRFPower.java b/src/main/java/appeng/parts/p2p/PartP2PRFPower.java deleted file mode 100644 index 529a53aa6..000000000 --- a/src/main/java/appeng/parts/p2p/PartP2PRFPower.java +++ /dev/null @@ -1,236 +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.parts.p2p; - - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -import cofh.redstoneflux.api.IEnergyReceiver; - -import appeng.api.config.PowerUnits; -import appeng.api.parts.IPartModel; -import appeng.coremod.annotations.Integration.Interface; -import appeng.coremod.annotations.Integration.InterfaceList; -import appeng.integration.IntegrationType; -import appeng.items.parts.PartModels; -import appeng.me.GridAccessException; - - -@InterfaceList( value = { @Interface( iface = "cofh.redstoneflux.api.IEnergyReceiver", iname = IntegrationType.RF ) } ) -public final class PartP2PRFPower extends PartP2PTunnel implements IEnergyReceiver -{ - private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_rf" ); - private static final IEnergyReceiver NULL_ENERGY_RECEIVER = new NullEnergyReceiver(); - - private boolean cachedTarget = false; - - private IEnergyReceiver outputTarget; - - public PartP2PRFPower( ItemStack is ) - { - super( is ); - } - - @PartModels - public static List getModels() - { - return MODELS.getModels(); - } - - @Override - public IPartModel getStaticModels() - { - return MODELS.getModel( this.isPowered(), this.isActive() ); - } - - @Override - public void onTunnelNetworkChange() - { - this.getHost().notifyNeighbors(); - } - - @Override - public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor ) - { - super.onNeighborChanged( w, pos, neighbor ); - - this.cachedTarget = false; - } - - @Override - public int receiveEnergy( EnumFacing from, int maxReceive, boolean simulate ) - { - if( this.isOutput() ) - { - return 0; - } - - if( this.isActive() ) - { - int total = 0; - - try - { - final int outputTunnels = this.getOutputs().size(); - - if( outputTunnels == 0 ) - { - return 0; - } - - final int amountPerOutput = maxReceive / outputTunnels; - int overflow = maxReceive % amountPerOutput; - - for( PartP2PRFPower target : this.getOutputs() ) - { - final IEnergyReceiver output = target.getOutput(); - final int toSend = amountPerOutput + overflow; - final int received = output.receiveEnergy( target.getSide().getFacing().getOpposite(), toSend, simulate ); - - overflow = toSend - received; - total += received; - } - - this.queueTunnelDrain( PowerUnits.RF, total ); - } - catch( GridAccessException ignored ) - { - } - - return total; - } - - return 0; - } - - private IEnergyReceiver getOutput() - { - if( this.isOutput() ) - { - if( !this.cachedTarget ) - { - final TileEntity self = this.getTile(); - final TileEntity te = self.getWorld().getTileEntity( new BlockPos( self.getPos().getX() + this.getSide().xOffset, self.getPos() - .getY() + this.getSide().yOffset, self.getPos().getZ() + this.getSide().zOffset ) ); - - this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null; - this.cachedTarget = true; - } - - if( this.outputTarget != null && this.outputTarget.canConnectEnergy( this.getSide().getOpposite().getFacing() ) ) - { - return this.outputTarget; - } - } - - return NULL_ENERGY_RECEIVER; - } - - @Override - public int getEnergyStored( EnumFacing from ) - { - if( this.isOutput() || !this.isActive() ) - { - return 0; - } - - int total = 0; - - try - { - for( PartP2PRFPower t : this.getOutputs() ) - { - total += t.getOutput().getEnergyStored( this.getSide().getOpposite().getFacing() ); - } - } - catch( GridAccessException e ) - { - return 0; - } - - return total; - } - - @Override - public int getMaxEnergyStored( EnumFacing from ) - { - if( this.isOutput() || !this.isActive() ) - { - return 0; - } - - int total = 0; - - try - { - for( PartP2PRFPower t : this.getOutputs() ) - { - total += t.getOutput().getMaxEnergyStored( this.getSide().getOpposite().getFacing() ); - } - } - catch( GridAccessException e ) - { - return 0; - } - - return total; - } - - @Override - public boolean canConnectEnergy( EnumFacing from ) - { - return true; - } - - private static class NullEnergyReceiver implements IEnergyReceiver - { - - @Override - public int getEnergyStored( EnumFacing from ) - { - return 0; - } - - @Override - public int getMaxEnergyStored( EnumFacing from ) - { - return 0; - } - - @Override - public boolean canConnectEnergy( EnumFacing from ) - { - return true; - } - - @Override - public int receiveEnergy( EnumFacing from, int maxReceive, boolean simulate ) - { - return 0; - } - - } - -} diff --git a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java index 63180307f..3a2cfdcd5 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java +++ b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java @@ -222,10 +222,6 @@ public abstract class PartP2PTunnel extends PartBasicSt newType = parts.p2PTunnelLight().maybeStack( 1 ).orElse( ItemStack.EMPTY ); break; - case RF_POWER: - newType = parts.p2PTunnelRF().maybeStack( 1 ).orElse( ItemStack.EMPTY ); - break; - case FE_POWER: newType = parts.p2PTunnelFE().maybeStack( 1 ).orElse( ItemStack.EMPTY ); break; diff --git a/src/main/java/appeng/server/ServerHelper.java b/src/main/java/appeng/server/ServerHelper.java index 64d0b3212..cfc2935eb 100644 --- a/src/main/java/appeng/server/ServerHelper.java +++ b/src/main/java/appeng/server/ServerHelper.java @@ -162,12 +162,6 @@ public class ServerHelper extends CommonHelper this.renderModeBased = player; } - @Override - public void missingCoreMod() - { - throw new IllegalStateException( "Unable to Load Core Mod, please verify that AE2 is properly install in the mods folder, with a .jar extension." ); - } - protected CableRenderMode renderModeForPlayer( final EntityPlayer player ) { if( player != null ) diff --git a/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java b/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java index c386baf9c..774e7e0c4 100644 --- a/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java +++ b/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java @@ -19,7 +19,308 @@ package appeng.tile.powersink; -public abstract class AEBasePoweredTile extends RedstoneFlux +import java.util.EnumSet; + +import javax.annotation.Nullable; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.energy.IEnergyStorage; + +import appeng.api.config.AccessRestriction; +import appeng.api.config.Actionable; +import appeng.api.config.PowerMultiplier; +import appeng.api.config.PowerUnits; +import appeng.api.networking.energy.IAEPowerStorage; +import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType; +import appeng.capabilities.Capabilities; +import appeng.integration.Integrations; +import appeng.integration.abstraction.IC2PowerSink; +import appeng.tile.AEBaseInvTile; +import appeng.tile.TileEvent; +import appeng.tile.events.TileEventType; + + +public abstract class AEBasePoweredTile extends AEBaseInvTile implements IAEPowerStorage, IExternalPowerSink { + // values that determine general function, are set by inheriting classes if + // needed. These should generally remain static. + private double internalMaxPower = 10000; + private boolean internalPublicPowerStorage = false; + private AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE; + // the current power buffer. + private double internalCurrentPower = 0; + private EnumSet internalPowerSides = EnumSet.allOf( EnumFacing.class ); + private final IEnergyStorage forgeEnergyAdapter; + private Object teslaEnergyAdapter; + + private IC2PowerSink ic2Sink; + + public AEBasePoweredTile() + { + this.forgeEnergyAdapter = new ForgeEnergyAdapter( this ); + if( Capabilities.TESLA_CONSUMER != null ) + { + this.teslaEnergyAdapter = new TeslaEnergyAdapter( this ); + } + this.ic2Sink = Integrations.ic2().createPowerSink( this, this ); + this.ic2Sink.setValidFaces( this.internalPowerSides ); + } + + protected EnumSet getPowerSides() + { + return this.internalPowerSides.clone(); + } + + protected void setPowerSides( final EnumSet sides ) + { + this.internalPowerSides = sides; + this.ic2Sink.setValidFaces( sides ); + // trigger re-calc! + } + + @TileEvent( TileEventType.WORLD_NBT_WRITE ) + public void writeToNBT_AERootPoweredTile( final NBTTagCompound data ) + { + data.setDouble( "internalCurrentPower", this.getInternalCurrentPower() ); + } + + @TileEvent( TileEventType.WORLD_NBT_READ ) + public void readFromNBT_AERootPoweredTile( final NBTTagCompound data ) + { + this.setInternalCurrentPower( data.getDouble( "internalCurrentPower" ) ); + } + + @Override + public final double getExternalPowerDemand( final PowerUnits externalUnit, final double maxPowerRequired ) + { + return PowerUnits.AE.convertTo( externalUnit, Math.max( 0.0, this.getFunnelPowerDemand( externalUnit.convertTo( PowerUnits.AE, maxPowerRequired ) ) ) ); + } + + protected double getFunnelPowerDemand( final double maxRequired ) + { + return this.getInternalMaxPower() - this.getInternalCurrentPower(); + } + + @Override + public final double injectExternalPower( final PowerUnits input, final double amt ) + { + return PowerUnits.AE.convertTo( input, this.funnelPowerIntoStorage( input.convertTo( PowerUnits.AE, amt ), Actionable.MODULATE ) ); + } + + protected double funnelPowerIntoStorage( final double power, final Actionable mode ) + { + return this.injectAEPower( power, mode ); + } + + @Override + public final double injectAEPower( double amt, final Actionable mode ) + { + if( amt < 0.000001 ) + { + return 0; + } + + if( mode == Actionable.SIMULATE ) + { + final double fakeBattery = this.getInternalCurrentPower() + amt; + + if( fakeBattery > this.getInternalMaxPower() ) + { + return fakeBattery - this.getInternalMaxPower(); + } + + return 0; + } + else + { + if( this.getInternalCurrentPower() < 0.01 && amt > 0.01 ) + { + this.PowerEvent( PowerEventType.PROVIDE_POWER ); + } + + this.setInternalCurrentPower( this.getInternalCurrentPower() + amt ); + if( this.getInternalCurrentPower() > this.getInternalMaxPower() ) + { + amt = this.getInternalCurrentPower() - this.getInternalMaxPower(); + this.setInternalCurrentPower( this.getInternalMaxPower() ); + return amt; + } + + return 0; + } + } + + protected void PowerEvent( final PowerEventType x ) + { + // nothing. + } + + @Override + public final double getAEMaxPower() + { + return this.getInternalMaxPower(); + } + + @Override + public final double getAECurrentPower() + { + return this.getInternalCurrentPower(); + } + + @Override + public final boolean isAEPublicPowerStorage() + { + return this.isInternalPublicPowerStorage(); + } + + @Override + public final AccessRestriction getPowerFlow() + { + return this.getInternalPowerFlow(); + } + + @Override + public final double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier multiplier ) + { + return multiplier.divide( this.extractAEPower( multiplier.multiply( amt ), mode ) ); + } + + protected double extractAEPower( double amt, final Actionable mode ) + { + if( mode == Actionable.SIMULATE ) + { + if( this.getInternalCurrentPower() > amt ) + { + return amt; + } + return this.getInternalCurrentPower(); + } + + final boolean wasFull = this.getInternalCurrentPower() >= this.getInternalMaxPower() - 0.001; + if( wasFull && amt > 0.001 ) + { + this.PowerEvent( PowerEventType.REQUEST_POWER ); + } + + if( this.getInternalCurrentPower() > amt ) + { + this.setInternalCurrentPower( this.getInternalCurrentPower() - amt ); + return amt; + } + + amt = this.getInternalCurrentPower(); + this.setInternalCurrentPower( 0 ); + return amt; + } + + public double getInternalCurrentPower() + { + return this.internalCurrentPower; + } + + public void setInternalCurrentPower( final double internalCurrentPower ) + { + this.internalCurrentPower = internalCurrentPower; + } + + public double getInternalMaxPower() + { + return this.internalMaxPower; + } + + public void setInternalMaxPower( final double internalMaxPower ) + { + this.internalMaxPower = internalMaxPower; + } + + private boolean isInternalPublicPowerStorage() + { + return this.internalPublicPowerStorage; + } + + public void setInternalPublicPowerStorage( final boolean internalPublicPowerStorage ) + { + this.internalPublicPowerStorage = internalPublicPowerStorage; + } + + private AccessRestriction getInternalPowerFlow() + { + return this.internalPowerFlow; + } + + public void setInternalPowerFlow( final AccessRestriction internalPowerFlow ) + { + this.internalPowerFlow = internalPowerFlow; + } + + @Override + public void onReady() + { + super.onReady(); + + this.ic2Sink.onLoad(); + } + + @Override + public void onChunkUnload() + { + super.onChunkUnload(); + + this.ic2Sink.onChunkUnload(); + } + + @Override + public void invalidate() + { + super.invalidate(); + + this.ic2Sink.invalidate(); + } + + @Override + public boolean hasCapability( Capability capability, EnumFacing facing ) + { + if( capability == Capabilities.FORGE_ENERGY ) + { + if( this.getPowerSides().contains( facing ) ) + { + return true; + } + } + else if( capability == Capabilities.TESLA_CONSUMER ) + { + if( this.getPowerSides().contains( facing ) ) + { + return true; + } + } + + return super.hasCapability( capability, facing ); + } + + @SuppressWarnings( "unchecked" ) + @Override + public T getCapability( Capability capability, @Nullable EnumFacing facing ) + { + if( capability == Capabilities.FORGE_ENERGY ) + { + if( this.getPowerSides().contains( facing ) ) + { + return (T) this.forgeEnergyAdapter; + } + } + else if( capability == Capabilities.TESLA_CONSUMER ) + { + if( this.getPowerSides().contains( facing ) ) + { + return (T) this.teslaEnergyAdapter; + } + } + + return super.getCapability( capability, facing ); + } + } diff --git a/src/main/java/appeng/tile/powersink/AERootPoweredTile.java b/src/main/java/appeng/tile/powersink/AERootPoweredTile.java deleted file mode 100644 index 00cab4992..000000000 --- a/src/main/java/appeng/tile/powersink/AERootPoweredTile.java +++ /dev/null @@ -1,326 +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.tile.powersink; - - -import java.util.EnumSet; - -import javax.annotation.Nullable; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.energy.IEnergyStorage; - -import appeng.api.config.AccessRestriction; -import appeng.api.config.Actionable; -import appeng.api.config.PowerMultiplier; -import appeng.api.config.PowerUnits; -import appeng.api.networking.energy.IAEPowerStorage; -import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType; -import appeng.capabilities.Capabilities; -import appeng.integration.Integrations; -import appeng.integration.abstraction.IC2PowerSink; -import appeng.tile.AEBaseInvTile; -import appeng.tile.TileEvent; -import appeng.tile.events.TileEventType; - - -public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowerStorage, IExternalPowerSink -{ - - // values that determine general function, are set by inheriting classes if - // needed. These should generally remain static. - private double internalMaxPower = 10000; - private boolean internalPublicPowerStorage = false; - private AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE; - // the current power buffer. - private double internalCurrentPower = 0; - private EnumSet internalPowerSides = EnumSet.allOf( EnumFacing.class ); - private final IEnergyStorage forgeEnergyAdapter; - private Object teslaEnergyAdapter; - - private IC2PowerSink ic2Sink; - - public AERootPoweredTile() - { - this.forgeEnergyAdapter = new ForgeEnergyAdapter( this ); - if( Capabilities.TESLA_CONSUMER != null ) - { - this.teslaEnergyAdapter = new TeslaEnergyAdapter( this ); - } - this.ic2Sink = Integrations.ic2().createPowerSink( this, this ); - this.ic2Sink.setValidFaces( this.internalPowerSides ); - } - - protected EnumSet getPowerSides() - { - return this.internalPowerSides.clone(); - } - - protected void setPowerSides( final EnumSet sides ) - { - this.internalPowerSides = sides; - this.ic2Sink.setValidFaces( sides ); - // trigger re-calc! - } - - @TileEvent( TileEventType.WORLD_NBT_WRITE ) - public void writeToNBT_AERootPoweredTile( final NBTTagCompound data ) - { - data.setDouble( "internalCurrentPower", this.getInternalCurrentPower() ); - } - - @TileEvent( TileEventType.WORLD_NBT_READ ) - public void readFromNBT_AERootPoweredTile( final NBTTagCompound data ) - { - this.setInternalCurrentPower( data.getDouble( "internalCurrentPower" ) ); - } - - @Override - public final double getExternalPowerDemand( final PowerUnits externalUnit, final double maxPowerRequired ) - { - return PowerUnits.AE.convertTo( externalUnit, Math.max( 0.0, this.getFunnelPowerDemand( externalUnit.convertTo( PowerUnits.AE, maxPowerRequired ) ) ) ); - } - - protected double getFunnelPowerDemand( final double maxRequired ) - { - return this.getInternalMaxPower() - this.getInternalCurrentPower(); - } - - @Override - public final double injectExternalPower( final PowerUnits input, final double amt ) - { - return PowerUnits.AE.convertTo( input, this.funnelPowerIntoStorage( input.convertTo( PowerUnits.AE, amt ), Actionable.MODULATE ) ); - } - - protected double funnelPowerIntoStorage( final double power, final Actionable mode ) - { - return this.injectAEPower( power, mode ); - } - - @Override - public final double injectAEPower( double amt, final Actionable mode ) - { - if( amt < 0.000001 ) - { - return 0; - } - - if( mode == Actionable.SIMULATE ) - { - final double fakeBattery = this.getInternalCurrentPower() + amt; - - if( fakeBattery > this.getInternalMaxPower() ) - { - return fakeBattery - this.getInternalMaxPower(); - } - - return 0; - } - else - { - if( this.getInternalCurrentPower() < 0.01 && amt > 0.01 ) - { - this.PowerEvent( PowerEventType.PROVIDE_POWER ); - } - - this.setInternalCurrentPower( this.getInternalCurrentPower() + amt ); - if( this.getInternalCurrentPower() > this.getInternalMaxPower() ) - { - amt = this.getInternalCurrentPower() - this.getInternalMaxPower(); - this.setInternalCurrentPower( this.getInternalMaxPower() ); - return amt; - } - - return 0; - } - } - - protected void PowerEvent( final PowerEventType x ) - { - // nothing. - } - - @Override - public final double getAEMaxPower() - { - return this.getInternalMaxPower(); - } - - @Override - public final double getAECurrentPower() - { - return this.getInternalCurrentPower(); - } - - @Override - public final boolean isAEPublicPowerStorage() - { - return this.isInternalPublicPowerStorage(); - } - - @Override - public final AccessRestriction getPowerFlow() - { - return this.getInternalPowerFlow(); - } - - @Override - public final double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier multiplier ) - { - return multiplier.divide( this.extractAEPower( multiplier.multiply( amt ), mode ) ); - } - - protected double extractAEPower( double amt, final Actionable mode ) - { - if( mode == Actionable.SIMULATE ) - { - if( this.getInternalCurrentPower() > amt ) - { - return amt; - } - return this.getInternalCurrentPower(); - } - - final boolean wasFull = this.getInternalCurrentPower() >= this.getInternalMaxPower() - 0.001; - if( wasFull && amt > 0.001 ) - { - this.PowerEvent( PowerEventType.REQUEST_POWER ); - } - - if( this.getInternalCurrentPower() > amt ) - { - this.setInternalCurrentPower( this.getInternalCurrentPower() - amt ); - return amt; - } - - amt = this.getInternalCurrentPower(); - this.setInternalCurrentPower( 0 ); - return amt; - } - - public double getInternalCurrentPower() - { - return this.internalCurrentPower; - } - - public void setInternalCurrentPower( final double internalCurrentPower ) - { - this.internalCurrentPower = internalCurrentPower; - } - - public double getInternalMaxPower() - { - return this.internalMaxPower; - } - - public void setInternalMaxPower( final double internalMaxPower ) - { - this.internalMaxPower = internalMaxPower; - } - - private boolean isInternalPublicPowerStorage() - { - return this.internalPublicPowerStorage; - } - - public void setInternalPublicPowerStorage( final boolean internalPublicPowerStorage ) - { - this.internalPublicPowerStorage = internalPublicPowerStorage; - } - - private AccessRestriction getInternalPowerFlow() - { - return this.internalPowerFlow; - } - - public void setInternalPowerFlow( final AccessRestriction internalPowerFlow ) - { - this.internalPowerFlow = internalPowerFlow; - } - - @Override - public void onReady() - { - super.onReady(); - - this.ic2Sink.onLoad(); - } - - @Override - public void onChunkUnload() - { - super.onChunkUnload(); - - this.ic2Sink.onChunkUnload(); - } - - @Override - public void invalidate() - { - super.invalidate(); - - this.ic2Sink.invalidate(); - } - - @Override - public boolean hasCapability( Capability capability, EnumFacing facing ) - { - if( capability == Capabilities.FORGE_ENERGY ) - { - if( this.getPowerSides().contains( facing ) ) - { - return true; - } - } - else if( capability == Capabilities.TESLA_CONSUMER ) - { - if( this.getPowerSides().contains( facing ) ) - { - return true; - } - } - - return super.hasCapability( capability, facing ); - } - - @SuppressWarnings( "unchecked" ) - @Override - public T getCapability( Capability capability, @Nullable EnumFacing facing ) - { - if( capability == Capabilities.FORGE_ENERGY ) - { - if( this.getPowerSides().contains( facing ) ) - { - return (T) this.forgeEnergyAdapter; - } - } - else if( capability == Capabilities.TESLA_CONSUMER ) - { - if( this.getPowerSides().contains( facing ) ) - { - return (T) this.teslaEnergyAdapter; - } - } - - return super.getCapability( capability, facing ); - } - -} diff --git a/src/main/java/appeng/tile/powersink/RedstoneFlux.java b/src/main/java/appeng/tile/powersink/RedstoneFlux.java deleted file mode 100644 index 52155a624..000000000 --- a/src/main/java/appeng/tile/powersink/RedstoneFlux.java +++ /dev/null @@ -1,65 +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.tile.powersink; - - -import net.minecraft.util.EnumFacing; - -import cofh.redstoneflux.api.IEnergyReceiver; - -import appeng.api.config.PowerUnits; -import appeng.coremod.annotations.Integration.Interface; -import appeng.integration.IntegrationType; - - -@Interface( iname = IntegrationType.RF, iface = "cofh.redstoneflux.api.IEnergyReceiver" ) -public abstract class RedstoneFlux extends AERootPoweredTile implements IEnergyReceiver -{ - @Override - public final int receiveEnergy( final EnumFacing from, final int maxReceive, final boolean simulate ) - { - final int networkRFDemand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) ); - final int usedRF = Math.min( maxReceive, networkRFDemand ); - - if( !simulate ) - { - this.injectExternalPower( PowerUnits.RF, usedRF ); - } - - return usedRF; - } - - @Override - public final int getEnergyStored( final EnumFacing from ) - { - return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower() ) ); - } - - @Override - public final int getMaxEnergyStored( final EnumFacing from ) - { - return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower() ) ); - } - - @Override - public final boolean canConnectEnergy( final EnumFacing from ) - { - return this.getPowerSides().contains( from ); - } -} diff --git a/src/main/resources/assets/appliedenergistics2/lang/cs_cz.lang b/src/main/resources/assets/appliedenergistics2/lang/cs_cz.lang index 1407d2261..c392d70a3 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/cs_cz.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/cs_cz.lang @@ -73,7 +73,6 @@ gui.appliedenergistics2.FluidTunnel=Tekutina gui.appliedenergistics2.RedstoneTunnel=Rudit gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=Světlo gui.appliedenergistics2.security.extract.name=Vybrat diff --git a/src/main/resources/assets/appliedenergistics2/lang/de_de.lang b/src/main/resources/assets/appliedenergistics2/lang/de_de.lang index 12c80aa5e..7d6c81731 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/de_de.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/de_de.lang @@ -100,7 +100,6 @@ gui.appliedenergistics2.FluidTunnel=Flüssigkeiten gui.appliedenergistics2.RedstoneTunnel=Redstone gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=Licht gui.appliedenergistics2.OCTunnel=OpenComputers gui.appliedenergistics2.PressureTunnel=Druck diff --git a/src/main/resources/assets/appliedenergistics2/lang/en_us.lang b/src/main/resources/assets/appliedenergistics2/lang/en_us.lang index c2265e599..4d66bd493 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/en_us.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/en_us.lang @@ -100,7 +100,6 @@ gui.appliedenergistics2.FluidTunnel=Fluid gui.appliedenergistics2.RedstoneTunnel=Redstone gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=Light gui.appliedenergistics2.OCTunnel=OpenComputers gui.appliedenergistics2.PressureTunnel=Pressure diff --git a/src/main/resources/assets/appliedenergistics2/lang/es_es.lang b/src/main/resources/assets/appliedenergistics2/lang/es_es.lang index 4a1c5af5b..f21cef9f2 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/es_es.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/es_es.lang @@ -73,7 +73,6 @@ gui.appliedenergistics2.FluidTunnel=Fluidos gui.appliedenergistics2.RedstoneTunnel=Redstone gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=Luz gui.appliedenergistics2.security.extract.name=Retirar diff --git a/src/main/resources/assets/appliedenergistics2/lang/fr_fr.lang b/src/main/resources/assets/appliedenergistics2/lang/fr_fr.lang index 95ac34319..2493390a3 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/fr_fr.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/fr_fr.lang @@ -100,7 +100,6 @@ gui.appliedenergistics2.FluidTunnel=Fluide gui.appliedenergistics2.RedstoneTunnel=Redstone gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=Lumière gui.appliedenergistics2.OCTunnel=OpenComputers gui.appliedenergistics2.PressureTunnel=Pression diff --git a/src/main/resources/assets/appliedenergistics2/lang/hu_hu.lang b/src/main/resources/assets/appliedenergistics2/lang/hu_hu.lang index e4db79331..c0ee5bb48 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/hu_hu.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/hu_hu.lang @@ -101,7 +101,6 @@ gui.appliedenergistics2.FluidTunnel=Folyadék Csatorna gui.appliedenergistics2.RedstoneTunnel=Vöröskő Csatorna gui.appliedenergistics2.EUTunnel=EU Csatorna gui.appliedenergistics2.FETunnel=FE Csatorna -gui.appliedenergistics2.RFTunnel=RF Csatorna gui.appliedenergistics2.LightTunnel=Fény Csatorna gui.appliedenergistics2.OCTunnel=OpenComputers gui.appliedenergistics2.PressureTunnel=Nyomás diff --git a/src/main/resources/assets/appliedenergistics2/lang/it_it.lang b/src/main/resources/assets/appliedenergistics2/lang/it_it.lang index ae363b231..1c5b2e372 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/it_it.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/it_it.lang @@ -90,7 +90,6 @@ gui.appliedenergistics2.FluidTunnel=Fluido gui.appliedenergistics2.RedstoneTunnel=Pietrarossa gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=Luce gui.appliedenergistics2.security.extract.name=Estrai diff --git a/src/main/resources/assets/appliedenergistics2/lang/ko_kr.lang b/src/main/resources/assets/appliedenergistics2/lang/ko_kr.lang index d763a108b..806d31edd 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/ko_kr.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/ko_kr.lang @@ -83,7 +83,6 @@ gui.appliedenergistics2.FluidTunnel=액체 gui.appliedenergistics2.RedstoneTunnel=레드스톤 gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=빛 gui.appliedenergistics2.security.extract.name=Withdraw diff --git a/src/main/resources/assets/appliedenergistics2/lang/pt_br.lang b/src/main/resources/assets/appliedenergistics2/lang/pt_br.lang index 63d67b44f..19db69ecd 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/pt_br.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/pt_br.lang @@ -100,7 +100,6 @@ gui.appliedenergistics2.FluidTunnel=Fluido gui.appliedenergistics2.RedstoneTunnel=Redstone gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=Luz gui.appliedenergistics2.OCTunnel=OpenComputers gui.appliedenergistics2.PressureTunnel=Pressão diff --git a/src/main/resources/assets/appliedenergistics2/lang/ru_ru.lang b/src/main/resources/assets/appliedenergistics2/lang/ru_ru.lang index 9d74298d2..5732a8230 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/ru_ru.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/ru_ru.lang @@ -100,7 +100,6 @@ gui.appliedenergistics2.FluidTunnel=Жидкость gui.appliedenergistics2.RedstoneTunnel=Красный камень gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=Свет gui.appliedenergistics2.OCTunnel=OpenComputers gui.appliedenergistics2.PressureTunnel=Давление diff --git a/src/main/resources/assets/appliedenergistics2/lang/zh_cn.lang b/src/main/resources/assets/appliedenergistics2/lang/zh_cn.lang index 7ef37e44d..8691c97b4 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/zh_cn.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/zh_cn.lang @@ -100,7 +100,6 @@ gui.appliedenergistics2.FluidTunnel=液体 gui.appliedenergistics2.RedstoneTunnel=红石 gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=光 gui.appliedenergistics2.OCTunnel=OpenComputers gui.appliedenergistics2.PressureTunnel=气压 diff --git a/src/main/resources/assets/appliedenergistics2/lang/zh_tw.lang b/src/main/resources/assets/appliedenergistics2/lang/zh_tw.lang index dae001b67..793bd1708 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/zh_tw.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/zh_tw.lang @@ -73,7 +73,6 @@ gui.appliedenergistics2.FluidTunnel=液體 gui.appliedenergistics2.RedstoneTunnel=紅石 gui.appliedenergistics2.EUTunnel=EU gui.appliedenergistics2.FETunnel=FE -gui.appliedenergistics2.RFTunnel=RF gui.appliedenergistics2.LightTunnel=光 gui.appliedenergistics2.security.extract.name=取出 diff --git a/src/main/resources/assets/appliedenergistics2/models/item/part/p2p_tunnel_rf.json b/src/main/resources/assets/appliedenergistics2/models/item/part/p2p_tunnel_rf.json deleted file mode 100644 index 4a01da8fd..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/item/part/p2p_tunnel_rf.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "appliedenergistics2:item/part/p2p_tunnel", - "textures": { - "type": "minecraft:blocks/iron_block" - } -} diff --git a/src/main/resources/assets/appliedenergistics2/models/part/p2p/p2p_tunnel_rf.json b/src/main/resources/assets/appliedenergistics2/models/part/p2p/p2p_tunnel_rf.json deleted file mode 100644 index 2cc350537..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/part/p2p/p2p_tunnel_rf.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "appliedenergistics2:part/p2p/p2p_tunnel_base", - "textures": { - "type": "minecraft:blocks/iron_block" - } -} diff --git a/src/test/java/appeng/coremod/AppEngCoreTest.java b/src/test/java/appeng/coremod/AppEngCoreTest.java deleted file mode 100644 index a4df14ac4..000000000 --- a/src/test/java/appeng/coremod/AppEngCoreTest.java +++ /dev/null @@ -1,56 +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.coremod; - - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - - -public class AppEngCoreTest -{ - private final static String EXPECTED_CONTAINER_CLASS_NAME = appeng.coremod.AppEngCore.class.getName(); - private final static String EXPECTED_CONTAINER_MOD_ID = "appliedenergistics2-core"; - private final static String[] EXPECTED_TRANSFORMERS = new String[] { - appeng.coremod.transformer.ASMIntegration.class.getName() - }; - - private AppEngCore coreModContainer = new AppEngCore(); - - @Test - public void testTransformerStringsMatchActualClasses() - { - assertArrayEquals( EXPECTED_TRANSFORMERS, this.coreModContainer.getASMTransformerClass() ); - } - - @Test - public void testContainerClassExists() - { - assertEquals( EXPECTED_CONTAINER_CLASS_NAME, this.coreModContainer.getModContainerClass() ); - } - - @Test - public void testContainerModId() - { - assertEquals( EXPECTED_CONTAINER_MOD_ID, this.coreModContainer.getModId() ); - } - -}