InventoryTweak sorting support (#3603)

This commit is contained in:
fscan
2018-07-14 21:07:00 +02:00
committed by GitHub
parent 67c733b418
commit f4ef7edf86
5 changed files with 61 additions and 5 deletions
+1
View File
@@ -25,6 +25,7 @@ ic2_version=2.8.73-ex112
top_version=1.12-1.4.23-16
cofhcore_version=1.12.2-4.5.2.19
crafttweaker_version=4.1.8.9
inventorytweaks_version=1.63
#########################################################
# Deployment #
+7 -1
View File
@@ -68,6 +68,11 @@ repositories {
name 'modmaven'
url "https://modmaven.k-4u.nl/"
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
}
configurations {
@@ -88,7 +93,8 @@ dependencies {
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
compileOnly "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
@@ -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 );
}
}
+3 -3
View File
@@ -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;
}