Re-enabled the RF and IC2 handler, as well as their P2P tunnels. Added Forge Energy P2P tunnel.

This commit is contained in:
Gunther De Wachter
2017-07-14 21:52:04 +02:00
parent fdab91323c
commit 66c87a2fa2
26 changed files with 1776 additions and 1241 deletions
@@ -19,11 +19,7 @@
package appeng.integration;
import appeng.integration.abstraction.IIC2;
import appeng.integration.abstraction.IInvTweaks;
import appeng.integration.abstraction.IJEI;
import appeng.integration.abstraction.IMekanism;
import appeng.integration.abstraction.IRC;
import appeng.integration.abstraction.*;
/**
@@ -42,6 +38,8 @@ public final class Integrations
static IInvTweaks invTweaks = new IInvTweaks.Stub();
static IRF redstoneflux = new IRF.Stub();
private Integrations()
{
}
@@ -101,4 +99,10 @@ public final class Integrations
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.
// * 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 net.minecraft.item.ItemStack;
//import net.minecraft.tileentity.TileEntity;
//
//import ic2.api.recipe.RecipeInputItemStack;
//
//import appeng.api.AEApi;
//import appeng.api.config.TunnelType;
//import appeng.api.features.IP2PTunnelRegistry;
//import appeng.integration.IntegrationHelper;
//import appeng.integration.abstraction.IC2PowerSink;
//import appeng.integration.abstraction.IIC2;
//import appeng.tile.powersink.IExternalPowerSink;
//
//
//public class IC2Module implements IIC2
//{
//
// private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" };
//
// public IC2Module()
// {
// IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.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()
// {
// final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
//
// 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 getCable( final String type )
// {
// return this.getItem( "cable", "type:" + type );
// }
//
// /**
// * Create an IC2 power sink for the given external sink.
// */
// @Override
// public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
// {
// return new IC2PowerSinkAdapter( tileEntity, externalSink );
// }
//
// @Override
// public void maceratorRecipe( ItemStack in, ItemStack out )
// {
// ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out );
// }
//}
/*
* 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 net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IC2PowerSink;
import appeng.integration.abstraction.IIC2;
import appeng.tile.powersink.IExternalPowerSink;
public class IC2Module implements IIC2
{
private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" };
public IC2Module()
{
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class );
IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class );
IntegrationHelper.testClassExistence( this, ic2.api.recipe.IRecipeInput.class );
}
@Override
public void postInit()
{
final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
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 getCable( final String type )
{
return this.getItem( "cable", "type:" + type );
}
/**
* Create an IC2 power sink for the given external sink.
*/
@Override
public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
{
return new IC2PowerSinkAdapter( tileEntity, externalSink );
}
@Override
public void maceratorRecipe( ItemStack in, ItemStack out )
{
ic2.api.recipe.Recipes.macerator.addRecipe( new IC2RecipeInput( in, in.getCount() ), null, false, out );
}
}
@@ -1,94 +1,94 @@
///*
// * 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 java.util.EnumSet;
//import java.util.Set;
//
//import net.minecraft.tileentity.TileEntity;
//import net.minecraft.util.EnumFacing;
//
//import ic2.api.energy.prefab.BasicSink;
//import ic2.api.energy.tile.IEnergyEmitter;
//
//import appeng.api.config.PowerUnits;
//import appeng.integration.abstraction.IC2PowerSink;
//import appeng.tile.powersink.IExternalPowerSink;
//
//
///**
// * The real implementation of IC2PowerSink.
// */
//public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink
//{
//
// private final IExternalPowerSink powerSink;
//
// private final Set<EnumFacing> validFaces = EnumSet.allOf( EnumFacing.class );
//
// public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink )
// {
// super( tileEntity, 0, Integer.MAX_VALUE );
// this.powerSink = powerSink;
// }
//
// @Override
// public void invalidate()
// {
// super.onChunkUnload();
// }
//
// @Override
// public void onChunkUnload()
// {
// super.onChunkUnload();
// }
//
// @Override
// public void onLoad()
// {
// super.onLoaded();
// }
//
// @Override
// public double getDemandedEnergy()
// {
// return powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
// }
//
// @Override
// public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
// {
// return PowerUnits.EU.convertTo( PowerUnits.AE, powerSink.injectExternalPower( PowerUnits.EU, amount ) );
// }
//
// @Override
// public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side )
// {
// return validFaces.contains( side );
// }
//
// @Override
// public void setValidFaces( Set<EnumFacing> faces )
// {
// this.validFaces.clear();
// this.validFaces.addAll( faces );
// }
//}
/*
* 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 java.util.EnumSet;
import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import ic2.api.energy.prefab.BasicSink;
import ic2.api.energy.tile.IEnergyEmitter;
import appeng.api.config.PowerUnits;
import appeng.integration.abstraction.IC2PowerSink;
import appeng.tile.powersink.IExternalPowerSink;
/**
* The real implementation of IC2PowerSink.
*/
public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink
{
private final IExternalPowerSink powerSink;
private final Set<EnumFacing> validFaces = EnumSet.allOf( EnumFacing.class );
public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink )
{
super( tileEntity, 0, Integer.MAX_VALUE );
this.powerSink = powerSink;
}
@Override
public void invalidate()
{
super.onChunkUnload();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
}
@Override
public void onLoad()
{
super.onLoad();
}
@Override
public double getDemandedEnergy()
{
return powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
}
@Override
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
{
return PowerUnits.EU.convertTo( PowerUnits.AE, powerSink.injectExternalPower( PowerUnits.EU, amount ) );
}
@Override
public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side )
{
return validFaces.contains( side );
}
@Override
public void setValidFaces( Set<EnumFacing> faces )
{
this.validFaces.clear();
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 );
}
}