Cleaning Up Mod Integrations (#2581)

* Cleaned up unused Mod integrations other than for mods that are likely to be integrated soon.
* Introduced an easier Facade class to access mod integration abstractions (called Integrations).
* Removed the link between IntegrationType and integration abstraction. Integrations are now explicitly instantiated inside of IntegrationNode.
This commit is contained in:
shartte
2016-11-06 20:23:14 +01:00
committed by yueh
parent fbb0c05c7f
commit 0e7981d717
73 changed files with 689 additions and 1295 deletions
@@ -32,9 +32,6 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBetterStorage;
import appeng.util.inv.AdaptorIInventory;
import appeng.util.inv.AdaptorItemHandler;
import appeng.util.inv.AdaptorList;
@@ -71,8 +68,6 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
}
}
final IBetterStorage bs = (IBetterStorage) ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BetterStorage ) ? IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BetterStorage ) : null );
if( te instanceof EntityPlayer )
{
return new AdaptorIInventory( new AdaptorPlayerInventory( ( (EntityPlayer) te ).inventory, false ) );
@@ -84,10 +79,6 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
return new AdaptorList( list );
}
else if( bs != null && bs.isStorageCrate( te ) )
{
return bs.getAdaptor( te, d );
}
else if( te instanceof TileEntityChest )
{
return new AdaptorIInventory( Platform.GetChestInv( te ) );
+3 -4
View File
@@ -23,8 +23,7 @@ import java.util.Comparator;
import appeng.api.config.SortDir;
import appeng.api.storage.data.IAEItemStack;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.Integrations;
import appeng.integration.abstraction.IInvTweaks;
import appeng.util.item.AEItemStack;
@@ -111,9 +110,9 @@ public class ItemSorters
return;
}
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.InvTweaks ) )
if( Integrations.invTweaks().isEnabled() )
{
api = (IInvTweaks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.InvTweaks );
api = Integrations.invTweaks();
}
else
{
+4 -6
View File
@@ -30,7 +30,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.WeakHashMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -126,8 +125,7 @@ import appeng.core.stats.Stats;
import appeng.core.sync.GuiBridge;
import appeng.core.sync.GuiHostType;
import appeng.hooks.TickHandler;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.Integrations;
import appeng.me.GridAccessException;
import appeng.me.GridNode;
import appeng.me.helpers.AENetworkProxy;
@@ -344,17 +342,17 @@ public class Platform
private static boolean isNotValidSetting( final Enum e )
{
if( e == SortOrder.INVTWEAKS && !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.InvTweaks ) )
if( e == SortOrder.INVTWEAKS && !Integrations.invTweaks().isEnabled() )
{
return true;
}
if( e == SearchBoxMode.JEI_AUTOSEARCH && !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.JEI ) )
if( e == SearchBoxMode.JEI_AUTOSEARCH && !Integrations.jei().isEnabled() )
{
return true;
}
if( e == SearchBoxMode.JEI_MANUAL_SEARCH && !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.JEI ) )
if( e == SearchBoxMode.JEI_MANUAL_SEARCH && !Integrations.jei().isEnabled() )
{
return true;
}
@@ -1,157 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.util.inv;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
public class WrapperBCPipe implements IInventory
{
private final IBuildCraftTransport bc;
private final TileEntity ad;
private final EnumFacing dir;
public WrapperBCPipe( final TileEntity te, final EnumFacing d )
{
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
this.ad = te;
this.dir = d;
}
@Override
public int getSizeInventory()
{
return 1;
}
@Override
public ItemStack getStackInSlot( final int i )
{
return null;
}
@Override
public ItemStack decrStackSize( final int i, final int j )
{
return null;
}
@Override
public ItemStack removeStackFromSlot( final int i )
{
return null;
}
@Override
public void setInventorySlotContents( final int i, final ItemStack itemstack )
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
this.bc.addItemsToPipe( this.ad, itemstack, this.dir );
}
}
@Override
public int getInventoryStackLimit()
{
return 64;
}
@Override
public void markDirty()
{
}
@Override
public void openInventory( final EntityPlayer player )
{
}
@Override
public void closeInventory( final EntityPlayer player )
{
}
@Override
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
{
return false;
}
@Override
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir );
}
@Override
public int getField( final int id )
{
return 0;
}
@Override
public void setField( final int id, final int value )
{
}
@Override
public int getFieldCount()
{
return 0;
}
@Override
public void clear()
{
}
@Override
public String getName()
{
return null;
}
@Override
public boolean hasCustomName()
{
return false;
}
@Override
public ITextComponent getDisplayName()
{
return null;
}
}