Work on GUIs (specifically to get SkyChest GUI)
This commit is contained in:
@@ -43,15 +43,15 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
||||
{
|
||||
public static InventoryAdaptor getAdaptor( final TileEntity te, final Direction d )
|
||||
{
|
||||
if( te != null && te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d ) )
|
||||
{
|
||||
// Attempt getting an IItemHandler for the given side via caps
|
||||
IItemHandler itemHandler = te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d );
|
||||
if( itemHandler != null )
|
||||
{
|
||||
return new AdaptorItemHandler( itemHandler );
|
||||
}
|
||||
}
|
||||
// FIXME if( te != null && te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d ) )
|
||||
// FIXME {
|
||||
// FIXME // Attempt getting an IItemHandler for the given side via caps
|
||||
// FIXME IItemHandler itemHandler = te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d );
|
||||
// FIXME if( itemHandler != null )
|
||||
// FIXME {
|
||||
// FIXME return new AdaptorItemHandler( itemHandler );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@ import java.util.Comparator;
|
||||
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.integration.abstraction.IInvTweaks;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
|
||||
@@ -59,34 +57,34 @@ public class ItemSorters
|
||||
return applyDirection( cmp );
|
||||
};
|
||||
|
||||
private static IInvTweaks api;
|
||||
// FIXME private static IInvTweaks api;
|
||||
|
||||
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_INV_TWEAKS = ( o1, o2 ) ->
|
||||
{
|
||||
if( api == null )
|
||||
{
|
||||
// FIXME if( api == null )
|
||||
// FIXME {
|
||||
return CONFIG_BASED_SORT_BY_NAME.compare( o1, o2 );
|
||||
}
|
||||
// FIXME }
|
||||
|
||||
final int cmp = api.compareItems( o1.createItemStack(), o2.createItemStack() );
|
||||
return applyDirection( cmp );
|
||||
// FIXME final int cmp = api.compareItems( o1.createItemStack(), o2.createItemStack() );
|
||||
// FIXME return applyDirection( cmp );
|
||||
};
|
||||
|
||||
public static void init()
|
||||
{
|
||||
if( api != null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// FIXME if( api != null )
|
||||
// FIXME {
|
||||
// FIXME return;
|
||||
// FIXME }
|
||||
|
||||
if( Integrations.invTweaks().isEnabled() )
|
||||
{
|
||||
api = Integrations.invTweaks();
|
||||
}
|
||||
else
|
||||
{
|
||||
api = null;
|
||||
}
|
||||
// FIXME if( Integrations.invTweaks().isEnabled() )
|
||||
// FIXME {
|
||||
// FIXME api = Integrations.invTweaks();
|
||||
// FIXME }
|
||||
// FIXME else
|
||||
// FIXME {
|
||||
// FIXME api = null;
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
private static SortDir getDirection()
|
||||
|
||||
@@ -29,11 +29,14 @@ import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.stats.AeStats;
|
||||
import appeng.fluids.util.AEFluidStack;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.util.helpers.ItemComparisonHelper;
|
||||
import appeng.util.item.AEItemStack;
|
||||
@@ -48,6 +51,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -57,6 +61,7 @@ import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.thread.SidedThreadGroups;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
|
||||
@@ -64,6 +69,7 @@ import java.security.InvalidParameterException;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
|
||||
/**
|
||||
@@ -516,29 +522,29 @@ public class Platform
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
//
|
||||
// public static String getModId( final IAEItemStack is )
|
||||
// {
|
||||
// if( is == null )
|
||||
// {
|
||||
// return "** Null";
|
||||
// }
|
||||
//
|
||||
// final String n = ( (AEItemStack) is ).getModID();
|
||||
// return n == null ? "** Null" : n;
|
||||
// }
|
||||
//
|
||||
// public static String getModId( final IAEFluidStack fs )
|
||||
// {
|
||||
// if( fs == null || fs.getFluidStack() == null )
|
||||
// {
|
||||
// return "** Null";
|
||||
// }
|
||||
//
|
||||
// final ResourceLocation n = ForgeRegistries.FLUIDS.getKey( fs.getFluidStack().getFluid() );
|
||||
// return n == null ? "** Null" : n.getNamespace(); // FIXME: Check if namespace == mod
|
||||
// }
|
||||
//
|
||||
|
||||
public static String getModId( final IAEItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
return "** Null";
|
||||
}
|
||||
|
||||
final String n = ( (AEItemStack) is ).getModID();
|
||||
return n == null ? "** Null" : n;
|
||||
}
|
||||
|
||||
public static String getModId( final IAEFluidStack fs )
|
||||
{
|
||||
if( fs == null || fs.getFluidStack() == null )
|
||||
{
|
||||
return "** Null";
|
||||
}
|
||||
|
||||
final ResourceLocation n = ForgeRegistries.FLUIDS.getKey( fs.getFluidStack().getFluid() );
|
||||
return n == null ? "** Null" : n.getNamespace(); // FIXME: Check if namespace == mod
|
||||
}
|
||||
|
||||
public static String getItemDisplayName( final Object o )
|
||||
{
|
||||
if( o == null )
|
||||
@@ -578,34 +584,34 @@ public class Platform
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// public static String getFluidDisplayName( Object o )
|
||||
// {
|
||||
// if( o == null )
|
||||
// {
|
||||
// return "** Null";
|
||||
// }
|
||||
// FluidStack fluidStack = null;
|
||||
// if( o instanceof AEFluidStack )
|
||||
// {
|
||||
// fluidStack = ( (AEFluidStack) o ).getFluidStack();
|
||||
// }
|
||||
// else if( o instanceof FluidStack )
|
||||
// {
|
||||
// fluidStack = (FluidStack) o;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return "**Invalid Object";
|
||||
// }
|
||||
// // FIXME: Check that this is truly translated
|
||||
// String n = fluidStack.getDisplayName().getString();
|
||||
// if( n == null || "".equalsIgnoreCase( n ) )
|
||||
// {
|
||||
// n = fluidStack.getTranslationKey();
|
||||
// }
|
||||
// return n == null ? "** Null" : n;
|
||||
// }
|
||||
|
||||
public static String getFluidDisplayName( Object o )
|
||||
{
|
||||
if( o == null )
|
||||
{
|
||||
return "** Null";
|
||||
}
|
||||
FluidStack fluidStack = null;
|
||||
if( o instanceof AEFluidStack)
|
||||
{
|
||||
fluidStack = ( (AEFluidStack) o ).getFluidStack();
|
||||
}
|
||||
else if( o instanceof FluidStack )
|
||||
{
|
||||
fluidStack = (FluidStack) o;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "**Invalid Object";
|
||||
}
|
||||
// FIXME: Check that this is truly translated
|
||||
String n = fluidStack.getDisplayName().getString();
|
||||
if( n == null || "".equalsIgnoreCase( n ) )
|
||||
{
|
||||
n = fluidStack.getTranslationKey();
|
||||
}
|
||||
return n == null ? "** Null" : n;
|
||||
}
|
||||
|
||||
public static boolean isWrench(final PlayerEntity player, final ItemStack eq, final BlockPos pos )
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.util.inv;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import appeng.core.Api;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -37,24 +37,6 @@ public class WrapperInvItemHandler implements IInventory
|
||||
this.inv = inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
@@ -132,24 +114,6 @@ public class WrapperInvItemHandler implements IInventory
|
||||
return this.inv.isItemValid( index, stack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField( int id )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField( int id, int value )
|
||||
{
|
||||
// NOP
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user