Re-enabled the RF and IC2 handler, as well as their P2P tunnels. Added Forge Energy P2P tunnel.
This commit is contained in:
@@ -29,6 +29,7 @@ public enum TunnelType
|
|||||||
ME, // Network Tunnel
|
ME, // Network Tunnel
|
||||||
IC2_POWER, // EU Tunnel
|
IC2_POWER, // EU Tunnel
|
||||||
RF_POWER, // RF Tunnel
|
RF_POWER, // RF Tunnel
|
||||||
|
FE_POWER, // Forge Energy tunnel
|
||||||
REDSTONE, // Redstone Tunnel
|
REDSTONE, // Redstone Tunnel
|
||||||
FLUID, // Fluid Tunnel
|
FLUID, // Fluid Tunnel
|
||||||
ITEM, // Item Tunnel
|
ITEM, // Item Tunnel
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ public interface IParts
|
|||||||
|
|
||||||
IItemDefinition p2PTunnelFluids();
|
IItemDefinition p2PTunnelFluids();
|
||||||
|
|
||||||
//IItemDefinition p2PTunnelEU();
|
IItemDefinition p2PTunnelEU();
|
||||||
|
|
||||||
// IItemDefinition p2PTunnelRF();
|
IItemDefinition p2PTunnelRF();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelLight();
|
IItemDefinition p2PTunnelLight();
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import java.util.Set;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import appeng.integration.IntegrationRegistry;
|
||||||
|
import appeng.integration.IntegrationType;
|
||||||
import appeng.items.parts.ItemFacade;
|
import appeng.items.parts.ItemFacade;
|
||||||
import appeng.recipes.game.DisassembleRecipe;
|
import appeng.recipes.game.DisassembleRecipe;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
@@ -299,11 +301,17 @@ public final class Registration
|
|||||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
|
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
|
||||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RF ) )
|
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RF ) )
|
||||||
// {
|
{
|
||||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
|
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.redstoneflux.api.IEnergyReceiver" );
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
partHelper.registerNewLayer( "appeng.parts.layers.LayerForgeEnergy", "net.minecraftforge.energy.IEnergyStorage" );
|
||||||
|
|
||||||
|
// if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.RF)) {
|
||||||
|
// partHelper.registerNewLayer("appeng.parts.layers.LayerIEnergyStorager", "net.minecraftforge.common.capabilities.ICapabilityProvider");
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
|
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
|
||||||
// {
|
// {
|
||||||
@@ -445,9 +453,8 @@ public final class Registration
|
|||||||
{
|
{
|
||||||
// TODO : 1.12 Improve
|
// TODO : 1.12 Improve
|
||||||
|
|
||||||
final Api api = Api.INSTANCE;
|
final IRegistryContainer registries = Api.INSTANCE.registries();
|
||||||
final IRegistryContainer registries = api.registries();
|
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
ApiDefinitions definitions = api.definitions();
|
|
||||||
final IParts parts = definitions.parts();
|
final IParts parts = definitions.parts();
|
||||||
final IBlocks blocks = definitions.blocks();
|
final IBlocks blocks = definitions.blocks();
|
||||||
final IItems items = definitions.items();
|
final IItems items = definitions.items();
|
||||||
|
|||||||
@@ -62,8 +62,9 @@ public final class ApiParts implements IParts
|
|||||||
private final IItemDefinition p2PTunnelRedstone;
|
private final IItemDefinition p2PTunnelRedstone;
|
||||||
private final IItemDefinition p2PTunnelItems;
|
private final IItemDefinition p2PTunnelItems;
|
||||||
private final IItemDefinition p2PTunnelFluids;
|
private final IItemDefinition p2PTunnelFluids;
|
||||||
// private final IItemDefinition p2PTunnelEU;
|
private final IItemDefinition p2PTunnelEU;
|
||||||
// private final IItemDefinition p2PTunnelRF;
|
private final IItemDefinition p2PTunnelRF;
|
||||||
|
private final IItemDefinition p2PTunnelFE;
|
||||||
private final IItemDefinition p2PTunnelLight;
|
private final IItemDefinition p2PTunnelLight;
|
||||||
// private final IItemDefinition p2PTunnelOpenComputers;
|
// private final IItemDefinition p2PTunnelOpenComputers;
|
||||||
private final IItemDefinition cableAnchor;
|
private final IItemDefinition cableAnchor;
|
||||||
@@ -113,8 +114,9 @@ public final class ApiParts implements IParts
|
|||||||
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2PTunnelRedstone ) );
|
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2PTunnelRedstone ) );
|
||||||
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2PTunnelItems ) );
|
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2PTunnelItems ) );
|
||||||
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelFluids ) );
|
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelFluids ) );
|
||||||
// this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2PTunnelEU ) );
|
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2PTunnelEU ) );
|
||||||
// this.p2PTunnelRF = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRF ) );
|
this.p2PTunnelRF = new DamagedItemDefinition( "part.tunnel.rf", itemPart.createPart( PartType.P2PTunnelRF ) );
|
||||||
|
this.p2PTunnelFE = new DamagedItemDefinition( "part.tunnel.fe", itemPart.createPart( PartType.P2PTunnelFE ) );
|
||||||
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2PTunnelLight ) );
|
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2PTunnelLight ) );
|
||||||
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
|
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
|
||||||
// PartType.P2PTunnelOpenComputers ) );
|
// PartType.P2PTunnelOpenComputers ) );
|
||||||
@@ -286,18 +288,22 @@ public final class ApiParts implements IParts
|
|||||||
return this.p2PTunnelFluids;
|
return this.p2PTunnelFluids;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
@Override
|
||||||
// public IItemDefinition p2PTunnelEU()
|
public IItemDefinition p2PTunnelEU()
|
||||||
// {
|
{
|
||||||
// return this.p2PTunnelEU;
|
return this.p2PTunnelEU;
|
||||||
// }
|
}
|
||||||
|
|
||||||
/* @Override
|
@Override
|
||||||
* public IItemDefinition p2PTunnelRF()
|
public IItemDefinition p2PTunnelRF()
|
||||||
* {
|
{
|
||||||
* return this.p2PTunnelRF;
|
return this.p2PTunnelRF;
|
||||||
* }
|
}
|
||||||
*/
|
|
||||||
|
public IItemDefinition p2PTunnelFE()
|
||||||
|
{
|
||||||
|
return this.p2PTunnelFE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemDefinition p2PTunnelLight()
|
public IItemDefinition p2PTunnelLight()
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ public enum AEFeature
|
|||||||
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_EU( "P2PTunnelEU", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_EU( "P2PTunnelEU", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
|
P2P_TUNNEL_FE( "P2PTunnelFE", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_FLUIDS( "P2PTunnelFluids", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_FLUIDS( "P2PTunnelFluids", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_LIGHT( "P2PTunnelLight", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_LIGHT( "P2PTunnelLight", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_OPEN_COMPUTERS( "P2PTunnelOpenComputers", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_OPEN_COMPUTERS( "P2PTunnelOpenComputers", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
|
|||||||
@@ -56,6 +56,27 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|||||||
this.addNewAttunement( new ItemStack( Blocks.TORCH ), TunnelType.LIGHT );
|
this.addNewAttunement( new ItemStack( Blocks.TORCH ), TunnelType.LIGHT );
|
||||||
this.addNewAttunement( new ItemStack( Blocks.GLOWSTONE ), TunnelType.LIGHT );
|
this.addNewAttunement( new ItemStack( Blocks.GLOWSTONE ), TunnelType.LIGHT );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EU tunnel items
|
||||||
|
*/
|
||||||
|
|
||||||
|
this.addNewAttunement( this.getModItem( "ic2", "cable", 0 ), TunnelType.IC2_POWER ); // Copper cable
|
||||||
|
this.addNewAttunement( this.getModItem( "ic2", "cable", 1 ), TunnelType.IC2_POWER ); // Glass fibre cable
|
||||||
|
this.addNewAttunement( this.getModItem( "ic2", "cable", 2 ), TunnelType.IC2_POWER ); // Gold cable
|
||||||
|
this.addNewAttunement( this.getModItem( "ic2", "cable", 3 ), TunnelType.IC2_POWER ); // HV cable
|
||||||
|
this.addNewAttunement( this.getModItem( "ic2", "cable", 4 ), TunnelType.IC2_POWER ); // Tin cable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* attune based on most redstone base items.
|
* attune based on most redstone base items.
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +112,10 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|||||||
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM );
|
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM );
|
||||||
this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM );
|
this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM );
|
||||||
this.addNewAttunement( this.getModItem( "enderio", "itemitemconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.ITEM );
|
this.addNewAttunement( this.getModItem( "enderio", "itemitemconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.ITEM );
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM );
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM ); // itemduct
|
||||||
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 1 ), TunnelType.ITEM ); // itemduct (opaque)
|
||||||
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 2 ), TunnelType.ITEM ); // impulse itemduct
|
||||||
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 3 ), TunnelType.ITEM ); // impulse itemduct (opaque)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* attune based on lots of random item related stuff
|
* attune based on lots of random item related stuff
|
||||||
@@ -105,7 +129,10 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|||||||
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID );
|
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID );
|
||||||
this.addNewAttunement( this.getModItem( "extrautilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
|
this.addNewAttunement( this.getModItem( "extrautilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
|
||||||
this.addNewAttunement( this.getModItem( "enderio", "itemliquidconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
|
this.addNewAttunement( this.getModItem( "enderio", "itemliquidconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID );
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID ); // fluiduct
|
||||||
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 1 ), TunnelType.FLUID ); // fluiduct (opaque)
|
||||||
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 2 ), TunnelType.FLUID ); // fluiduct hardened
|
||||||
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 3 ), TunnelType.FLUID ); // fluiduct hardened (opaque)
|
||||||
|
|
||||||
for( final AEColor c : AEColor.values() )
|
for( final AEColor c : AEColor.values() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public enum GuiText
|
|||||||
OCTunnel,
|
OCTunnel,
|
||||||
LightTunnel,
|
LightTunnel,
|
||||||
RFTunnel,
|
RFTunnel,
|
||||||
|
FETunnel,
|
||||||
PressureTunnel,
|
PressureTunnel,
|
||||||
|
|
||||||
StoredSize,
|
StoredSize,
|
||||||
|
|||||||
@@ -19,11 +19,7 @@
|
|||||||
package appeng.integration;
|
package appeng.integration;
|
||||||
|
|
||||||
|
|
||||||
import appeng.integration.abstraction.IIC2;
|
import appeng.integration.abstraction.*;
|
||||||
import appeng.integration.abstraction.IInvTweaks;
|
|
||||||
import appeng.integration.abstraction.IJEI;
|
|
||||||
import appeng.integration.abstraction.IMekanism;
|
|
||||||
import appeng.integration.abstraction.IRC;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,6 +38,8 @@ public final class Integrations
|
|||||||
|
|
||||||
static IInvTweaks invTweaks = new IInvTweaks.Stub();
|
static IInvTweaks invTweaks = new IInvTweaks.Stub();
|
||||||
|
|
||||||
|
static IRF redstoneflux = new IRF.Stub();
|
||||||
|
|
||||||
private Integrations()
|
private Integrations()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -101,4 +99,10 @@ public final class Integrations
|
|||||||
return invTweaks;
|
return invTweaks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static IRF setRedstoneFlux( IRF redstoneflux )
|
||||||
|
{
|
||||||
|
Integrations.redstoneflux = redstoneflux;
|
||||||
|
return redstoneflux;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* 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 <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.integration.abstraction;
|
||||||
|
|
||||||
|
import appeng.integration.IIntegrationModule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author GuntherDW
|
||||||
|
*/
|
||||||
|
public interface IRF
|
||||||
|
{
|
||||||
|
class Stub extends IIntegrationModule.Stub implements IRF
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,84 +1,81 @@
|
|||||||
///*
|
/*
|
||||||
// * This file is part of Applied Energistics 2.
|
* This file is part of Applied Energistics 2.
|
||||||
// * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
// * (at your option) any later version.
|
* (at your option) any later version.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is distributed in the hope that it will be useful,
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// * GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
// *
|
*
|
||||||
// * You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
// * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
// */
|
*/
|
||||||
//
|
|
||||||
//package appeng.integration.modules.ic2;
|
package appeng.integration.modules.ic2;
|
||||||
//
|
|
||||||
//
|
import net.minecraft.item.ItemStack;
|
||||||
//import net.minecraft.item.ItemStack;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
//import net.minecraft.tileentity.TileEntity;
|
|
||||||
//
|
import appeng.api.AEApi;
|
||||||
//import ic2.api.recipe.RecipeInputItemStack;
|
import appeng.api.config.TunnelType;
|
||||||
//
|
import appeng.api.features.IP2PTunnelRegistry;
|
||||||
//import appeng.api.AEApi;
|
import appeng.integration.IntegrationHelper;
|
||||||
//import appeng.api.config.TunnelType;
|
import appeng.integration.abstraction.IC2PowerSink;
|
||||||
//import appeng.api.features.IP2PTunnelRegistry;
|
import appeng.integration.abstraction.IIC2;
|
||||||
//import appeng.integration.IntegrationHelper;
|
import appeng.tile.powersink.IExternalPowerSink;
|
||||||
//import appeng.integration.abstraction.IC2PowerSink;
|
|
||||||
//import appeng.integration.abstraction.IIC2;
|
|
||||||
//import appeng.tile.powersink.IExternalPowerSink;
|
public class IC2Module implements IIC2
|
||||||
//
|
{
|
||||||
//
|
|
||||||
//public class IC2Module implements IIC2
|
private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" };
|
||||||
//{
|
|
||||||
//
|
public IC2Module()
|
||||||
// private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" };
|
{
|
||||||
//
|
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
|
||||||
// public IC2Module()
|
IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class );
|
||||||
// {
|
IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class );
|
||||||
// IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
|
IntegrationHelper.testClassExistence( this, ic2.api.recipe.IRecipeInput.class );
|
||||||
// IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class );
|
}
|
||||||
// IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class );
|
|
||||||
// IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class );
|
@Override
|
||||||
// }
|
public void postInit()
|
||||||
//
|
{
|
||||||
// @Override
|
final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||||
// public void postInit()
|
|
||||||
// {
|
for( String string : IC2_CABLE_TYPES )
|
||||||
// final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
{
|
||||||
//
|
reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER );
|
||||||
// for( String string : IC2_CABLE_TYPES )
|
}
|
||||||
// {
|
}
|
||||||
// reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER );
|
|
||||||
// }
|
private ItemStack getItem( final String name, String variant )
|
||||||
// }
|
{
|
||||||
//
|
return ic2.api.item.IC2Items.getItem( name, variant );
|
||||||
// private ItemStack getItem( final String name, String variant )
|
}
|
||||||
// {
|
|
||||||
// return ic2.api.item.IC2Items.getItem( name, variant );
|
private ItemStack getCable( final String type )
|
||||||
// }
|
{
|
||||||
//
|
return this.getItem( "cable", "type:" + type );
|
||||||
// private ItemStack getCable( final String type )
|
}
|
||||||
// {
|
|
||||||
// return this.getItem( "cable", "type:" + type );
|
/**
|
||||||
// }
|
* Create an IC2 power sink for the given external sink.
|
||||||
//
|
*/
|
||||||
// /**
|
@Override
|
||||||
// * Create an IC2 power sink for the given external sink.
|
public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
|
||||||
// */
|
{
|
||||||
// @Override
|
return new IC2PowerSinkAdapter( tileEntity, externalSink );
|
||||||
// public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
|
}
|
||||||
// {
|
|
||||||
// return new IC2PowerSinkAdapter( tileEntity, externalSink );
|
@Override
|
||||||
// }
|
public void maceratorRecipe( ItemStack in, ItemStack out )
|
||||||
//
|
{
|
||||||
// @Override
|
ic2.api.recipe.Recipes.macerator.addRecipe( new IC2RecipeInput( in, in.getCount() ), null, false, out );
|
||||||
// public void maceratorRecipe( ItemStack in, ItemStack out )
|
}
|
||||||
// {
|
}
|
||||||
// ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out );
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|||||||
@@ -1,94 +1,94 @@
|
|||||||
///*
|
/*
|
||||||
// * This file is part of Applied Energistics 2.
|
* This file is part of Applied Energistics 2.
|
||||||
// * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
// * (at your option) any later version.
|
* (at your option) any later version.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is distributed in the hope that it will be useful,
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// * GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
// *
|
*
|
||||||
// * You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
// * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
// */
|
*/
|
||||||
//
|
|
||||||
//package appeng.integration.modules.ic2;
|
package appeng.integration.modules.ic2;
|
||||||
//
|
|
||||||
//
|
|
||||||
//import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
//import java.util.Set;
|
import java.util.Set;
|
||||||
//
|
|
||||||
//import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
//import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
//
|
|
||||||
//import ic2.api.energy.prefab.BasicSink;
|
import ic2.api.energy.prefab.BasicSink;
|
||||||
//import ic2.api.energy.tile.IEnergyEmitter;
|
import ic2.api.energy.tile.IEnergyEmitter;
|
||||||
//
|
|
||||||
//import appeng.api.config.PowerUnits;
|
import appeng.api.config.PowerUnits;
|
||||||
//import appeng.integration.abstraction.IC2PowerSink;
|
import appeng.integration.abstraction.IC2PowerSink;
|
||||||
//import appeng.tile.powersink.IExternalPowerSink;
|
import appeng.tile.powersink.IExternalPowerSink;
|
||||||
//
|
|
||||||
//
|
|
||||||
///**
|
/**
|
||||||
// * The real implementation of IC2PowerSink.
|
* The real implementation of IC2PowerSink.
|
||||||
// */
|
*/
|
||||||
//public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink
|
public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink
|
||||||
//{
|
{
|
||||||
//
|
|
||||||
// private final IExternalPowerSink powerSink;
|
private final IExternalPowerSink powerSink;
|
||||||
//
|
|
||||||
// private final Set<EnumFacing> validFaces = EnumSet.allOf( EnumFacing.class );
|
private final Set<EnumFacing> validFaces = EnumSet.allOf( EnumFacing.class );
|
||||||
//
|
|
||||||
// public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink )
|
public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink )
|
||||||
// {
|
{
|
||||||
// super( tileEntity, 0, Integer.MAX_VALUE );
|
super( tileEntity, 0, Integer.MAX_VALUE );
|
||||||
// this.powerSink = powerSink;
|
this.powerSink = powerSink;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void invalidate()
|
public void invalidate()
|
||||||
// {
|
{
|
||||||
// super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onChunkUnload()
|
public void onChunkUnload()
|
||||||
// {
|
{
|
||||||
// super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onLoad()
|
public void onLoad()
|
||||||
// {
|
{
|
||||||
// super.onLoaded();
|
super.onLoad();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double getDemandedEnergy()
|
public double getDemandedEnergy()
|
||||||
// {
|
{
|
||||||
// return powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
|
return powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
||||||
// {
|
{
|
||||||
// return PowerUnits.EU.convertTo( PowerUnits.AE, powerSink.injectExternalPower( PowerUnits.EU, amount ) );
|
return PowerUnits.EU.convertTo( PowerUnits.AE, powerSink.injectExternalPower( PowerUnits.EU, amount ) );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side )
|
public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side )
|
||||||
// {
|
{
|
||||||
// return validFaces.contains( side );
|
return validFaces.contains( side );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void setValidFaces( Set<EnumFacing> faces )
|
public void setValidFaces( Set<EnumFacing> faces )
|
||||||
// {
|
{
|
||||||
// this.validFaces.clear();
|
this.validFaces.clear();
|
||||||
// this.validFaces.addAll( faces );
|
this.validFaces.addAll( faces );
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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 <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.integration.modules.ic2;
|
||||||
|
|
||||||
|
import ic2.api.recipe.IRecipeInput;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of IRecipeInput for the macerator recipe.
|
||||||
|
* @author GuntherDW
|
||||||
|
*/
|
||||||
|
public class IC2RecipeInput implements IRecipeInput
|
||||||
|
{
|
||||||
|
@Nonnull
|
||||||
|
private final ItemStack itemstack;
|
||||||
|
private final int amount;
|
||||||
|
|
||||||
|
public IC2RecipeInput( ItemStack in, int amount )
|
||||||
|
{
|
||||||
|
this.itemstack = in;
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches( ItemStack itemStack )
|
||||||
|
{
|
||||||
|
return this.itemstack.isItemEqual( itemStack );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAmount()
|
||||||
|
{
|
||||||
|
return this.amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getInputs()
|
||||||
|
{
|
||||||
|
return Collections.unmodifiableList( Collections.singletonList( itemstack ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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 <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,6 +28,8 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import appeng.integration.IntegrationHelper;
|
||||||
|
import appeng.parts.p2p.*;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
@@ -59,12 +61,6 @@ import appeng.parts.networking.PartCableGlass;
|
|||||||
import appeng.parts.networking.PartCableSmart;
|
import appeng.parts.networking.PartCableSmart;
|
||||||
import appeng.parts.networking.PartDenseCable;
|
import appeng.parts.networking.PartDenseCable;
|
||||||
import appeng.parts.networking.PartQuartzFiber;
|
import appeng.parts.networking.PartQuartzFiber;
|
||||||
import appeng.parts.p2p.PartP2PFluids;
|
|
||||||
//import appeng.parts.p2p.PartP2PIC2Power;
|
|
||||||
import appeng.parts.p2p.PartP2PItems;
|
|
||||||
import appeng.parts.p2p.PartP2PLight;
|
|
||||||
import appeng.parts.p2p.PartP2PRedstone;
|
|
||||||
import appeng.parts.p2p.PartP2PTunnelME;
|
|
||||||
import appeng.parts.reporting.PartConversionMonitor;
|
import appeng.parts.reporting.PartConversionMonitor;
|
||||||
import appeng.parts.reporting.PartCraftingTerminal;
|
import appeng.parts.reporting.PartCraftingTerminal;
|
||||||
import appeng.parts.reporting.PartDarkPanel;
|
import appeng.parts.reporting.PartDarkPanel;
|
||||||
@@ -235,19 +231,26 @@ public enum PartType
|
|||||||
return "P2PTunnel";
|
return "P2PTunnel";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//
|
|
||||||
// P2PTunnelEU( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
|
|
||||||
// .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
|
|
||||||
// {
|
|
||||||
// @Override
|
|
||||||
// String getUnlocalizedName()
|
|
||||||
// {
|
|
||||||
// return "P2PTunnel";
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
|
|
||||||
// P2PTunnelRF( 466, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRF ), EnumSet.of( IntegrationType.RF ),
|
P2PTunnelEU( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
|
||||||
// PartP2PRFPower.class, GuiText.RFTunnel ),
|
.of ( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
String getUnlocalizedName()
|
||||||
|
{
|
||||||
|
return "P2PTunnel";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
P2PTunnelRF( 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 "P2PTunnel";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
P2PTunnelLight( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
P2PTunnelLight( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||||
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
||||||
@@ -259,6 +262,16 @@ public enum PartType
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
P2PTunnelFE( 469, "p2p_tunnel_fe", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE ), EnumSet
|
||||||
|
.noneOf( IntegrationType.class ), PartP2PFEPower.class, GuiText.FETunnel )
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
String getUnlocalizedName()
|
||||||
|
{
|
||||||
|
return "P2PTunnel";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
|
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
|
||||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,141 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* * 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 <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.parts.layers;
|
||||||
|
|
||||||
|
import appeng.api.parts.IPart;
|
||||||
|
import appeng.api.parts.LayerBase;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author GuntherDW
|
||||||
|
*/
|
||||||
|
public class LayerForgeEnergy extends LayerBase implements ICapabilityProvider, IEnergyStorage
|
||||||
|
{
|
||||||
|
|
||||||
|
private final EnumFacing facing;
|
||||||
|
|
||||||
|
public LayerForgeEnergy()
|
||||||
|
{
|
||||||
|
this.facing = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerForgeEnergy( EnumFacing facing )
|
||||||
|
{
|
||||||
|
this.facing = facing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int receiveEnergy( int maxReceive, boolean simulate )
|
||||||
|
{
|
||||||
|
if( facing != null)
|
||||||
|
{
|
||||||
|
IPart part = getPart( facing );
|
||||||
|
if( part instanceof IEnergyStorage )
|
||||||
|
{
|
||||||
|
return ( (IEnergyStorage) part ).receiveEnergy( maxReceive, simulate );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int extractEnergy( int maxExtract, boolean simulate )
|
||||||
|
{
|
||||||
|
if( facing != null)
|
||||||
|
{
|
||||||
|
IPart part = getPart( facing );
|
||||||
|
if( part instanceof IEnergyStorage )
|
||||||
|
{
|
||||||
|
return ( (IEnergyStorage) part ).extractEnergy( maxExtract, simulate );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEnergyStored()
|
||||||
|
{
|
||||||
|
if( facing != null)
|
||||||
|
{
|
||||||
|
IPart part = getPart( facing );
|
||||||
|
if( part instanceof IEnergyStorage )
|
||||||
|
{
|
||||||
|
return ( (IEnergyStorage) part ).getEnergyStored();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxEnergyStored()
|
||||||
|
{
|
||||||
|
if( facing != null)
|
||||||
|
{
|
||||||
|
IPart part = getPart( facing );
|
||||||
|
if( part instanceof IEnergyStorage )
|
||||||
|
{
|
||||||
|
return ( (IEnergyStorage) part ).getMaxEnergyStored();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtract()
|
||||||
|
{
|
||||||
|
if( facing != null)
|
||||||
|
{
|
||||||
|
IPart part = getPart( facing );
|
||||||
|
if( part instanceof IEnergyStorage )
|
||||||
|
{
|
||||||
|
return ( (IEnergyStorage) part ).canExtract();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canReceive()
|
||||||
|
{
|
||||||
|
if( facing != null)
|
||||||
|
{
|
||||||
|
IPart part = getPart( facing );
|
||||||
|
if( part instanceof IEnergyStorage )
|
||||||
|
{
|
||||||
|
return ( (IEnergyStorage) part ).canReceive();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,75 +19,75 @@
|
|||||||
package appeng.parts.layers;
|
package appeng.parts.layers;
|
||||||
|
|
||||||
|
|
||||||
//import cofh.api.energy.IEnergyConnection;
|
import appeng.api.parts.IPart;
|
||||||
//import cofh.api.energy.IEnergyHandler;
|
import appeng.api.parts.LayerBase;
|
||||||
//import cofh.api.energy.IEnergyProvider;
|
import cofh.redstoneflux.api.IEnergyConnection;
|
||||||
//import cofh.api.energy.IEnergyReceiver;
|
import cofh.redstoneflux.api.IEnergyHandler;
|
||||||
//import appeng.api.parts.IPart;
|
import cofh.redstoneflux.api.IEnergyProvider;
|
||||||
//import appeng.api.parts.LayerBase;
|
import cofh.redstoneflux.api.IEnergyReceiver;
|
||||||
//import appeng.api.util.ForgeDirection;
|
import net.minecraft.util.EnumFacing;
|
||||||
//
|
|
||||||
//
|
|
||||||
//public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler
|
public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler, IEnergyReceiver, IEnergyProvider
|
||||||
//{
|
{
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate )
|
public int receiveEnergy( EnumFacing from, int maxReceive, boolean simulate )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( from );
|
IPart part = this.getPart( from );
|
||||||
// if( part instanceof IEnergyReceiver )
|
if( part instanceof IEnergyReceiver )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergyReceiver) part ).receiveEnergy( from, maxReceive, simulate );
|
return ( (IEnergyReceiver) part ).receiveEnergy( from, maxReceive, simulate );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public int extractEnergy( ForgeDirection from, int maxExtract, boolean simulate )
|
public int extractEnergy( EnumFacing from, int maxExtract, boolean simulate )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( from );
|
IPart part = this.getPart( from );
|
||||||
// if( part instanceof IEnergyProvider )
|
if( part instanceof IEnergyProvider )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergyProvider) part ).extractEnergy( from, maxExtract, simulate );
|
return ( (IEnergyProvider) part ).extractEnergy( from, maxExtract, simulate );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public int getEnergyStored( ForgeDirection from )
|
public int getEnergyStored( EnumFacing from )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( from );
|
IPart part = this.getPart( from );
|
||||||
// if( part instanceof IEnergyProvider )
|
if( part instanceof IEnergyProvider )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergyProvider) part ).getEnergyStored( from );
|
return ( (IEnergyProvider) part ).getEnergyStored( from );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public int getMaxEnergyStored( ForgeDirection from )
|
public int getMaxEnergyStored( EnumFacing from )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( from );
|
IPart part = this.getPart( from );
|
||||||
// if( part instanceof IEnergyProvider )
|
if( part instanceof IEnergyProvider )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergyProvider) part ).getMaxEnergyStored( from );
|
return ( (IEnergyProvider) part ).getMaxEnergyStored( from );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean canConnectEnergy( ForgeDirection from )
|
public boolean canConnectEnergy( EnumFacing from )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( from );
|
IPart part = this.getPart( from );
|
||||||
// if( part instanceof IEnergyConnection )
|
if( part instanceof IEnergyConnection )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergyConnection) part ).canConnectEnergy( from );
|
return ( (IEnergyConnection) part ).canConnectEnergy( from );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -1,204 +1,204 @@
|
|||||||
///*
|
/*
|
||||||
// * This file is part of Applied Energistics 2.
|
* This file is part of Applied Energistics 2.
|
||||||
// * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
// * (at your option) any later version.
|
* (at your option) any later version.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is distributed in the hope that it will be useful,
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// * GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
// *
|
*
|
||||||
// * You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
// * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
// */
|
*/
|
||||||
//
|
|
||||||
//package appeng.parts.layers;
|
package appeng.parts.layers;
|
||||||
//
|
|
||||||
//
|
|
||||||
//import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
//import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
//import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
//import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
//
|
|
||||||
//import ic2.api.energy.tile.IEnergyAcceptor;
|
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||||
//import ic2.api.energy.tile.IEnergyEmitter;
|
import ic2.api.energy.tile.IEnergyEmitter;
|
||||||
//import ic2.api.energy.tile.IEnergySink;
|
import ic2.api.energy.tile.IEnergySink;
|
||||||
//import ic2.api.energy.tile.IEnergyTile;
|
import ic2.api.energy.tile.IEnergyTile;
|
||||||
//
|
|
||||||
//import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
//import appeng.api.parts.IPartHost;
|
import appeng.api.parts.IPartHost;
|
||||||
//import appeng.api.parts.LayerBase;
|
import appeng.api.parts.LayerBase;
|
||||||
//import appeng.api.parts.LayerFlags;
|
import appeng.api.parts.LayerFlags;
|
||||||
//import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
//
|
|
||||||
//
|
|
||||||
//public class LayerIEnergySink extends LayerBase implements IEnergySink
|
public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||||
//{
|
{
|
||||||
//
|
|
||||||
// private TileEntity getEnergySinkTile()
|
private TileEntity getEnergySinkTile()
|
||||||
// {
|
{
|
||||||
// IPartHost host = (IPartHost) this;
|
IPartHost host = (IPartHost) this;
|
||||||
// return host.getTile();
|
return host.getTile();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private World getEnergySinkWorld()
|
private World getEnergySinkWorld()
|
||||||
// {
|
{
|
||||||
// if( this.getEnergySinkTile() == null )
|
if( this.getEnergySinkTile() == null )
|
||||||
// {
|
{
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return this.getEnergySinkTile().getWorld();
|
return this.getEnergySinkTile().getWorld();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private boolean isTileValid()
|
private boolean isTileValid()
|
||||||
// {
|
{
|
||||||
// TileEntity te = this.getEnergySinkTile();
|
TileEntity te = this.getEnergySinkTile();
|
||||||
//
|
|
||||||
// if( te == null )
|
if( te == null )
|
||||||
// {
|
{
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return !te.isInvalid() && te.getWorld().isBlockLoaded( te.getPos() );
|
return !te.isInvalid() && te.getWorld().isBlockLoaded( te.getPos() );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private void addToENet()
|
private void addToENet()
|
||||||
// {
|
{
|
||||||
// if( this.getEnergySinkWorld() == null )
|
if( this.getEnergySinkWorld() == null )
|
||||||
// {
|
{
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // re-add
|
// re-add
|
||||||
// this.removeFromENet();
|
this.removeFromENet();
|
||||||
//
|
|
||||||
// if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
||||||
// {
|
{
|
||||||
// this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
||||||
// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private void removeFromENet()
|
private void removeFromENet()
|
||||||
// {
|
{
|
||||||
// if( this.getEnergySinkWorld() == null )
|
if( this.getEnergySinkWorld() == null )
|
||||||
// {
|
{
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if( this.isInIC2() && Platform.isServer() )
|
if( this.isInIC2() && Platform.isServer() )
|
||||||
// {
|
{
|
||||||
// this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
||||||
// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private boolean interestedInIC2()
|
private boolean interestedInIC2()
|
||||||
// {
|
{
|
||||||
// if( !( (IPartHost) this ).isInWorld() )
|
if( !( (IPartHost) this ).isInWorld() )
|
||||||
// {
|
{
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// int interested = 0;
|
int interested = 0;
|
||||||
// for( EnumFacing dir : EnumFacing.values() )
|
for( EnumFacing dir : EnumFacing.values() )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( dir );
|
IPart part = this.getPart( dir );
|
||||||
// if( part instanceof IEnergyTile )
|
if( part instanceof IEnergyTile )
|
||||||
// {
|
{
|
||||||
// interested++;
|
interested++;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return interested == 1;// if more then one tile is interested we need to abandon...
|
return interested == 1;// if more then one tile is interested we need to abandon...
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void partChanged()
|
public void partChanged()
|
||||||
// {
|
{
|
||||||
// super.partChanged();
|
super.partChanged();
|
||||||
//
|
|
||||||
// if( this.interestedInIC2() )
|
if( this.interestedInIC2() )
|
||||||
// {
|
{
|
||||||
// this.addToENet();
|
this.addToENet();
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// this.removeFromENet();
|
this.removeFromENet();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction )
|
public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction )
|
||||||
// {
|
{
|
||||||
// if( !this.isInIC2() )
|
if( !this.isInIC2() )
|
||||||
// {
|
{
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// IPart part = this.getPart( direction );
|
IPart part = this.getPart( direction );
|
||||||
// if( part instanceof IEnergySink )
|
if( part instanceof IEnergySink )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction );
|
return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction );
|
||||||
// }
|
}
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private boolean isInIC2()
|
private boolean isInIC2()
|
||||||
// {
|
{
|
||||||
// return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double getDemandedEnergy()
|
public double getDemandedEnergy()
|
||||||
// {
|
{
|
||||||
// if( !this.isInIC2() )
|
if( !this.isInIC2() )
|
||||||
// {
|
{
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // this is a flawed implementation, that requires a change to the IC2 API.
|
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||||
//
|
|
||||||
// for( EnumFacing dir : EnumFacing.values() )
|
for( EnumFacing dir : EnumFacing.values() )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( dir );
|
IPart part = this.getPart( dir );
|
||||||
// if( part instanceof IEnergySink )
|
if( part instanceof IEnergySink )
|
||||||
// {
|
{
|
||||||
// // use lower number cause ic2 deletes power it sends that isn't received.
|
// use lower number cause ic2 deletes power it sends that isn't received.
|
||||||
// return ( (IEnergySink) part ).getDemandedEnergy();
|
return ( (IEnergySink) part ).getDemandedEnergy();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public int getSinkTier()
|
public int getSinkTier()
|
||||||
// {
|
{
|
||||||
// return Integer.MAX_VALUE; // no real options here...
|
return Integer.MAX_VALUE; // no real options here...
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
||||||
// {
|
{
|
||||||
// if( !this.isInIC2() )
|
if( !this.isInIC2() )
|
||||||
// {
|
{
|
||||||
// return amount;
|
return amount;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// for( EnumFacing dir : EnumFacing.values() )
|
for( EnumFacing dir : EnumFacing.values() )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( dir );
|
IPart part = this.getPart( dir );
|
||||||
// if( part instanceof IEnergySink )
|
if( part instanceof IEnergySink )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage );
|
return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return amount;
|
return amount;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|||||||
@@ -1,207 +1,207 @@
|
|||||||
///*
|
/*
|
||||||
// * This file is part of Applied Energistics 2.
|
* This file is part of Applied Energistics 2.
|
||||||
// * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
// * (at your option) any later version.
|
* (at your option) any later version.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is distributed in the hope that it will be useful,
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// * GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
// *
|
*
|
||||||
// * You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
// * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
// */
|
*/
|
||||||
//
|
|
||||||
//package appeng.parts.layers;
|
package appeng.parts.layers;
|
||||||
//
|
|
||||||
//
|
|
||||||
//import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
//import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
//import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
//import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
//
|
|
||||||
//import ic2.api.energy.tile.IEnergyAcceptor;
|
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||||
//import ic2.api.energy.tile.IEnergyEmitter;
|
import ic2.api.energy.tile.IEnergyEmitter;
|
||||||
//import ic2.api.energy.tile.IEnergySource;
|
import ic2.api.energy.tile.IEnergySource;
|
||||||
//import ic2.api.energy.tile.IEnergyTile;
|
import ic2.api.energy.tile.IEnergyTile;
|
||||||
//
|
|
||||||
//import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
//import appeng.api.parts.IPartHost;
|
import appeng.api.parts.IPartHost;
|
||||||
//import appeng.api.parts.LayerBase;
|
import appeng.api.parts.LayerBase;
|
||||||
//import appeng.api.parts.LayerFlags;
|
import appeng.api.parts.LayerFlags;
|
||||||
//import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
//
|
|
||||||
//
|
|
||||||
//public class LayerIEnergySource extends LayerBase implements IEnergySource
|
public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||||
//{
|
{
|
||||||
//
|
|
||||||
// private TileEntity getEnergySourceTile()
|
private TileEntity getEnergySourceTile()
|
||||||
// {
|
{
|
||||||
// IPartHost host = (IPartHost) this;
|
IPartHost host = (IPartHost) this;
|
||||||
// return host.getTile();
|
return host.getTile();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private World getEnergySourceWorld()
|
private World getEnergySourceWorld()
|
||||||
// {
|
{
|
||||||
// if( this.getEnergySourceTile() == null )
|
if( this.getEnergySourceTile() == null )
|
||||||
// {
|
{
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
// return this.getEnergySourceTile().getWorld();
|
return this.getEnergySourceTile().getWorld();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private boolean isTileValid()
|
private boolean isTileValid()
|
||||||
// {
|
{
|
||||||
// TileEntity te = this.getEnergySourceTile();
|
TileEntity te = this.getEnergySourceTile();
|
||||||
// return te != null && !te.isInvalid();
|
return te != null && !te.isInvalid();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private void addToENet()
|
private void addToENet()
|
||||||
// {
|
{
|
||||||
// if( this.getEnergySourceWorld() == null )
|
if( this.getEnergySourceWorld() == null )
|
||||||
// {
|
{
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // re-add
|
// re-add
|
||||||
// this.removeFromENet();
|
this.removeFromENet();
|
||||||
//
|
|
||||||
// if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
||||||
// {
|
{
|
||||||
// this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
||||||
// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private void removeFromENet()
|
private void removeFromENet()
|
||||||
// {
|
{
|
||||||
// if( this.getEnergySourceWorld() == null )
|
if( this.getEnergySourceWorld() == null )
|
||||||
// {
|
{
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if( this.isInIC2() && Platform.isServer() )
|
if( this.isInIC2() && Platform.isServer() )
|
||||||
// {
|
{
|
||||||
// this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
||||||
// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private boolean interestedInIC2()
|
private boolean interestedInIC2()
|
||||||
// {
|
{
|
||||||
// if( !( (IPartHost) this ).isInWorld() )
|
if( !( (IPartHost) this ).isInWorld() )
|
||||||
// {
|
{
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// int interested = 0;
|
int interested = 0;
|
||||||
// for( EnumFacing dir : EnumFacing.values() )
|
for( EnumFacing dir : EnumFacing.values() )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( dir );
|
IPart part = this.getPart( dir );
|
||||||
// if( part instanceof IEnergyTile )
|
if( part instanceof IEnergyTile )
|
||||||
// {
|
{
|
||||||
// interested++;
|
interested++;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return interested == 1;// if more then one tile is interested we need to abandon...
|
return interested == 1;// if more then one tile is interested we need to abandon...
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void partChanged()
|
public void partChanged()
|
||||||
// {
|
{
|
||||||
// super.partChanged();
|
super.partChanged();
|
||||||
//
|
|
||||||
// if( this.interestedInIC2() )
|
if( this.interestedInIC2() )
|
||||||
// {
|
{
|
||||||
// this.addToENet();
|
this.addToENet();
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// this.removeFromENet();
|
this.removeFromENet();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction )
|
public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction )
|
||||||
// {
|
{
|
||||||
// if( !this.isInIC2() )
|
if( !this.isInIC2() )
|
||||||
// {
|
{
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// IPart part = this.getPart( direction );
|
IPart part = this.getPart( direction );
|
||||||
// if( part instanceof IEnergyEmitter )
|
if( part instanceof IEnergyEmitter )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction );
|
return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction );
|
||||||
// }
|
}
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private boolean isInIC2()
|
private boolean isInIC2()
|
||||||
// {
|
{
|
||||||
// return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double getOfferedEnergy()
|
public double getOfferedEnergy()
|
||||||
// {
|
{
|
||||||
// if( !this.isInIC2() )
|
if( !this.isInIC2() )
|
||||||
// {
|
{
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // this is a flawed implementation, that requires a change to the IC2 API.
|
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||||
//
|
|
||||||
// for( EnumFacing dir : EnumFacing.values() )
|
for( EnumFacing dir : EnumFacing.values() )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( dir );
|
IPart part = this.getPart( dir );
|
||||||
// if( part instanceof IEnergySource )
|
if( part instanceof IEnergySource )
|
||||||
// {
|
{
|
||||||
// // use lower number cause ic2 deletes power it sends that isn't received.
|
// use lower number cause ic2 deletes power it sends that isn't received.
|
||||||
// return ( (IEnergySource) part ).getOfferedEnergy();
|
return ( (IEnergySource) part ).getOfferedEnergy();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void drawEnergy( double amount )
|
public void drawEnergy( double amount )
|
||||||
// {
|
{
|
||||||
// // this is a flawed implementation, that requires a change to the IC2 API.
|
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||||
//
|
|
||||||
// for( EnumFacing dir : EnumFacing.values() )
|
for( EnumFacing dir : EnumFacing.values() )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( dir );
|
IPart part = this.getPart( dir );
|
||||||
// if( part instanceof IEnergySource )
|
if( part instanceof IEnergySource )
|
||||||
// {
|
{
|
||||||
// ( (IEnergySource) part ).drawEnergy( amount );
|
( (IEnergySource) part ).drawEnergy( amount );
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public int getSourceTier()
|
public int getSourceTier()
|
||||||
// {
|
{
|
||||||
// // this is a flawed implementation, that requires a change to the IC2 API.
|
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||||
//
|
|
||||||
// for( EnumFacing dir : EnumFacing.values() )
|
for( EnumFacing dir : EnumFacing.values() )
|
||||||
// {
|
{
|
||||||
// IPart part = this.getPart( dir );
|
IPart part = this.getPart( dir );
|
||||||
// if( part instanceof IEnergySource )
|
if( part instanceof IEnergySource )
|
||||||
// {
|
{
|
||||||
// return ( (IEnergySource) part ).getSourceTier();
|
return ( (IEnergySource) part ).getSourceTier();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,250 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* * 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 <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.parts.p2p;
|
||||||
|
|
||||||
|
import appeng.api.config.PowerUnits;
|
||||||
|
import appeng.api.parts.IPartModel;
|
||||||
|
import appeng.items.parts.PartModels;
|
||||||
|
import appeng.me.GridAccessException;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author GuntherDW
|
||||||
|
*/
|
||||||
|
public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> implements IEnergyStorage
|
||||||
|
{
|
||||||
|
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_fe" );
|
||||||
|
|
||||||
|
private boolean cachedTarget = false;
|
||||||
|
|
||||||
|
private IEnergyStorage outputTarget;
|
||||||
|
|
||||||
|
@PartModels
|
||||||
|
public static List<IPartModel> getModels()
|
||||||
|
{
|
||||||
|
return MODELS.getModels();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPartModel getStaticModels()
|
||||||
|
{
|
||||||
|
return MODELS.getModel( isPowered(), isActive() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public PartP2PFEPower( ItemStack is )
|
||||||
|
{
|
||||||
|
super( is );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTunnelNetworkChange()
|
||||||
|
{
|
||||||
|
this.getHost().notifyNeighbors();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeighborChanged()
|
||||||
|
{
|
||||||
|
super.onNeighborChanged();
|
||||||
|
|
||||||
|
this.cachedTarget = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int receiveEnergy( int maxReceive, boolean simulate )
|
||||||
|
{
|
||||||
|
if( this.isOutput() )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( this.isActive() )
|
||||||
|
{
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for( PartP2PFEPower t : this.getOutputs() )
|
||||||
|
{
|
||||||
|
if( Platform.getRandomInt() % 2 > 0 )
|
||||||
|
{
|
||||||
|
int receiver = t.getOutput().receiveEnergy( maxReceive, simulate );
|
||||||
|
maxReceive -= receiver;
|
||||||
|
total += receiver;
|
||||||
|
|
||||||
|
if( maxReceive <= 0 )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( maxReceive > 0 )
|
||||||
|
{
|
||||||
|
for( PartP2PFEPower t : this.getOutputs() )
|
||||||
|
{
|
||||||
|
int receiver = t.getOutput().receiveEnergy( maxReceive, simulate );
|
||||||
|
maxReceive -= receiver;
|
||||||
|
total += receiver;
|
||||||
|
|
||||||
|
if( maxReceive <= 0 )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.queueTunnelDrain( PowerUnits.RF, total );
|
||||||
|
}
|
||||||
|
catch( GridAccessException ignored )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int extractEnergy( int maxExtract, boolean simulate )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnergyStorage getOutput()
|
||||||
|
{
|
||||||
|
if( this.isOutput() )
|
||||||
|
{
|
||||||
|
if( !this.cachedTarget )
|
||||||
|
{
|
||||||
|
TileEntity self = this.getTile();
|
||||||
|
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.hasCapability( CapabilityEnergy.ENERGY, this.getSide().getOpposite().getFacing() ) ? te.getCapability( CapabilityEnergy.ENERGY, this.getSide().getOpposite().getFacing() ) : null;
|
||||||
|
this.cachedTarget = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( this.outputTarget == null || !this.outputTarget.canReceive() )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.outputTarget;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEnergyStored()
|
||||||
|
{
|
||||||
|
if( this.isOutput() || !this.isActive() )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for( PartP2PFEPower t : this.getOutputs() )
|
||||||
|
{
|
||||||
|
total += t.getOutput().getEnergyStored();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( GridAccessException e )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxEnergyStored()
|
||||||
|
{
|
||||||
|
if( this.isOutput() || !this.isActive() )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for( PartP2PFEPower t : this.getOutputs() )
|
||||||
|
{
|
||||||
|
total += t.getOutput().getMaxEnergyStored();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( GridAccessException e )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtract()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canReceive()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCapability( @Nonnull Capability<?> capability )
|
||||||
|
{
|
||||||
|
if( capability == CapabilityEnergy.ENERGY )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.hasCapability( capability );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public <T> T getCapability( @Nonnull Capability<T> capability )
|
||||||
|
{
|
||||||
|
if( capability == CapabilityEnergy.ENERGY )
|
||||||
|
{
|
||||||
|
return (T) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getCapability( capability );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,263 +1,263 @@
|
|||||||
///*
|
/*
|
||||||
// * This file is part of Applied Energistics 2.
|
* This file is part of Applied Energistics 2.
|
||||||
// * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
// * (at your option) any later version.
|
* (at your option) any later version.
|
||||||
// *
|
*
|
||||||
// * Applied Energistics 2 is distributed in the hope that it will be useful,
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// * GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
// *
|
*
|
||||||
// * You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
// * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
// */
|
*/
|
||||||
//
|
|
||||||
//package appeng.parts.p2p;
|
package appeng.parts.p2p;
|
||||||
//
|
|
||||||
//
|
|
||||||
//import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
//import java.util.List;
|
import java.util.List;
|
||||||
//
|
|
||||||
//import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
//import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
//import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
//
|
|
||||||
//import ic2.api.energy.tile.IEnergyAcceptor;
|
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||||
//import ic2.api.energy.tile.IEnergyEmitter;
|
import ic2.api.energy.tile.IEnergyEmitter;
|
||||||
//import ic2.api.energy.tile.IEnergySink;
|
import ic2.api.energy.tile.IEnergySink;
|
||||||
//
|
import ic2.api.energy.tile.IEnergySource;
|
||||||
//import appeng.api.config.PowerUnits;
|
|
||||||
//import appeng.api.networking.energy.IEnergySource;
|
import appeng.api.config.PowerUnits;
|
||||||
//import appeng.api.parts.IPartModel;
|
import appeng.api.parts.IPartModel;
|
||||||
//import appeng.coremod.annotations.Integration.Interface;
|
import appeng.coremod.annotations.Integration.Interface;
|
||||||
//import appeng.coremod.annotations.Integration.InterfaceList;
|
import appeng.coremod.annotations.Integration.InterfaceList;
|
||||||
//import appeng.integration.IntegrationType;
|
import appeng.integration.IntegrationType;
|
||||||
//import appeng.items.parts.PartModels;
|
import appeng.items.parts.PartModels;
|
||||||
//import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
//import appeng.me.cache.helpers.TunnelCollection;
|
import appeng.me.cache.helpers.TunnelCollection;
|
||||||
//import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
//
|
|
||||||
//
|
|
||||||
//@InterfaceList( value = {
|
@InterfaceList( value = {
|
||||||
// @Interface( iface = "ic2.api.energy.tile.IEnergySink", iname = IntegrationType.IC2 ),
|
@Interface( iface = "ic2.api.energy.tile.IEnergySink", iname = IntegrationType.IC2 ),
|
||||||
// @Interface( iface = "ic2.api.energy.tile.IEnergySource", iname = IntegrationType.IC2 )
|
@Interface( iface = "ic2.api.energy.tile.IEnergySource", iname = IntegrationType.IC2 )
|
||||||
//} )
|
} )
|
||||||
//public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements IEnergySink, IEnergySource
|
public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements IEnergySink, IEnergySource
|
||||||
//{
|
{
|
||||||
//
|
|
||||||
// private static final String TAG_BUFFERED_ENERGY_1 = "bufferedEnergy1";
|
private static final String TAG_BUFFERED_ENERGY_1 = "bufferedEnergy1";
|
||||||
// private static final String TAG_BUFFERED_ENERGY_2 = "bufferedEnergy2";
|
private static final String TAG_BUFFERED_ENERGY_2 = "bufferedEnergy2";
|
||||||
// private static final String TAG_BUFFERED_VOLTAGE_1 = "outputPacket1";
|
private static final String TAG_BUFFERED_VOLTAGE_1 = "outputPacket1";
|
||||||
// private static final String TAG_BUFFERED_VOLTAGE_2 = "outputPacket2";
|
private static final String TAG_BUFFERED_VOLTAGE_2 = "outputPacket2";
|
||||||
//
|
|
||||||
// private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_ic2" );
|
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_ic2" );
|
||||||
//
|
|
||||||
// @PartModels
|
@PartModels
|
||||||
// public static List<IPartModel> getModels()
|
public static List<IPartModel> getModels()
|
||||||
// {
|
{
|
||||||
// return MODELS.getModels();
|
return MODELS.getModels();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // Buffer the energy + voltage for two IC2 ENET packets
|
// Buffer the energy + voltage for two IC2 ENET packets
|
||||||
// private double bufferedEnergy1;
|
private double bufferedEnergy1;
|
||||||
// private double bufferedVoltage1;
|
private double bufferedVoltage1;
|
||||||
// private double bufferedEnergy2;
|
private double bufferedEnergy2;
|
||||||
// private double bufferedVoltage2;
|
private double bufferedVoltage2;
|
||||||
//
|
|
||||||
// public PartP2PIC2Power( ItemStack is )
|
public PartP2PIC2Power( ItemStack is )
|
||||||
// {
|
{
|
||||||
// super( is );
|
super( is );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void readFromNBT( NBTTagCompound tag )
|
public void readFromNBT( NBTTagCompound tag )
|
||||||
// {
|
{
|
||||||
// super.readFromNBT( tag );
|
super.readFromNBT( tag );
|
||||||
// this.bufferedEnergy1 = tag.getDouble( TAG_BUFFERED_ENERGY_1 );
|
this.bufferedEnergy1 = tag.getDouble( TAG_BUFFERED_ENERGY_1 );
|
||||||
// this.bufferedEnergy2 = tag.getDouble( TAG_BUFFERED_ENERGY_2 );
|
this.bufferedEnergy2 = tag.getDouble( TAG_BUFFERED_ENERGY_2 );
|
||||||
// this.bufferedVoltage1 = tag.getDouble( TAG_BUFFERED_VOLTAGE_1 );
|
this.bufferedVoltage1 = tag.getDouble( TAG_BUFFERED_VOLTAGE_1 );
|
||||||
// this.bufferedVoltage2 = tag.getDouble( TAG_BUFFERED_VOLTAGE_2 );
|
this.bufferedVoltage2 = tag.getDouble( TAG_BUFFERED_VOLTAGE_2 );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void writeToNBT( NBTTagCompound tag )
|
public void writeToNBT( NBTTagCompound tag )
|
||||||
// {
|
{
|
||||||
// super.writeToNBT( tag );
|
super.writeToNBT( tag );
|
||||||
// tag.setDouble( TAG_BUFFERED_ENERGY_1, this.bufferedEnergy1 );
|
tag.setDouble( TAG_BUFFERED_ENERGY_1, this.bufferedEnergy1 );
|
||||||
// tag.setDouble( TAG_BUFFERED_ENERGY_2, this.bufferedEnergy2 );
|
tag.setDouble( TAG_BUFFERED_ENERGY_2, this.bufferedEnergy2 );
|
||||||
// tag.setDouble( TAG_BUFFERED_VOLTAGE_1, this.bufferedVoltage1 );
|
tag.setDouble( TAG_BUFFERED_VOLTAGE_1, this.bufferedVoltage1 );
|
||||||
// tag.setDouble( TAG_BUFFERED_VOLTAGE_2, this.bufferedVoltage2 );
|
tag.setDouble( TAG_BUFFERED_VOLTAGE_2, this.bufferedVoltage2 );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onTunnelConfigChange()
|
public void onTunnelConfigChange()
|
||||||
// {
|
{
|
||||||
// this.getHost().partChanged();
|
this.getHost().partChanged();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onTunnelNetworkChange()
|
public void onTunnelNetworkChange()
|
||||||
// {
|
{
|
||||||
// this.getHost().notifyNeighbors();
|
this.getHost().notifyNeighbors();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction )
|
public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction )
|
||||||
// {
|
{
|
||||||
// return !this.isOutput() && direction == this.getSide().getFacing();
|
return !this.isOutput() && direction == this.getSide().getFacing();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction )
|
public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction )
|
||||||
// {
|
{
|
||||||
// return this.isOutput() && direction == this.getSide().getFacing();
|
return this.isOutput() && direction == this.getSide().getFacing();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double getDemandedEnergy()
|
public double getDemandedEnergy()
|
||||||
// {
|
{
|
||||||
// if( this.isOutput() )
|
if( this.isOutput() )
|
||||||
// {
|
{
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// for( PartP2PIC2Power t : this.getOutputs() )
|
for( PartP2PIC2Power t : this.getOutputs() )
|
||||||
// {
|
{
|
||||||
// if( t.bufferedEnergy1 <= 0.0001 || t.bufferedEnergy2 <= 0.0001 )
|
if( t.bufferedEnergy1 <= 0.0001 || t.bufferedEnergy2 <= 0.0001 )
|
||||||
// {
|
{
|
||||||
// return 2048;
|
return 2048;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// catch( GridAccessException e )
|
catch( GridAccessException e )
|
||||||
// {
|
{
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public int getSinkTier()
|
public int getSinkTier()
|
||||||
// {
|
{
|
||||||
// return 4;
|
return 4;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
||||||
// {
|
{
|
||||||
// TunnelCollection<PartP2PIC2Power> outs;
|
TunnelCollection<PartP2PIC2Power> outs;
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// outs = this.getOutputs();
|
outs = this.getOutputs();
|
||||||
// }
|
}
|
||||||
// catch( GridAccessException e )
|
catch( GridAccessException e )
|
||||||
// {
|
{
|
||||||
// return amount;
|
return amount;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if( outs.isEmpty() )
|
if( outs.isEmpty() )
|
||||||
// {
|
{
|
||||||
// return amount;
|
return amount;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// LinkedList<PartP2PIC2Power> options = new LinkedList<>();
|
LinkedList<PartP2PIC2Power> options = new LinkedList<>();
|
||||||
// for( PartP2PIC2Power o : outs )
|
for( PartP2PIC2Power o : outs )
|
||||||
// {
|
{
|
||||||
// if( o.bufferedEnergy1 <= 0.01 )
|
if( o.bufferedEnergy1 <= 0.01 )
|
||||||
// {
|
{
|
||||||
// options.add( o );
|
options.add( o );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if( options.isEmpty() )
|
if( options.isEmpty() )
|
||||||
// {
|
{
|
||||||
// for( PartP2PIC2Power o : outs )
|
for( PartP2PIC2Power o : outs )
|
||||||
// {
|
{
|
||||||
// if( o.bufferedEnergy2 <= 0.01 )
|
if( o.bufferedEnergy2 <= 0.01 )
|
||||||
// {
|
{
|
||||||
// options.add( o );
|
options.add( o );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if( options.isEmpty() )
|
if( options.isEmpty() )
|
||||||
// {
|
{
|
||||||
// for( PartP2PIC2Power o : outs )
|
for( PartP2PIC2Power o : outs )
|
||||||
// {
|
{
|
||||||
// options.add( o );
|
options.add( o );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if( options.isEmpty() )
|
if( options.isEmpty() )
|
||||||
// {
|
{
|
||||||
// return amount;
|
return amount;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// PartP2PIC2Power x = Platform.pickRandom( options );
|
PartP2PIC2Power x = Platform.pickRandom( options );
|
||||||
//
|
|
||||||
// if( x != null && x.bufferedEnergy1 <= 0.001 )
|
if( x != null && x.bufferedEnergy1 <= 0.001 )
|
||||||
// {
|
{
|
||||||
// this.queueTunnelDrain( PowerUnits.EU, amount );
|
this.queueTunnelDrain( PowerUnits.EU, amount );
|
||||||
// x.bufferedEnergy1 = amount;
|
x.bufferedEnergy1 = amount;
|
||||||
// x.bufferedVoltage1 = voltage;
|
x.bufferedVoltage1 = voltage;
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if( x != null && x.bufferedEnergy2 <= 0.001 )
|
if( x != null && x.bufferedEnergy2 <= 0.001 )
|
||||||
// {
|
{
|
||||||
// this.queueTunnelDrain( PowerUnits.EU, amount );
|
this.queueTunnelDrain( PowerUnits.EU, amount );
|
||||||
// x.bufferedEnergy2 = amount;
|
x.bufferedEnergy2 = amount;
|
||||||
// x.bufferedVoltage2 = voltage;
|
x.bufferedVoltage2 = voltage;
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return amount;
|
return amount;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double getOfferedEnergy()
|
public double getOfferedEnergy()
|
||||||
// {
|
{
|
||||||
// if( this.isOutput() )
|
if( this.isOutput() )
|
||||||
// {
|
{
|
||||||
// return this.bufferedEnergy1;
|
return this.bufferedEnergy1;
|
||||||
// }
|
}
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void drawEnergy( double amount )
|
public void drawEnergy( double amount )
|
||||||
// {
|
{
|
||||||
// this.bufferedEnergy1 -= amount;
|
this.bufferedEnergy1 -= amount;
|
||||||
// if( this.bufferedEnergy1 < 0.001 )
|
if( this.bufferedEnergy1 < 0.001 )
|
||||||
// {
|
{
|
||||||
// this.bufferedEnergy1 = this.bufferedEnergy2;
|
this.bufferedEnergy1 = this.bufferedEnergy2;
|
||||||
// this.bufferedEnergy2 = 0;
|
this.bufferedEnergy2 = 0;
|
||||||
//
|
|
||||||
// this.bufferedVoltage1 = this.bufferedVoltage2;
|
this.bufferedVoltage1 = this.bufferedVoltage2;
|
||||||
// this.bufferedVoltage2 = 0;
|
this.bufferedVoltage2 = 0;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public int getSourceTier()
|
public int getSourceTier()
|
||||||
// {
|
{
|
||||||
// // Sadly IC2 doesn't support changing the tier once we're registered, so we
|
// Sadly IC2 doesn't support changing the tier once we're registered, so we
|
||||||
// // go with the highest here... At this point it's somewhat unclear as to what effect
|
// go with the highest here... At this point it's somewhat unclear as to what effect
|
||||||
// // this realistically has.
|
// this realistically has.
|
||||||
// return 4;
|
return 4;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public IPartModel getStaticModels()
|
public IPartModel getStaticModels()
|
||||||
// {
|
{
|
||||||
// return MODELS.getModel( isPowered(), isActive() );
|
return MODELS.getModel( isPowered(), isActive() );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
@@ -18,260 +18,197 @@
|
|||||||
|
|
||||||
package appeng.parts.p2p;
|
package appeng.parts.p2p;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
//import java.util.Stack;
|
import appeng.api.parts.IPartModel;
|
||||||
//
|
import appeng.items.parts.PartModels;
|
||||||
//import net.minecraft.init.Blocks;
|
import cofh.redstoneflux.api.IEnergyReceiver;
|
||||||
//import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
//import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
//import net.minecraft.util.IIcon;
|
|
||||||
//import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
//
|
import appeng.api.config.PowerUnits;
|
||||||
//import cpw.mods.fml.relauncher.Side;
|
import appeng.integration.IntegrationType;
|
||||||
//import cpw.mods.fml.relauncher.SideOnly;
|
import appeng.me.GridAccessException;
|
||||||
//
|
import appeng.coremod.annotations.Integration.Interface;
|
||||||
//import cofh.api.energy.IEnergyReceiver;
|
import appeng.coremod.annotations.Integration.InterfaceList;
|
||||||
//
|
import appeng.util.Platform;
|
||||||
//import appeng.api.config.PowerUnits;
|
import net.minecraft.util.EnumFacing;
|
||||||
//import appeng.integration.IntegrationType;
|
import net.minecraft.util.math.BlockPos;
|
||||||
//import appeng.integration.modules.helpers.NullRFHandler;
|
|
||||||
//import appeng.me.GridAccessException;
|
|
||||||
//import appeng.coremod.annotations.Integration.Interface;
|
@InterfaceList( value = { @Interface( iface = "cofh.redstoneflux.api.IEnergyReceiver", iname = IntegrationType.RF ) } )
|
||||||
//import appeng.coremod.annotations.Integration.InterfaceList;
|
public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEnergyReceiver
|
||||||
//import appeng.util.Platform;
|
{
|
||||||
//
|
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_rf" );
|
||||||
//
|
|
||||||
//@InterfaceList( value = { @Interface( iface = "cofh.api.energy.IEnergyReceiver", iname = IntegrationType.RF ) } )
|
private boolean cachedTarget = false;
|
||||||
//public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEnergyReceiver
|
|
||||||
//{
|
private IEnergyReceiver outputTarget;
|
||||||
// private static final ThreadLocal<Stack<PartP2PRFPower>> THREAD_STACK = new ThreadLocal<Stack<PartP2PRFPower>>();
|
|
||||||
// /**
|
public PartP2PRFPower( ItemStack is )
|
||||||
// * Default element based on the null element pattern
|
{
|
||||||
// */
|
super( is );
|
||||||
// private static final IEnergyReceiver NULL_HANDLER = new NullRFHandler();
|
}
|
||||||
// private boolean cachedTarget = false;
|
|
||||||
// private IEnergyReceiver outputTarget;
|
@PartModels
|
||||||
//
|
public static List<IPartModel> getModels()
|
||||||
// public PartP2PRFPower( ItemStack is )
|
{
|
||||||
// {
|
return MODELS.getModels();
|
||||||
// super( is );
|
}
|
||||||
// }
|
|
||||||
//
|
@Override
|
||||||
// @Override
|
public IPartModel getStaticModels()
|
||||||
// @SideOnly( Side.CLIENT )
|
{
|
||||||
// public IIcon getTypeTexture()
|
return MODELS.getModel( isPowered(), isActive() );
|
||||||
// {
|
}
|
||||||
// return Blocks.iron_block.getBlockTextureFromSide( 0 );
|
|
||||||
// }
|
@Override
|
||||||
//
|
public void onTunnelNetworkChange()
|
||||||
// @Override
|
{
|
||||||
// public void onTunnelNetworkChange()
|
this.getHost().notifyNeighbors();
|
||||||
// {
|
}
|
||||||
// this.getHost().notifyNeighbors();
|
|
||||||
// }
|
@Override
|
||||||
//
|
public void onNeighborChanged()
|
||||||
// @Override
|
{
|
||||||
// public void onNeighborChanged()
|
super.onNeighborChanged();
|
||||||
// {
|
|
||||||
// super.onNeighborChanged();
|
this.cachedTarget = false;
|
||||||
//
|
}
|
||||||
// this.cachedTarget = false;
|
|
||||||
// }
|
@Override
|
||||||
//
|
public int receiveEnergy( EnumFacing from, int maxReceive, boolean simulate )
|
||||||
// @Override
|
{
|
||||||
// public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate )
|
if( this.isOutput() )
|
||||||
// {
|
{
|
||||||
// if( this.output )
|
return 0;
|
||||||
// {
|
}
|
||||||
// return 0;
|
|
||||||
// }
|
if( this.isActive() )
|
||||||
//
|
{
|
||||||
// if( this.isActive() )
|
int total = 0;
|
||||||
// {
|
|
||||||
// Stack<PartP2PRFPower> stack = this.getDepth();
|
try
|
||||||
//
|
{
|
||||||
// for( PartP2PRFPower t : stack )
|
for( PartP2PRFPower t : this.getOutputs() )
|
||||||
// {
|
{
|
||||||
// if( t == this )
|
if( Platform.getRandomInt() % 2 > 0 )
|
||||||
// {
|
{
|
||||||
// return 0;
|
int receiver = t.getOutput().receiveEnergy( t.getSide().getFacing().getOpposite(), maxReceive, simulate );
|
||||||
// }
|
maxReceive -= receiver;
|
||||||
// }
|
total += receiver;
|
||||||
//
|
|
||||||
// stack.push( this );
|
if( maxReceive <= 0 )
|
||||||
//
|
{
|
||||||
// int total = 0;
|
break;
|
||||||
//
|
}
|
||||||
// try
|
}
|
||||||
// {
|
}
|
||||||
// for( PartP2PRFPower t : this.getOutputs() )
|
|
||||||
// {
|
if( maxReceive > 0 )
|
||||||
// if( Platform.getRandomInt() % 2 > 0 )
|
{
|
||||||
// {
|
for( PartP2PRFPower t : this.getOutputs() )
|
||||||
// int receiver = t.getOutput().receiveEnergy( t.side.getOpposite(), maxReceive, simulate );
|
{
|
||||||
// maxReceive -= receiver;
|
int receiver = t.getOutput().receiveEnergy( t.getSide().getFacing().getOpposite(), maxReceive, simulate );
|
||||||
// total += receiver;
|
maxReceive -= receiver;
|
||||||
//
|
total += receiver;
|
||||||
// if( maxReceive <= 0 )
|
|
||||||
// {
|
if( maxReceive <= 0 )
|
||||||
// break;
|
{
|
||||||
// }
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
}
|
||||||
// if( maxReceive > 0 )
|
|
||||||
// {
|
this.queueTunnelDrain( PowerUnits.RF, total );
|
||||||
// for( PartP2PRFPower t : this.getOutputs() )
|
}
|
||||||
// {
|
catch( GridAccessException ignored )
|
||||||
// int receiver = t.getOutput().receiveEnergy( t.side.getOpposite(), maxReceive, simulate );
|
{
|
||||||
// maxReceive -= receiver;
|
}
|
||||||
// total += receiver;
|
|
||||||
//
|
return total;
|
||||||
// if( maxReceive <= 0 )
|
}
|
||||||
// {
|
|
||||||
// break;
|
return 0;
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
// }
|
private IEnergyReceiver getOutput()
|
||||||
//
|
{
|
||||||
// this.queueTunnelDrain( PowerUnits.RF, total );
|
if( this.isOutput() )
|
||||||
// }
|
{
|
||||||
// catch( GridAccessException ignored )
|
if( !this.cachedTarget )
|
||||||
// {
|
{
|
||||||
// }
|
TileEntity self = this.getTile();
|
||||||
//
|
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 ) );
|
||||||
// if( stack.pop() != this )
|
this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null;
|
||||||
// {
|
this.cachedTarget = true;
|
||||||
// throw new IllegalStateException( "Invalid Recursion detected." );
|
}
|
||||||
// }
|
|
||||||
//
|
if( this.outputTarget == null || !this.outputTarget.canConnectEnergy( this.getSide().getOpposite().getFacing() ) )
|
||||||
// return total;
|
{
|
||||||
// }
|
return null;
|
||||||
//
|
}
|
||||||
// return 0;
|
|
||||||
// }
|
return this.outputTarget;
|
||||||
//
|
}
|
||||||
// private Stack<PartP2PRFPower> getDepth()
|
return null;
|
||||||
// {
|
}
|
||||||
// Stack<PartP2PRFPower> s = THREAD_STACK.get();
|
|
||||||
//
|
@Override
|
||||||
// if( s == null )
|
public int getEnergyStored( EnumFacing from )
|
||||||
// {
|
{
|
||||||
// THREAD_STACK.set( s = new Stack<PartP2PRFPower>() );
|
if( this.isOutput() || !this.isActive() )
|
||||||
// }
|
{
|
||||||
//
|
return 0;
|
||||||
// return s;
|
}
|
||||||
// }
|
|
||||||
//
|
int total = 0;
|
||||||
// private IEnergyReceiver getOutput()
|
|
||||||
// {
|
try
|
||||||
// if( this.output )
|
{
|
||||||
// {
|
for( PartP2PRFPower t : this.getOutputs() )
|
||||||
// if( !this.cachedTarget )
|
{
|
||||||
// {
|
total += t.getOutput().getEnergyStored( this.getSide().getOpposite().getFacing() );
|
||||||
// TileEntity self = this.getTile();
|
}
|
||||||
// TileEntity te = self.getworld().getTileEntity( self.x + this.side.offsetX, self.y + this.side.offsetY, self.z + this.side.offsetZ );
|
}
|
||||||
// this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null;
|
catch( GridAccessException e )
|
||||||
// this.cachedTarget = true;
|
{
|
||||||
// }
|
return 0;
|
||||||
//
|
}
|
||||||
// if( this.outputTarget == null || !this.outputTarget.canConnectEnergy( this.side.getOpposite() ) )
|
|
||||||
// {
|
return total;
|
||||||
// return NULL_HANDLER;
|
}
|
||||||
// }
|
|
||||||
//
|
@Override
|
||||||
// return this.outputTarget;
|
public int getMaxEnergyStored( EnumFacing from )
|
||||||
// }
|
{
|
||||||
// return NULL_HANDLER;
|
if( this.isOutput() || !this.isActive() )
|
||||||
// }
|
{
|
||||||
//
|
return 0;
|
||||||
// @Override
|
}
|
||||||
// public int getEnergyStored( ForgeDirection from )
|
|
||||||
// {
|
int total = 0;
|
||||||
// if( this.output || !this.isActive() )
|
|
||||||
// {
|
try
|
||||||
// return 0;
|
{
|
||||||
// }
|
for( PartP2PRFPower t : this.getOutputs() )
|
||||||
//
|
{
|
||||||
// int total = 0;
|
total += t.getOutput().getMaxEnergyStored( this.getSide().getOpposite().getFacing() );
|
||||||
//
|
}
|
||||||
// Stack<PartP2PRFPower> stack = this.getDepth();
|
}
|
||||||
//
|
catch( GridAccessException e )
|
||||||
// for( PartP2PRFPower t : stack )
|
{
|
||||||
// {
|
return 0;
|
||||||
// if( t == this )
|
}
|
||||||
// {
|
|
||||||
// return 0;
|
return total;
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
//
|
@Override
|
||||||
// stack.push( this );
|
public boolean canConnectEnergy( EnumFacing from )
|
||||||
//
|
{
|
||||||
// try
|
return true;
|
||||||
// {
|
}
|
||||||
// for( PartP2PRFPower t : this.getOutputs() )
|
}
|
||||||
// {
|
|
||||||
// total += t.getOutput().getEnergyStored( t.side.getOpposite() );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch( GridAccessException e )
|
|
||||||
// {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if( stack.pop() != this )
|
|
||||||
// {
|
|
||||||
// throw new IllegalStateException( "Invalid Recursion detected." );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return total;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public int getMaxEnergyStored( ForgeDirection from )
|
|
||||||
// {
|
|
||||||
// if( this.output || !this.isActive() )
|
|
||||||
// {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// int total = 0;
|
|
||||||
//
|
|
||||||
// Stack<PartP2PRFPower> stack = this.getDepth();
|
|
||||||
//
|
|
||||||
// for( PartP2PRFPower t : stack )
|
|
||||||
// {
|
|
||||||
// if( t == this )
|
|
||||||
// {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// stack.push( this );
|
|
||||||
//
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// for( PartP2PRFPower t : this.getOutputs() )
|
|
||||||
// {
|
|
||||||
// total += t.getOutput().getMaxEnergyStored( t.side.getOpposite() );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch( GridAccessException e )
|
|
||||||
// {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if( stack.pop() != this )
|
|
||||||
// {
|
|
||||||
// throw new IllegalStateException( "Invalid Recursion detected." );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return total;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean canConnectEnergy( ForgeDirection from )
|
|
||||||
// {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -222,22 +222,17 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
|||||||
newType = parts.p2PTunnelLight().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
newType = parts.p2PTunnelLight().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
case RF_POWER:
|
||||||
* case RF_POWER:
|
newType = parts.p2PTunnelRF().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||||
* for( ItemStack stack : parts.p2PTunnelRF().maybeStack( 1 ).asSet() )
|
break;
|
||||||
* {
|
|
||||||
* newType = stack;
|
|
||||||
* }
|
|
||||||
* break;
|
|
||||||
*/
|
|
||||||
|
|
||||||
case FLUID:
|
case FLUID:
|
||||||
newType = parts.p2PTunnelFluids().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
newType = parts.p2PTunnelFluids().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//case IC2_POWER:
|
case IC2_POWER:
|
||||||
// newType = parts.p2PTunnelEU().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
newType = parts.p2PTunnelEU().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||||
// break;
|
break;
|
||||||
|
|
||||||
case ITEM:
|
case ITEM:
|
||||||
newType = parts.p2PTunnelItems().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
newType = parts.p2PTunnelItems().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "appliedenergistics2:item/part/p2p_tunnel",
|
||||||
|
"textures": {
|
||||||
|
"type": "minecraft:blocks/gold_block"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "appliedenergistics2:item/part/p2p_tunnel",
|
||||||
|
"textures": {
|
||||||
|
"type": "minecraft:blocks/iron_block"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "appliedenergistics2:part/p2p/p2p_tunnel_base",
|
||||||
|
"textures": {
|
||||||
|
"type": "minecraft:blocks/gold_block"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "appliedenergistics2:part/p2p/p2p_tunnel_base",
|
||||||
|
"textures": {
|
||||||
|
"type": "minecraft:blocks/iron_block"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user