InventoryTweak sorting support (#3603)
This commit is contained in:
@@ -21,6 +21,7 @@ package appeng.integration;
|
||||
|
||||
import appeng.integration.modules.crafttweaker.CTModule;
|
||||
import appeng.integration.modules.ic2.IC2Module;
|
||||
import appeng.integration.modules.inventorytweaks.InventoryTweaksModule;
|
||||
import appeng.integration.modules.jei.JEIModule;
|
||||
import appeng.integration.modules.theoneprobe.TheOneProbeModule;
|
||||
import appeng.integration.modules.waila.WailaModule;
|
||||
@@ -50,7 +51,14 @@ public enum IntegrationType
|
||||
}
|
||||
},
|
||||
|
||||
InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ),
|
||||
InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" )
|
||||
{
|
||||
@Override
|
||||
public IIntegrationModule createInstance()
|
||||
{
|
||||
return Integrations.setInvTweaks( new InventoryTweaksModule() );
|
||||
}
|
||||
},
|
||||
|
||||
JEI( IntegrationSide.CLIENT, "Just Enough Items", "jei" )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
package appeng.integration.modules.inventorytweaks;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
import invtweaks.api.InvTweaksAPI;
|
||||
|
||||
import appeng.integration.abstraction.IInvTweaks;
|
||||
|
||||
|
||||
public class InventoryTweaksModule implements IInvTweaks
|
||||
{
|
||||
InvTweaksAPI api = null;
|
||||
|
||||
public InventoryTweaksModule()
|
||||
{
|
||||
try
|
||||
{
|
||||
api = (InvTweaksAPI) Class.forName( "invtweaks.forge.InvTweaksMod", true, Loader.instance().getModClassLoader() )
|
||||
.getField( "instance" )
|
||||
.get( null );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return api != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareItems( ItemStack i, ItemStack j )
|
||||
{
|
||||
return api.compareItems( i, j );
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class ItemSorters
|
||||
return CONFIG_BASED_SORT_BY_NAME.compare( o1, o2 );
|
||||
}
|
||||
|
||||
final int cmp = api.compareItems( o1.asItemStackRepresentation(), o2.asItemStackRepresentation() );
|
||||
final int cmp = api.compareItems( o1.createItemStack(), o2.createItemStack() );
|
||||
return applyDirection( cmp );
|
||||
}
|
||||
};
|
||||
@@ -120,8 +120,8 @@ public class ItemSorters
|
||||
}
|
||||
|
||||
private static int applyDirection( int cmp )
|
||||
{
|
||||
if ( getDirection() == SortDir.ASCENDING )
|
||||
{
|
||||
if( getDirection() == SortDir.ASCENDING )
|
||||
{
|
||||
return cmp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user