Compare commits

...

20 Commits

Author SHA1 Message Date
fscan 6f30658d41 Backport dupe fix (#3196) 2017-11-05 05:37:21 +01:00
fscan 07bcd528ea we dont use scala ... (#3097) 2017-09-18 11:45:47 +02:00
fscan 5cbdc1d769 Fix fluid P2p voiding excess liquids (#3090)
Backported from 1.12
2017-09-16 17:38:01 +02:00
fscan 05b29d0de0 Cache the STORAGE_MONITORABLE_ACCESSOR Capability to reduce the amount of MENetworkCellArrayUpdates (#3077) 2017-09-09 13:30:16 +02:00
fscan 4a6162907c Merge pull request #3062 from fscan/inventory-save-changes-2
Save changes in AppEngInternalAEInventory too.
2017-08-31 14:24:43 +02:00
Florian Scandella dfb23fd9e7 Save changes in AppEngInternalAEInventory too. 2017-08-31 14:00:40 +02:00
fscan d8ca9fc2f9 Merge pull request #3061 from fscan/inventory-save-changes
Always save changes when inventory changes.
2017-08-30 00:26:02 +02:00
Florian Scandella e9a8a8cdff always save changes when inventory changes.
should fix #3059
2017-08-29 23:21:08 +02:00
fscan 8163b30479 Fixes pattern terminal extracting real items and voiding them on JEI recipe transfer (#3054) 2017-08-21 10:59:22 +02:00
yueh f44cddf8d5 Splitted coremod into a container and loading plugin. 2017-07-23 15:37:39 +02:00
thatsIch e3bf52ff7b Merge pull request #2846 from suttonwilliamd/fix-LR-badge
Fixed "Latest Release" badge in readme.md
2017-07-13 22:55:56 +02:00
William 07913af4f8 Fixed "Latest Release" badge in readme.md
Spaces translate to %20 in URLs
2017-03-23 21:16:59 -04:00
yueh 1760113cd4 Fixes #2768: Incorrect return value when charging items via Tesla. (#2771) 2017-01-31 12:17:32 +01:00
yueh 12b05275f2 Fixes #2750: Added missing RF Integration Modules. (#2770)
* Fixes #2750: Added missing RF Integration Modules.

Readded the integration modules for both RF integrations.
These are necessary to correctly enable RF support as well as act as
fallback to disable it automatically on missing interfaces.

* Unittests and improved logging for integration modules.

Added a unittest to ensure an integration types instaniates an integration
module without throwing any exception.
Improved the logging should this ever happen at runtime again.
2017-01-31 12:17:03 +01:00
yueh c720584e49 Fixes #2729: Fix transformer regression introduced during FG downtime. (#2730)
Added a unittest to verify the necessary string returns match the actual
existing classes, in case something screws up the refactoring.
2016-12-31 18:25:16 +01:00
yueh ab89278274 Replaces old fluid handlers with the new capability based ones. (#2727)
* Changed ME Chest and P2P tunnels to use fluid capabilities.
* Renamed all occurrences of liquid to fluids.
2016-12-31 16:01:29 +01:00
yueh 7c5f777e41 Fixes #2713: Call super#onBlockActivated() for wrench interaction. (#2728) 2016-12-31 16:00:45 +01:00
yueh 8b0637d05d Fixes IDE not correctly cleaning up the list of staged files. 2016-12-31 15:21:25 +01:00
yueh 497f1c9ace Fixes #2714: Use a concurrent list to back NetworkList (#2715) 2016-12-29 15:51:17 +01:00
yueh 2ab0528015 Fixes #2724: Use capitalized oredict name for dyes, not uppercase. 2016-12-29 15:50:02 +01:00
40 changed files with 638 additions and 319 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
[![Travis](https://img.shields.io/travis/AppliedEnergistics/Applied-Energistics-2.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/AppliedEnergistics/Applied-Energistics-2)
[![Latest Release](https://img.shields.io/github/release/AppliedEnergistics/Applied-Energistics-2.svg?label=Latest Release&style=flat-square)](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases)
[![Latest Release](https://img.shields.io/github/release/AppliedEnergistics/Applied-Energistics-2.svg?label=Latest%20Release&style=flat-square)](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases)
# Applied Energistics 2
+1 -1
View File
@@ -68,7 +68,7 @@ jar {
}
minecraft {
coreMod = "appeng.coremod.AppEngCore"
coreMod = "appeng.coremod.AppEngLoadingPlugin"
version = minecraft_version + "-" + forge_version
@@ -76,7 +76,7 @@ public interface IParts
IItemDefinition p2PTunnelItems();
IItemDefinition p2PTunnelLiquids();
IItemDefinition p2PTunnelFluids();
IItemDefinition p2PTunnelEU();
@@ -149,6 +149,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
final TileCraftingTile tg = this.getTileEntity( w, pos );
if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
{
if( Platform.isClient() )
@@ -160,7 +161,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
return true;
}
return false;
return super.onBlockActivated( w, pos, state, p, hand, heldItem, side, hitX, hitY, hitZ );
}
public enum CraftingUnitType
@@ -107,6 +107,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC );
return true;
}
return false;
return super.onBlockActivated( w, pos, state, p, hand, heldItem, side, hitX, hitY, hitZ );
}
}
@@ -47,6 +47,7 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
{
@@ -63,7 +64,6 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
}
}
public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class );
public BlockWireless()
@@ -113,13 +113,9 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( player.isSneaking() )
{
return false;
}
final TileWireless tg = this.getTileEntity( w, pos );
if( tg != null )
if( tg != null && !player.isSneaking() )
{
if( Platform.isServer() )
{
@@ -127,7 +123,8 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
}
return true;
}
return false;
return super.onBlockActivated( w, pos, state, player, hand, heldItem, side, hitX, hitY, hitZ );
}
@Override
+1 -1
View File
@@ -307,7 +307,7 @@ public final class AELog
{
if( AEConfig.instance().isFeatureEnabled( AEFeature.INTEGRATION_LOGGING ) )
{
debug( exception );
error( exception );
}
}
@@ -61,7 +61,7 @@ public final class ApiParts implements IParts
private final IItemDefinition p2PTunnelME;
private final IItemDefinition p2PTunnelRedstone;
private final IItemDefinition p2PTunnelItems;
private final IItemDefinition p2PTunnelLiquids;
private final IItemDefinition p2PTunnelFluids;
private final IItemDefinition p2PTunnelEU;
// private final IItemDefinition p2PTunnelRF;
private final IItemDefinition p2PTunnelLight;
@@ -112,7 +112,7 @@ public final class ApiParts implements IParts
this.p2PTunnelME = new DamagedItemDefinition( "part.tunnel.me", itemPart.createPart( PartType.P2PTunnelME ) );
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2PTunnelRedstone ) );
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2PTunnelItems ) );
this.p2PTunnelLiquids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelLiquids ) );
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelFluids ) );
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2PTunnelEU ) );
// this.p2PTunnelRF = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRF ) );
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2PTunnelLight ) );
@@ -281,9 +281,9 @@ public final class ApiParts implements IParts
}
@Override
public IItemDefinition p2PTunnelLiquids()
public IItemDefinition p2PTunnelFluids()
{
return this.p2PTunnelLiquids;
return this.p2PTunnelFluids;
}
@Override
@@ -118,7 +118,7 @@ public enum AEFeature
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_EU( "P2PTunnelEU", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_LIQUIDS( "P2PTunnelLiquids", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_FLUIDS( "P2PTunnelFluids", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_LIGHT( "P2PTunnelLight", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_OPEN_COMPUTERS( "P2PTunnelOpenComputers", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_PRESSURE( "P2PTunnelPressure", Constants.CATEGORY_P2P_TUNNELS ),
@@ -205,7 +205,15 @@ public class PacketJEIRecipe extends AppEngPacket
if( filter == null || filter.isListed( request ) )
{
request.setStackSize( 1 );
final IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getActionSource() );
IAEItemStack out;
if ( realForFake == Actionable.SIMULATE )
{
out = storage.extractItems( request, Actionable.SIMULATE, cct.getActionSource() );
}
else
{
out = Platform.poweredExtraction( energy, storage, request, cct.getActionSource() );
}
if( out != null )
{
whichItem = out.getItemStack();
@@ -19,10 +19,6 @@
package appeng.coremod;
import java.util.Map;
import javax.annotation.Nullable;
import com.google.common.eventbus.EventBus;
import net.minecraftforge.fml.common.DummyModContainer;
@@ -31,18 +27,15 @@ import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.ModMetadata;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion;
import appeng.core.AEConfig;
@MCVersion( "1.10.2" )
public final class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin
public final class AppEngCoreContainer extends DummyModContainer
{
private final ModMetadata metadata = new ModMetadata();
public AppEngCore()
public AppEngCoreContainer()
{
FMLRelaunchLog.info( "[AppEng] Core Init" );
this.metadata.autogenerated = false;
@@ -61,37 +54,6 @@ public final class AppEngCore extends DummyModContainer implements IFMLLoadingPl
{
}
@Override
public String[] getASMTransformerClass()
{
return new String[] { "appeng.coremod.asm.ASMIntegration" };
}
@Override
public String getModContainerClass()
{
return "appeng.coremod.AppEngCore";
}
@Nullable
@Override
public String getSetupClass()
{
return null;
}
@Override
public void injectData( final Map<String, Object> data )
{
}
@Override
public String getAccessTransformerClass()
{
return null;
}
@Override
public ModMetadata getMetadata()
{
@@ -0,0 +1,64 @@
/*
* 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.coremod;
import java.util.Map;
import javax.annotation.Nullable;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
@IFMLLoadingPlugin.MCVersion( "1.10.2" )
@IFMLLoadingPlugin.TransformerExclusions( { "appeng.coremod." } )
public class AppEngLoadingPlugin implements IFMLLoadingPlugin
{
@Override
public String[] getASMTransformerClass()
{
return new String[] { "appeng.coremod.transformer.IntegrationTransformer" };
}
@Override
public String getModContainerClass()
{
return "appeng.coremod.AppEngCoreContainer";
}
@Nullable
@Override
public String getSetupClass()
{
return null;
}
@Override
public void injectData( final Map<String, Object> data )
{
}
@Override
public String getAccessTransformerClass()
{
return null;
}
}
@@ -68,7 +68,7 @@ public final class MissingCoreMod extends CustomModLoadingErrorDisplayException
this.drawCenteredString( fontRenderer, "In a developer environment add the following too your args,", errorScreen.width / 2, offset, COLOR_WHITE );
offset += SCREEN_OFFSET;
this.drawCenteredString( fontRenderer, "-Dfml.coreMods.load=appeng.coremod.AppEngCore", errorScreen.width / 2, offset, SHADOW_WHITE );
this.drawCenteredString( fontRenderer, "-Dfml.coreMods.load=appeng.coremod.AppEngCoreContainer", errorScreen.width / 2, offset, SHADOW_WHITE );
}
else
{
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.coremod.asm;
package appeng.coremod.transformer;
import java.util.Iterator;
@@ -41,37 +41,22 @@ import appeng.integration.IntegrationType;
@Reflected
public final class ASMIntegration implements IClassTransformer
public final class IntegrationTransformer implements IClassTransformer
{
@Reflected
public ASMIntegration()
public IntegrationTransformer()
{
/**
* Side, Display Name, ModID ClassPostFix
*/
for( final IntegrationType type : IntegrationType.values() )
{
IntegrationRegistry.INSTANCE.add( type );
}
// integrationModules.add( IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", IntegrationType.TE );
// integrationModules.add( IntegrationSide.BOTH, "Mystcraft", "Mystcraft", IntegrationType.Mystcraft );
// integrationModules.add( IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", IntegrationType.GT );
// integrationModules.add( IntegrationSide.BOTH, "Universal Electricity", null, IntegrationType.UE );
// integrationModules.add( IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", IntegrationType.LP );
// integrationModules.add( IntegrationSide.BOTH, "Better Storage", IntegrationType.betterstorage );
// integrationModules.add( IntegrationSide.BOTH, "Forestry", "Forestry", IntegrationType.Forestry );
// integrationModules.add( IntegrationSide.BOTH, "Mekanism", "Mekanism", IntegrationType.Mekanism );
}
@Nullable
@Override
public byte[] transform( final String name, final String transformedName, final byte[] basicClass )
{
if( basicClass == null || transformedName.startsWith( "appeng.coremod" ) )
if( basicClass == null )
{
return basicClass;
}
@@ -21,8 +21,6 @@ package appeng.helpers;
import java.util.Iterator;
import scala.NotImplementedError;
public class NonNullArrayIterator<E> implements Iterator<E>
{
@@ -58,6 +56,6 @@ public class NonNullArrayIterator<E> implements Iterator<E>
@Override
public void remove()
{
throw new NotImplementedError();
throw new UnsupportedOperationException();
}
}
@@ -25,9 +25,6 @@ import net.minecraftforge.fml.common.ModAPIManager;
import appeng.api.exceptions.ModNotInstalled;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.integration.modules.ic2.IC2Module;
import appeng.integration.modules.jei.JEIModule;
import appeng.integration.modules.waila.WailaModule;
final class IntegrationNode
@@ -80,7 +77,8 @@ final class IntegrationNode
final ModAPIManager apiManager = ModAPIManager.INSTANCE;
boolean enabled = this.modID == null || Loader.isModLoaded( this.modID ) || apiManager.hasAPI( this.modID );
AEConfig.instance().addCustomCategoryComment( "ModIntegration", "Valid Values are 'AUTO', 'ON', or 'OFF' - defaults to 'AUTO' ; Suggested that you leave this alone unless your experiencing an issue, or wish to disable the integration for a reason." );
AEConfig.instance().addCustomCategoryComment( "ModIntegration",
"Valid Values are 'AUTO', 'ON', or 'OFF' - defaults to 'AUTO' ; Suggested that you leave this alone unless your experiencing an issue, or wish to disable the integration for a reason." );
final String mode = AEConfig.instance().get( "ModIntegration", this.displayName.replace( " ", "" ), "AUTO" ).getString();
if( mode.toUpperCase().equals( "ON" ) )
@@ -21,6 +21,8 @@ package appeng.integration;
import appeng.integration.modules.ic2.IC2Module;
import appeng.integration.modules.jei.JEIModule;
import appeng.integration.modules.rf.RFItemModule;
import appeng.integration.modules.rf.RFTileModule;
import appeng.integration.modules.theoneprobe.TheOneProbeModule;
import appeng.integration.modules.waila.WailaModule;
@@ -36,13 +38,25 @@ public enum IntegrationType
}
},
RC( IntegrationSide.BOTH, "Railcraft", "Railcraft" ),
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" )
{
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ),
@Override
public IIntegrationModule createInstance()
{
return new RFTileModule();
}
},
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" ),
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" )
{
MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded" ),
@Override
public IIntegrationModule createInstance()
{
return new RFItemModule();
}
},
Waila( IntegrationSide.BOTH, "Waila", "Waila" )
{
@@ -53,8 +67,6 @@ public enum IntegrationType
}
},
InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ),
JEI( IntegrationSide.CLIENT, "Just Enough Items", "JEI" )
{
@Override
@@ -64,10 +76,6 @@ public enum IntegrationType
}
},
Mekanism( IntegrationSide.BOTH, "Mekanism", "Mekanism" ),
OpenComputers( IntegrationSide.BOTH, "OpenComputers", "OpenComputers" ),
THE_ONE_PROBE( IntegrationSide.BOTH, "TheOneProbe", "theoneprobe" )
{
@Override
@@ -90,7 +98,7 @@ public enum IntegrationType
public IIntegrationModule createInstance()
{
throw new UnsupportedOperationException();
throw new MissingIntegrationModuleException( this.name() );
}
}
@@ -0,0 +1,32 @@
/*
* 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;
public class MissingIntegrationModuleException extends RuntimeException
{
private static final long serialVersionUID = 1927357647297008228L;
public MissingIntegrationModuleException( String name )
{
super( "Missing integration module for type '" + name + "'." );
}
}
@@ -20,6 +20,7 @@ package appeng.integration.modules.jei;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -28,7 +29,6 @@ import net.minecraft.item.ItemStack;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
import scala.actors.threadpool.Arrays;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
@@ -0,0 +1,32 @@
/*
* 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.rf;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
public class RFItemModule implements IIntegrationModule
{
public RFItemModule()
{
IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyContainerItem.class );
}
}
@@ -0,0 +1,32 @@
/*
* 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.rf;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
public class RFTileModule implements IIntegrationModule
{
public RFTileModule()
{
IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyReceiver.class );
}
}
@@ -59,10 +59,10 @@ import appeng.parts.networking.PartCableGlass;
import appeng.parts.networking.PartCableSmart;
import appeng.parts.networking.PartDenseCable;
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.PartP2PLiquids;
import appeng.parts.p2p.PartP2PRedstone;
import appeng.parts.p2p.PartP2PTunnelME;
import appeng.parts.reporting.PartConversionMonitor;
@@ -226,8 +226,8 @@ public enum PartType
}
},
P2PTunnelLiquids( 463, "p2p_tunnel_liquids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIQUIDS ), EnumSet
.noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel )
P2PTunnelFluids( 463, "p2p_tunnel_fluids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
.noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
{
@Override
String getUnlocalizedName()
@@ -27,6 +27,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.text.WordUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.block.BlockStainedGlass;
@@ -86,15 +88,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
static
{
for( final AEColor col : AEColor.values() )
for( final AEColor color : AEColor.VALID_COLORS )
{
if( col == AEColor.TRANSPARENT )
{
continue;
}
final String dyeName = color.dye.getUnlocalizedName();
final String oreDictName = "dye" + WordUtils.capitalize( dyeName );
final int oreDictId = OreDictionary.getOreID( oreDictName );
ORE_TO_COLOR.put( OreDictionary.getOreID( "dye" + col.name() ), col );
ORE_TO_COLOR.put( oreDictId, color );
}
}
@@ -277,7 +277,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
list.add( i );
}
Collections.sort( list, new Comparator<IAEItemStack>(){
Collections.sort( list, new Comparator<IAEItemStack>()
{
@Override
public int compare( final IAEItemStack a, final IAEItemStack b )
@@ -64,9 +64,7 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
@Override
public boolean hasCapability( Capability<?> capability, @Nullable EnumFacing facing )
{
return capability == CapabilityEnergy.ENERGY
|| capability == Capabilities.TESLA_CONSUMER
|| capability == Capabilities.TESLA_HOLDER;
return capability == CapabilityEnergy.ENERGY || capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER;
}
@SuppressWarnings( "unchecked" )
@@ -87,10 +85,10 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
@Override
public int receiveEnergy( int maxReceive, boolean simulate )
{
if( simulate )
{
final int required = (int) PowerUnits.AE.convertTo( PowerUnits.RF, item.getAEMaxPower( is ) - item.getAECurrentPower( is ) );
if( maxReceive < required )
{
return 0;
@@ -100,7 +98,7 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
else
{
final double powerRemainder = item.injectAEPower( is, PowerUnits.RF.convertTo( PowerUnits.AE, maxReceive ) );
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, powerRemainder );
return maxReceive - (int) PowerUnits.AE.convertTo( PowerUnits.RF, powerRemainder );
}
}
+3 -3
View File
@@ -21,8 +21,8 @@ package appeng.me;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@@ -31,7 +31,7 @@ import java.util.List;
public class NetworkList implements Collection<Grid>
{
private List<Grid> networks = new LinkedList<Grid>();
private List<Grid> networks = new CopyOnWriteArrayList<>();
@Override
public int size()
@@ -108,6 +108,6 @@ public class NetworkList implements Collection<Grid>
@Override
public void clear()
{
this.networks = new LinkedList<Grid>();
this.networks.clear();
}
}
@@ -136,10 +136,12 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
extracted.stackSize = remainingCurrentSlot;
}
// We're just gonna use the first stack we get our hands on as the template for the rest
// We're just gonna use the first stack we get our hands on as the template for the rest.
// In case some stupid itemhandler (aka forge) returns an internal state we have to do a second
// expensive copy again.
if( gathered == null )
{
gathered = extracted;
gathered = extracted.copy();
}
else
{
@@ -19,28 +19,42 @@
package appeng.parts.p2p;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.FluidTankProperties;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties;
import appeng.api.parts.IPartModel;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFluidHandler
public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFluidHandler
{
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_liquids" );
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_fluids" );
private static final ThreadLocal<Deque<PartP2PFluids>> DEPTH = new ThreadLocal<>();
private static final FluidTankProperties[] ACTIVE_TANK = { new FluidTankProperties( null, 10000, true, false ) };
private static final FluidTankProperties[] INACTIVE_TANK = { new FluidTankProperties( null, 0, false, false ) };
private IFluidHandler cachedTank;
private int tmpUsed;
public PartP2PFluids( final ItemStack is )
{
super( is );
}
@PartModels
public static List<IPartModel> getModels()
@@ -48,17 +62,6 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
return MODELS.getModels();
}
private static final ThreadLocal<Stack<PartP2PLiquids>> DEPTH = new ThreadLocal<Stack<PartP2PLiquids>>();
private static final FluidTankInfo[] ACTIVE_TANK = { new FluidTankInfo( null, 10000 ) };
private static final FluidTankInfo[] INACTIVE_TANK = { new FluidTankInfo( null, 0 ) };
private IFluidHandler cachedTank;
private int tmpUsed;
public PartP2PLiquids( final ItemStack is )
{
super( is );
}
public float getPowerDrainPerTick()
{
return 2.0f;
@@ -74,9 +77,10 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
public void onNeighborChanged()
{
this.cachedTank = null;
if( this.isOutput() )
{
final PartP2PLiquids in = this.getInput();
final PartP2PFluids in = this.getInput();
if( in != null )
{
in.onTunnelNetworkChange();
@@ -85,11 +89,54 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
}
@Override
public int fill( final EnumFacing from, final FluidStack resource, final boolean doFill )
public boolean hasCapability( Capability<?> capabilityClass )
{
final Stack<PartP2PLiquids> stack = this.getDepth();
if( capabilityClass == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY )
{
return true;
}
for( final PartP2PLiquids t : stack )
return super.hasCapability( capabilityClass );
}
@Override
public <T> T getCapability( Capability<T> capabilityClass )
{
if( capabilityClass == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY )
{
return (T) this;
}
return super.getCapability( capabilityClass );
}
@Override
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
}
@Override
public IFluidTankProperties[] getTankProperties()
{
if( !this.isOutput() )
{
final PartP2PFluids tun = this.getInput();
if( tun != null )
{
return ACTIVE_TANK;
}
}
return INACTIVE_TANK;
}
@Override
public int fill( FluidStack resource, boolean doFill )
{
final Deque<PartP2PFluids> stack = this.getDepth();
for( final PartP2PFluids t : stack )
{
if( t == this )
{
@@ -99,17 +146,18 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
stack.push( this );
final List<PartP2PLiquids> list = this.getOutputs( resource.getFluid() );
final List<PartP2PFluids> list = this.getOutputs( resource.getFluid() );
int requestTotal = 0;
Iterator<PartP2PLiquids> i = list.iterator();
Iterator<PartP2PFluids> i = list.iterator();
while( i.hasNext() )
{
final PartP2PLiquids l = i.next();
final PartP2PFluids l = i.next();
final IFluidHandler tank = l.getTarget();
if( tank != null )
{
l.tmpUsed = tank.fill( l.getSide().getFacing().getOpposite(), resource.copy(), false );
l.tmpUsed = tank.fill( resource.copy(), false );
}
else
{
@@ -150,9 +198,10 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
i = list.iterator();
int used = 0;
while( i.hasNext() )
while( i.hasNext() && available > 0 )
{
final PartP2PLiquids l = i.next();
final PartP2PFluids l = i.next();
final FluidStack insert = resource.copy();
insert.amount = (int) Math.ceil( insert.amount * ( (double) l.tmpUsed / (double) requestTotal ) );
@@ -164,7 +213,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
final IFluidHandler tank = l.getTarget();
if( tank != null )
{
l.tmpUsed = tank.fill( l.getSide().getFacing().getOpposite(), insert.copy(), true );
l.tmpUsed = tank.fill( insert.copy(), true );
}
else
{
@@ -172,7 +221,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
}
available -= insert.amount;
used += insert.amount;
used += l.tmpUsed;
}
if( stack.pop() != this )
@@ -183,33 +232,43 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
return used;
}
private Stack<PartP2PLiquids> getDepth()
@Override
public FluidStack drain( FluidStack resource, boolean doDrain )
{
Stack<PartP2PLiquids> s = DEPTH.get();
return null;
}
@Override
public FluidStack drain( int maxDrain, boolean doDrain )
{
return null;
}
private Deque<PartP2PFluids> getDepth()
{
Deque<PartP2PFluids> s = DEPTH.get();
if( s == null )
{
DEPTH.set( s = new Stack<PartP2PLiquids>() );
DEPTH.set( s = new LinkedList<>() );
}
return s;
}
private List<PartP2PLiquids> getOutputs( final Fluid input )
private List<PartP2PFluids> getOutputs( final Fluid input )
{
final List<PartP2PLiquids> outs = new LinkedList<PartP2PLiquids>();
final List<PartP2PFluids> outs = new LinkedList<>();
try
{
for( final PartP2PLiquids l : this.getOutputs() )
for( final PartP2PFluids l : this.getOutputs() )
{
final IFluidHandler handler = l.getTarget();
if( handler != null )
{
if( handler.canFill( l.getSide().getFacing().getOpposite(), input ) )
{
outs.add( l );
}
outs.add( l );
}
}
}
@@ -234,79 +293,14 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
}
final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( this.getSide().getFacing() ) );
if( te instanceof IFluidHandler )
if( te != null && te.hasCapability( CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, this.getSide().getFacing().getOpposite() ) )
{
return this.cachedTank = (IFluidHandler) te;
return this.cachedTank = te.getCapability( CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,
this.getSide().getFacing().getOpposite() );
}
return null;
}
@Override
public FluidStack drain( final EnumFacing from, final FluidStack resource, final boolean doDrain )
{
return null;
}
@Override
public FluidStack drain( final EnumFacing from, final int maxDrain, final boolean doDrain )
{
return null;
}
@Override
public boolean canFill( final EnumFacing from, final Fluid fluid )
{
return !this.isOutput() && from == this.getSide().getFacing() && !this.getOutputs( fluid ).isEmpty();
}
@Override
public boolean canDrain( final EnumFacing from, final Fluid fluid )
{
return false;
}
@Override
public FluidTankInfo[] getTankInfo( final EnumFacing from )
{
if( from == this.getSide().getFacing() )
{
return this.getTank();
}
return new FluidTankInfo[0];
}
private FluidTankInfo[] getTank()
{
if( this.isOutput() )
{
final PartP2PLiquids tun = this.getInput();
if( tun != null )
{
return ACTIVE_TANK;
}
}
else
{
try
{
if( !this.getOutputs().isEmpty() )
{
return ACTIVE_TANK;
}
}
catch( final GridAccessException e )
{
// :(
}
}
return INACTIVE_TANK;
}
@Override
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
}
}
@@ -232,7 +232,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
*/
case FLUID:
newType = parts.p2PTunnelLiquids().maybeStack( 1 ).orElse( null );
newType = parts.p2PTunnelFluids().maybeStack( 1 ).orElse( null );
break;
case IC2_POWER:
@@ -169,6 +169,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
if( this.te != null && Platform.isServer() )
{
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
this.te.saveChanges();
}
return ns;
@@ -215,6 +216,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
this.te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.te.saveChanges();
}
}
@@ -242,6 +244,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
if( this.te != null && Platform.isServer() )
{
this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.te.saveChanges();
}
}
@@ -174,6 +174,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.getTileEntity().onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.getTileEntity().saveChanges();
}
}
@@ -200,6 +201,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.getTileEntity().onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
this.getTileEntity().saveChanges();
}
}
+102 -88
View File
@@ -35,10 +35,11 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.FluidTankProperties;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
@@ -98,7 +99,7 @@ import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable
public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable
{
private static final ChestNoHandler NO_HANDLER = new ChestNoHandler();
@@ -118,7 +119,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
private ICellHandler cellHandler;
private MEMonitorHandler itemCell;
private MEMonitorHandler fluidCell;
private final Accessor accessor = new Accessor();
private Accessor accessor;
private IFluidHandler fluidHandler;
public TileChest()
{
@@ -203,6 +205,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.itemCell = null;
this.fluidCell = null;
this.accessor = null;
this.fluidHandler = null;
final ItemStack is = this.inv.getStackInSlot( 1 );
if( is != null )
{
@@ -228,6 +233,17 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.itemCell = this.wrap( itemCell );
this.fluidCell = this.wrap( fluidCell );
if( this.itemCell != null )
{
}
this.accessor = new Accessor();
if( this.fluidCell != null )
{
this.fluidHandler = new FluidHandler();
}
}
}
}
@@ -468,7 +484,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.lastStateChange = this.worldObj.getTotalWorldTime();
return oldPaintedColor != this.paintedColor || ( this.state & 0xDB6DB6DB ) != ( oldState & 0xDB6DB6DB ) || !Platform.itemComparisons().isSameItem( oldType, this.storageType );
return oldPaintedColor != this.paintedColor || ( this.state & 0xDB6DB6DB ) != ( oldState & 0xDB6DB6DB ) || !Platform.itemComparisons()
.isSameItem( oldType, this.storageType );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
@@ -576,7 +593,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
final IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
final IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, this.mySrc );
final IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), Actionable.SIMULATE,
this.mySrc );
return returns == null || returns.getStackSize() != insertingItem.stackSize;
}
catch( final ChestNoHandler ignored )
@@ -625,7 +643,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
final IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
final IAEItemStack returns = Platform.poweredInsert( this, cell, AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), this.mySrc );
final IAEItemStack returns = Platform.poweredInsert( this, cell, AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ),
this.mySrc );
if( returns == null )
{
@@ -699,84 +718,6 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.recalculateDisplay();
}
@Override
public int fill( final EnumFacing from, final FluidStack resource, final boolean doFill )
{
final double req = resource.amount / 500.0;
final double available = this.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
if( available >= req - 0.01 )
{
try
{
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
this.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
final IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE, this.mySrc );
if( results == null )
{
return resource.amount;
}
return resource.amount - (int) results.getStackSize();
}
catch( final ChestNoHandler ignored )
{
}
}
return 0;
}
@Override
public FluidStack drain( final EnumFacing from, final FluidStack resource, final boolean doDrain )
{
return null;
}
@Override
public FluidStack drain( final EnumFacing from, final int maxDrain, final boolean doDrain )
{
return null;
}
@Override
public boolean canFill( final EnumFacing from, final Fluid fluid )
{
try
{
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
return h.canAccept( AEFluidStack.create( new FluidStack( fluid, 1 ) ) );
}
catch( final ChestNoHandler ignored )
{
}
return false;
}
@Override
public boolean canDrain( final EnumFacing from, final Fluid fluid )
{
return false;
}
@Override
public FluidTankInfo[] getTankInfo( final EnumFacing from )
{
try
{
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
if( h.getChannel() == StorageChannel.FLUIDS )
{
return new FluidTankInfo[] { new FluidTankInfo( null, 1 ) }; // eh?
}
}
catch( final ChestNoHandler ignored )
{
}
return null;
}
public ItemStack getStorageType()
{
if( this.isPowered() )
@@ -990,7 +931,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public boolean hasCapability( Capability<?> capability, EnumFacing facing )
{
if( capability == Capabilities.STORAGE_MONITORABLE_ACCESSOR && facing != getForward() )
if( capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && this.fluidHandler != null && facing != getForward() )
{
return true;
}
if( capability == Capabilities.STORAGE_MONITORABLE_ACCESSOR && this.accessor != null && facing != getForward() )
{
return true;
}
@@ -1001,7 +946,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public <T> T getCapability( Capability<T> capability, @Nullable EnumFacing facing )
{
if( capability == Capabilities.STORAGE_MONITORABLE_ACCESSOR && facing != getForward() )
if( capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && this.fluidHandler != null && facing != getForward() )
{
return (T) this.fluidHandler;
}
if( capability == Capabilities.STORAGE_MONITORABLE_ACCESSOR && this.accessor != null && facing != getForward() )
{
return (T) accessor;
}
@@ -1022,4 +971,69 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
}
private class FluidHandler implements IFluidHandler
{
@Override
public int fill( final FluidStack resource, final boolean doFill )
{
final double req = resource.amount / 500.0;
final double available = TileChest.this.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
if( available >= req - 0.01 )
{
try
{
final IMEInventoryHandler h = TileChest.this.getHandler( StorageChannel.FLUIDS );
TileChest.this.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
final IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE,
TileChest.this.mySrc );
if( results == null )
{
return resource.amount;
}
return resource.amount - (int) results.getStackSize();
}
catch( final ChestNoHandler ignored )
{
}
}
return 0;
}
@Override
public FluidStack drain( final FluidStack resource, final boolean doDrain )
{
return null;
}
@Override
public FluidStack drain( final int maxDrain, final boolean doDrain )
{
return null;
}
@Override
public IFluidTankProperties[] getTankProperties()
{
try
{
final IMEInventoryHandler h = TileChest.this.getHandler( StorageChannel.FLUIDS );
if( h.getChannel() == StorageChannel.FLUIDS )
{
return new IFluidTankProperties[] { new FluidTankProperties( null, 1 ) }; // eh?
}
}
catch( final ChestNoHandler ignored )
{
}
return null;
}
}
}
+1 -1
View File
@@ -1423,7 +1423,7 @@ public class Platform
if( target.hasCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, null ) )
{
return 0;
return target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, null ).hashCode();
}
else if( target instanceof TileEntityChest )
{
@@ -1,3 +1,20 @@
/*
* 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.client.render;
@@ -35,7 +52,8 @@ public class UVLightmapJsonTest
@EventHandler
public void preInit( FMLPreInitializationEvent event )
{
GameRegistry.register( uvlblock = new Block( Material.IRON ){
GameRegistry.register( uvlblock = new Block( Material.IRON )
{
final AxisAlignedBB box = new AxisAlignedBB( 0.25, 0, 7 / 16d, 0.75, 1, 9 / 16d );
@@ -0,0 +1,65 @@
/*
* 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.coremod;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
public class AppEngCoreTest
{
private final static String EXPECTED_CONTAINER_CLASS_NAME = appeng.coremod.AppEngCoreContainer.class.getName();
private final static String EXPECTED_CONTAINER_MOD_ID = "appliedenergistics2-core";
private final static String[] EXPECTED_TRANSFORMERS = new String[] {
appeng.coremod.transformer.IntegrationTransformer.class.getName()
};
private AppEngCoreContainer coreModContainer;
private AppEngLoadingPlugin loadingPlugin;
@Before
public void setup()
{
this.coreModContainer = new AppEngCoreContainer();
this.loadingPlugin = new AppEngLoadingPlugin();
}
@Test
public void testTransformerStringsMatchActualClasses()
{
assertArrayEquals( EXPECTED_TRANSFORMERS, loadingPlugin.getASMTransformerClass() );
}
@Test
public void testContainerClassExists()
{
assertEquals( EXPECTED_CONTAINER_CLASS_NAME, loadingPlugin.getModContainerClass() );
}
@Test
public void testContainerModId()
{
assertEquals( EXPECTED_CONTAINER_MOD_ID, coreModContainer.getModId() );
}
}
@@ -0,0 +1,52 @@
/*
* 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;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
public class IntegrationTypeTest
{
@Test
public void testCreateInstanceWithoutExceptions()
{
for( IntegrationType type : IntegrationType.values() )
{
try
{
assertNotNull( type.createInstance() );
}
// We actually only care about this specific type not being thrown.
catch( MissingIntegrationModuleException e )
{
throw e;
}
// Throw everything else away as these might be caused due to missing dependencies during testing.
catch( Throwable e )
{
// ignore
}
}
}
}
@@ -1,3 +1,20 @@
/*
* 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.services.version;
@@ -7,6 +7,24 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
/*
* 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>.
*/
/**
* Test for {@link ISlimReadableNumberConverter}
*
@@ -1,3 +1,20 @@
/*
* 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.util;