Compare commits

...

4 commits

11 changed files with 463 additions and 17 deletions

View file

@ -34,6 +34,7 @@ code_chicken_lib_version=1.1.3.140
code_chicken_core_version=1.0.7.47 code_chicken_core_version=1.0.7.47
nei_version=1.0.5.120 nei_version=1.0.5.120
bc_version=7.0.9 bc_version=7.0.9
logisticspipes_build=128
opencomputers_version=1.5.12.26 opencomputers_version=1.5.12.26
pneumaticcraft_version=1.9.15-105 pneumaticcraft_version=1.9.15-105
@ -41,7 +42,7 @@ pneumaticcraft_version=1.9.15-105
# Self Compiled APIs # # Self Compiled APIs #
######################################################### #########################################################
mekansim_version=8.0.1.198 mekansim_version=8.0.1.198
rotarycraft_version=V6e rotarycraft_version=V6f
######################################################### #########################################################

View file

@ -32,11 +32,6 @@ repositories {
url "http://mobiusstrip.eu/maven" url "http://mobiusstrip.eu/maven"
} }
maven {
name "FireBall API Depot"
url "http://dl.tsr.me/artifactory/libs-release-local"
}
maven { maven {
name = "Player" name = "Player"
url = "http://maven.ic2.player.to/" url = "http://maven.ic2.player.to/"
@ -47,11 +42,6 @@ repositories {
url = "http://maven.tterrag.com/" url = "http://maven.tterrag.com/"
} }
maven {
name = "RX14 Proxy"
url = "http://mvn.rx14.co.uk/repo/"
}
maven { maven {
name "OpenComputers Repo" name "OpenComputers Repo"
url = "http://maven.cil.li/" url = "http://maven.cil.li/"
@ -62,11 +52,23 @@ repositories {
url = "http://maven.k-4u.nl/" url = "http://maven.k-4u.nl/"
} }
maven {
name = "tilera"
url = "https://data.tilera.xyz/maven/"
}
ivy { ivy {
name "BuildCraft" name "BuildCraft"
artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]" artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]"
} }
ivy {
url "https://ci.rs485.network/job/LogisticsPipes-0.9-mc17-bc7"
layout "pattern", {
artifact "[revision]/artifact/build/libs/[artifact]-0.9.3.[revision](-[classifier]).[ext]"
}
}
// CurseForge DNS for TE is not available or I am just being unlucky, code part can stay since this is applicable to any other curseforge mod though // CurseForge DNS for TE is not available or I am just being unlucky, code part can stay since this is applicable to any other curseforge mod though
// ivy { // ivy {
// name = "CoFHLib" // name = "CoFHLib"
@ -104,6 +106,7 @@ dependencies {
// mods "net.mcft.copy.betterstorage:BetterStorage:${minecraft_version}-${betterstorage_version}:deobf" // mods "net.mcft.copy.betterstorage:BetterStorage:${minecraft_version}-${betterstorage_version}:deobf"
mods "inventorytweaks:InventoryTweaks:${invtweaks_version}:deobf" mods "inventorytweaks:InventoryTweaks:${invtweaks_version}:deobf"
mods "li.cil.oc:OpenComputers:MC${minecraft_version}-${opencomputers_version}:dev" mods "li.cil.oc:OpenComputers:MC${minecraft_version}-${opencomputers_version}:dev"
compile "logisticspipes:logisticspipes:${logisticspipes_build}:dev"
// mods name: 'CoFHLib', version: "[${minecraft_version}]${cofhlib_version}-dev", ext: 'jar' // mods name: 'CoFHLib', version: "[${minecraft_version}]${cofhlib_version}-dev", ext: 'jar'
// mods name: 'CoFHCore', version: "[${minecraft_version}]${cofhcore_version}-dev", ext: 'jar' // mods name: 'CoFHCore', version: "[${minecraft_version}]${cofhcore_version}-dev", ext: 'jar'

View file

@ -39,5 +39,10 @@ public enum ControllerState
/** /**
* Controller rules not followed, lock up while booting. * Controller rules not followed, lock up while booting.
*/ */
CONTROLLER_CONFLICT CONTROLLER_CONFLICT,
/**
* Controller is online and has infinite channels
*/
CONTROLLER_INFINITE
} }

View file

@ -99,7 +99,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
private double WirelessBaseRange = 16; private double WirelessBaseRange = 16;
private double WirelessBoosterRangeMultiplier = 1; private double WirelessBoosterRangeMultiplier = 1;
private double WirelessBoosterExp = 1.5; private double WirelessBoosterExp = 1.5;
public int ItemTypeLimit = 65536; public int ItemTypeLimit = 63;
public AEConfig( final File configFile ) public AEConfig( final File configFile )
{ {

View file

@ -33,6 +33,8 @@ public enum IntegrationType
BuildCraftBuilder( IntegrationSide.BOTH, "BuildCraft Builders", "BuildCraft|Builders" ), BuildCraftBuilder( IntegrationSide.BOTH, "BuildCraft Builders", "BuildCraft|Builders" ),
LogisticsPipes( IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes" ),
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ), RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ),
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" ), RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" ),

View file

@ -0,0 +1,59 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.abstraction;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Contains pipe logic to interact between storage buses and pipes
*
* @author Second_Fry
* @version rv3 01.01.2017
* @since rv3 01.01.2017
*/
public interface ILogisticsPipes
{
/**
* checks weather if the {@code te} is injectable and simulates to inject the item
*
* @param te instanceof ILPPipe
* @param is to be injected item
* @param dir direction of the pipe
* @return {@code true} if items were simulated successfully being added
*/
boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
/**
* checks weather if the {@code te} is injectable, simulates the inject and tries to inject the item
*
* @param te instanceof ILPPipe
* @param is to be injected item
* @param dir direction of the pipe
* @return {@code true} if items were added to the buildcraft pipe
*/
boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull ForgeDirection dir );
}

View file

@ -0,0 +1,60 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.LPHelpers;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.ILogisticsPipes;
import appeng.me.storage.MEMonitorIInventory;
import appeng.util.inv.IMEAdaptor;
import logisticspipes.api.ILPPipeTile;
import logisticspipes.pipes.basic.CoreUnroutedPipe;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class LPPipeHandler implements IExternalStorageHandler
{
@Override
public boolean canHandle( final TileEntity te, final ForgeDirection d, final StorageChannel channel, final BaseActionSource mySrc )
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.LogisticsPipes ) )
{
return channel == StorageChannel.ITEMS && te instanceof ILPPipeTile &&
( (CoreUnroutedPipe) ( (ILPPipeTile) te ).getLPPipe() ).canPipeConnect( te, d );
}
return false;
}
@Override
public IMEInventory getInventory( final TileEntity te, final ForgeDirection d, final StorageChannel channel, final BaseActionSource src )
{
if( channel == StorageChannel.ITEMS )
{
return new MEMonitorIInventory( new IMEAdaptor( new LPPipeInventory( te, d ), src ) );
}
return null;
}
}

View file

@ -0,0 +1,200 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.LPHelpers;
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.ILogisticsPipes;
import appeng.tile.grid.AENetworkInvTile;
import appeng.util.item.AEItemStack;
import logisticspipes.api.ILPPipe;
import logisticspipes.api.ILPPipeTile;
import logisticspipes.api.IRequestAPI;
import logisticspipes.pipes.basic.CoreRoutedPipe;
import logisticspipes.proxy.SimpleServiceLocator;
import logisticspipes.routing.ExitRoute;
import logisticspipes.utils.AdjacentTile;
import logisticspipes.utils.item.ItemIdentifier;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class LPPipeInventory implements IMEInventory<IAEItemStack>
{
private final TileEntity te;
private final ForgeDirection direction;
public LPPipeInventory( final TileEntity te, final ForgeDirection direction )
{
this.te = te;
this.direction = direction;
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.LogisticsPipes ) )
{
ILogisticsPipes registry = (ILogisticsPipes) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.LogisticsPipes );
if( type == Actionable.SIMULATE )
{
if( registry.canAddItemsToPipe( this.te, input.getItemStack(), this.direction ) )
{
return null;
}
return input;
}
if( registry.addItemsToPipe( this.te, input.getItemStack(), this.direction ) )
{
return null;
}
}
return input;
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable type, BaseActionSource src )
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.LogisticsPipes ) )
{
ILPPipe pipe = ( (ILPPipeTile) this.te ).getLPPipe();
if( pipe instanceof IRequestAPI )
{
IRequestAPI requestAPI = (IRequestAPI) pipe;
if( type == Actionable.SIMULATE )
{
IRequestAPI.SimulationResult simulation = requestAPI.simulateRequest( request.getItemStack() );
if( simulation.used.size() == 0 )
{
return null;
}
return AEItemStack.create( simulation.used.get( 0 ) );
}
List<ItemStack> returned = requestAPI.performRequest( request.getItemStack() );
if( returned.size() == 0 )
{
return null;
}
return AEItemStack.create( returned.get( 0 ) );
}
}
return null;
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
{
ILPPipe pipe = ( (ILPPipeTile) this.te ).getLPPipe();
if( pipe instanceof IRequestAPI )
{
List<ItemStack> provided = this.getLPItems( pipe );
for( ItemStack is : provided )
{
out.add( AEItemStack.create( is ) );
}
}
return out;
}
/**
* Get items from Logistics Pipes network _excluding_ AE2 network items. Brilliant!
* (basically rewrite of CoreRoutedPipe.getProvidedItems() (implementation of IRequestAPI.getProvidedItems())
*
* @param pipe IRequestAPI pipe
* @return list of items in shared networks
*/
public List<ItemStack> getLPItems( ILPPipe pipe )
{
CoreRoutedPipe coreRoutedPipeCast = (CoreRoutedPipe) pipe;
if( coreRoutedPipeCast.stillNeedReplace() )
{
return new ArrayList<ItemStack>();
}
else
{
List<ExitRoute> exitRoutes = coreRoutedPipeCast.getRouter().getIRoutersByCost();
ArrayList<ExitRoute> exitRoutesProcessed = new ArrayList<ExitRoute>();
for( ExitRoute exitRoute : exitRoutes )
{
if( !isExitToAE( exitRoute ) )
{
exitRoutesProcessed.add( exitRoute );
}
}
Map items = SimpleServiceLocator.logisticsManager.getAvailableItems( exitRoutesProcessed );
ArrayList list = new ArrayList( items.size() );
for( Object o : items.entrySet() )
{
Map.Entry item = (Map.Entry) o;
ItemStack is = ( (ItemIdentifier) item.getKey() ).unsafeMakeNormalStack( ( (Integer) item.getValue() ).intValue() );
list.add( is );
}
return list;
}
}
/**
* Checks ExitRoute for connected AENetworkInvTiles
*
* @param exitRoute Logistics Pipes exit route to check
* @return true if AENetworkInvTiles is connected, otherwise false
*/
private boolean isExitToAE( ExitRoute exitRoute )
{
LinkedList<AdjacentTile> connectedEntities = exitRoute.destination.getPipe().getConnectedEntities();
for( AdjacentTile connectedEntity : connectedEntities )
{
if( connectedEntity.tile instanceof AENetworkInvTile )
{
return true;
}
}
return false;
}
@Override
public StorageChannel getChannel()
{
return StorageChannel.ITEMS;
}
}

View file

@ -0,0 +1,111 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import appeng.api.AEApi;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.ILogisticsPipes;
import appeng.integration.modules.LPHelpers.LPPipeHandler;
import buildcraft.api.transport.IInjectable;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import javax.annotation.Nonnull;
/**
* @author Second_Fry
* @version rv3 - 12.06.2015
* @since rv3 12.06.2015
*/
@Reflected
public class LogisticsPipes implements ILogisticsPipes, IIntegrationModule
{
@Reflected
public static LogisticsPipes instance;
@Reflected
public LogisticsPipes()
{
IntegrationHelper.testClassExistence( this, logisticspipes.api.ILPPipe.class );
IntegrationHelper.testClassExistence( this, logisticspipes.api.ILPPipeTile.class );
IntegrationHelper.testClassExistence( this, logisticspipes.api.IRequestAPI.class );
IntegrationHelper.testClassExistence( this, logisticspipes.pipes.basic.CoreRoutedPipe.class );
IntegrationHelper.testClassExistence( this, logisticspipes.proxy.SimpleServiceLocator.class );
IntegrationHelper.testClassExistence( this, logisticspipes.routing.ExitRoute.class );
IntegrationHelper.testClassExistence( this, logisticspipes.utils.AdjacentTile.class );
IntegrationHelper.testClassExistence( this, logisticspipes.utils.item.ItemIdentifier.class );
}
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new LPPipeHandler() );
}
@Override
public boolean canAddItemsToPipe( final TileEntity te, final ItemStack is, final ForgeDirection direction )
{
if( is != null && te != null && te instanceof IInjectable )
{
final IInjectable pt = (IInjectable) te;
if( pt.canInjectItems( direction ) )
{
final int amt = pt.injectItem( is, false, direction, null );
if( amt == is.stackSize )
{
return true;
}
}
}
return false;
}
@Override
public boolean addItemsToPipe( final TileEntity te, final ItemStack is, @Nonnull final ForgeDirection direction )
{
if( is != null && te != null && te instanceof IInjectable )
{
final IInjectable pt = (IInjectable) te;
if( pt.canInjectItems( direction ) )
{
final int amt = pt.injectItem( is, false, direction, null );
if( amt == is.stackSize )
{
pt.injectItem( is, true, direction, null );
return true;
}
}
}
return false;
}
}

View file

@ -83,7 +83,7 @@ public class PathGridCache implements IPathingGrid
this.updateNetwork = false; this.updateNetwork = false;
this.setChannelsInUse( 0 ); this.setChannelsInUse( 0 );
if( !AEConfig.instance.isFeatureEnabled( AEFeature.Channels ) ) if( this.controllerState == ControllerState.CONTROLLER_INFINITE )
{ {
final int used = this.calculateRequiredChannels(); final int used = this.calculateRequiredChannels();
@ -162,7 +162,7 @@ public class PathGridCache implements IPathingGrid
if( this.active.isEmpty() && this.ticksUntilReady <= 0 ) if( this.active.isEmpty() && this.ticksUntilReady <= 0 )
{ {
if( this.controllerState == ControllerState.CONTROLLER_ONLINE ) if( this.controllerState == ControllerState.CONTROLLER_ONLINE || this.controllerState == ControllerState.CONTROLLER_INFINITE)
{ {
final Iterator<TileController> controllerIterator = this.controllers.iterator(); final Iterator<TileController> controllerIterator = this.controllers.iterator();
if( controllerIterator.hasNext() ) if( controllerIterator.hasNext() )
@ -273,7 +273,11 @@ public class PathGridCache implements IPathingGrid
if( cv.isValid() && cv.getFound() == this.controllers.size() ) if( cv.isValid() && cv.getFound() == this.controllers.size() )
{ {
if (AEConfig.instance.isFeatureEnabled( AEFeature.Channels )) {
this.controllerState = ControllerState.CONTROLLER_ONLINE; this.controllerState = ControllerState.CONTROLLER_ONLINE;
} else {
this.controllerState = ControllerState.CONTROLLER_INFINITE;
}
} }
else else
{ {

View file

@ -28,6 +28,7 @@ import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.*; import appeng.api.storage.*;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList; import appeng.api.storage.data.IItemList;
import appeng.core.AEConfig;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.item.AEItemStack; import appeng.util.item.AEItemStack;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@ -43,7 +44,7 @@ import java.util.Set;
public class CellInventory implements ICellInventory public class CellInventory implements ICellInventory
{ {
public static final int cellItemType = 524288; public static final int cellItemType = AEConfig.instance.ItemTypeLimit;
private static final String ITEM_TYPE_TAG = "it"; private static final String ITEM_TYPE_TAG = "it";
private static final String ITEM_COUNT_TAG = "ic"; private static final String ITEM_COUNT_TAG = "ic";
private static final String ITEM_SLOT = "#"; private static final String ITEM_SLOT = "#";