diff --git a/src/main/java/reobf/proghatches/ae/part2/PartRequestTunnel.java b/src/main/java/reobf/proghatches/ae/part2/PartRequestTunnel.java index 3e28d5d..bc780ec 100644 --- a/src/main/java/reobf/proghatches/ae/part2/PartRequestTunnel.java +++ b/src/main/java/reobf/proghatches/ae/part2/PartRequestTunnel.java @@ -54,24 +54,13 @@ public class PartRequestTunnel extends PartBasicState implements ICraftingMachinePart,ISidedInventory,IFluidHandler,IGridTickable{ - public static class WailaDataProvider implements IPartWailaDataProvider { - - @Override - public ItemStack getWailaStack(IPart part, IWailaConfigHandler config, ItemStack partStack) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getWailaHead(IPart part, List currentToolTip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { - // TODO Auto-generated method stub - return null; - } + public static class WailaDataProvider extends appeng.integration.modules.waila.part.BasePartWailaDataProvider { + @Override public List getWailaBody(IPart part, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + if(!(part instanceof PartRequestTunnel)){return currenttip;} try{ /*if( accessor.getSide()==((TileRequestTunnel)accessor.getTileEntity()).getUp().getOpposite()){ @@ -86,12 +75,14 @@ public List getWailaBody(IPart part, List currenttip, IWailaData ArrayList cacheR=new ArrayList<>(); { NBTTagList t= (NBTTagList) data.getTag("cacheR"); - for(int i=0;i cacheFR=new ArrayList<>(); { NBTTagList t= (NBTTagList) data.getTag("cacheFR"); + if(t!=null) for(int i=0;i getWailaBody(IPart part, List currenttip, IWailaData }); NavigableMap waiting=new TreeMap<>(); NBTTagList t= (NBTTagList) data.getTag("waiting"); + if(t!=null) for(int i=0;i getWailaBody(IPart part, List currenttip, IWailaData return currenttip; } - @Override - public List getWailaTail(IPart part, List currentToolTip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { - // TODO Auto-generated method stub - return null; - } + @Override public NBTTagCompound getNBTData(EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound data, World world, int x, int y, int z) { + + if(!(part instanceof PartRequestTunnel)){return data;} PartRequestTunnel thiz= (PartRequestTunnel) part; { NBTTagList listR=new NBTTagList(); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java index ef0c387..e86b8a8 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java @@ -1581,6 +1581,7 @@ public int compareTo(PiorityBuffer o) { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Optional getFirstNonEmptyInventory() { + if(!this.isValid())return Optional.empty(); markDirty(); dirty = true; @@ -1610,6 +1611,7 @@ public List inventoriesReal() { } @Override public Iterator inventories() { + if(!this.isValid())return emptyItr; markDirty(); dirty = true; diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputBusME.java b/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputBusME.java index 896e6de..ff44cc9 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputBusME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputBusME.java @@ -632,10 +632,7 @@ public void loadNBTData(NBTTagCompound aNBT) { } - @Override - public Supplier lookup() { - return ()->MethodHandles.lookup(); - } + @Override public boolean impl_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { @@ -681,4 +678,22 @@ public boolean pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { public String getCopiedDataIdentifier(EntityPlayer player) { return IDataCopyablePlaceHolderSuper.super.getCopiedDataIdentifier(player); } + + @Override + public NBTTagCompound super_getCopiedData(EntityPlayer player) { + + return super.getCopiedData(player); + } + + @Override + public String super_getCopiedDataIdentifier(EntityPlayer player) { + + return super.getCopiedDataIdentifier(player); + } + + @Override + public boolean super_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { + + return super.pasteCopiedData(player, nbt); + } } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputHatchME.java index 66a3d2d..36b15d2 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputHatchME.java @@ -540,10 +540,7 @@ public void loadNBTData(NBTTagCompound aNBT) { reserveFirst=aNBT.getBoolean("reserveFirst"); super.loadNBTData(aNBT); } -@Override -public Supplier lookup() { - return ()->MethodHandles.lookup(); -} + @Override public boolean impl_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { if(nbt.hasKey("reserveFirst"))reserveFirst=nbt.getBoolean("reserveFirst"); @@ -566,4 +563,21 @@ public boolean pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { public String getCopiedDataIdentifier(EntityPlayer player) { return IDataCopyablePlaceHolderSuper.super.getCopiedDataIdentifier(player); } +@Override +public NBTTagCompound super_getCopiedData(EntityPlayer player) { + + return super.getCopiedData(player); +} + +@Override +public String super_getCopiedDataIdentifier(EntityPlayer player) { + + return super.getCopiedDataIdentifier(player); +} + +@Override +public boolean super_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { + + return super.pasteCopiedData(player, nbt); +} } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java index fc5a26a..0679036 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java @@ -865,7 +865,7 @@ public boolean justUpdated() { } @SuppressWarnings("rawtypes") - final static Iterator emptyItr = new Iterator() { + public final static Iterator emptyItr = new Iterator() { public boolean hasNext() { return false; @@ -879,6 +879,7 @@ public Object next() { @SuppressWarnings("unchecked") @Override public Iterator inventories() { + if(!this.isValid())return emptyItr; if (theInv.isEmpty()) return emptyItr; return Arrays.asList(theInv).iterator(); @@ -889,6 +890,7 @@ public List inventoriesReal() { } @Override public Optional getFirstNonEmptyInventory() { + if(!this.isValid())return Optional.empty(); boolean empty = true; for (FluidStack f : theInv.getFluidInputs()) { @@ -932,7 +934,7 @@ public boolean isEmpty() { return false; } } - for (ItemStack i : getItemInputs()) { + for (ItemStack i : mInventory/*getItemInputs()*/) { if (i != null && i.stackSize > 0) { return false; @@ -2280,13 +2282,30 @@ public FluidStack[] getDisplayFluid(){ all.addAll(markedFluid); all.removeIf(Objects::isNull); return all.toArray(new FluidStack[0]);} + + private void broken(){ + MyMod.LOG.fatal("FAILED TO UPDATE ME INPUTS!"); + MyMod.LOG.fatal("basemeta:"+getBaseMetaTileEntity()); + + if(getBaseMetaTileEntity()!=null){ + MyMod.LOG.fatal("same:"+(getBaseMetaTileEntity().getMetaTileEntity()==DualInputHatch.this)+ + ("valid:"+DualInputHatch.this.isValid())+ + ("x:"+getBaseMetaTileEntity().getXCoord())+ + ("y:"+getBaseMetaTileEntity().getYCoord())+ + ("z:"+getBaseMetaTileEntity().getZCoord())); + + } + + + + } public ItemStack[] getItems(){ ArrayList all=new ArrayList<>(); all.addAll(circuitInv); all.add(mInventory[getCircuitSlot()]); if(recipe==false){ - MyMod.LOG.fatal("broken"); - Thread.dumpStack(); + broken(); + //Thread.dumpStack(); broken=true; all.removeIf(Objects::isNull); return all.toArray(new ItemStack[0]); @@ -2298,8 +2317,8 @@ public ItemStack[] getItems(){ public FluidStack[] getFluid(){ if(recipe==false){ - MyMod.LOG.fatal("broken"); - Thread.dumpStack(); + broken(); + //Thread.dumpStack(); broken=true; return new FluidStack[0]; } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatchSlave.java b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatchSlave.java index a3d5942..8e676db 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatchSlave.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatchSlave.java @@ -158,11 +158,13 @@ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex @Override public Iterator inventories() { + if(!this.isValid())return DualInputHatch.emptyItr; return getMaster() != null ? getMaster().inventories() : Collections.emptyIterator(); } @Override public Optional getFirstNonEmptyInventory() { + if(!this.isValid())return Optional.empty(); return getMaster() != null ? getMaster().getFirstNonEmptyInventory() : Optional.empty(); } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java index e6edc89..279bc39 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java @@ -208,10 +208,22 @@ public PriorityFilterInputBusME newMetaEntity(IGregTechTileEntity aTileEntity) { } @Override - public Supplier lookup() { - return ()->MethodHandles.lookup(); + public NBTTagCompound super_getCopiedData(EntityPlayer player) { + + return super.getCopiedData(player); + } + + @Override + public String super_getCopiedDataIdentifier(EntityPlayer player) { + + return super.getCopiedDataIdentifier(player); } + @Override + public boolean super_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { + + return super.pasteCopiedData(player, nbt); + } @Override public boolean impl_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { if(nbt.hasKey("filter"))filter=nbt.getInteger("filter"); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java index 99f3bde..ce15dc4 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java @@ -226,8 +226,21 @@ public String getCopiedDataIdentifier(EntityPlayer player) { return super_getCopiedDataIdentifier(player,()->MethodHandles.lookup()); }*/ @Override - public Supplier lookup() { - return ()->MethodHandles.lookup(); + public NBTTagCompound super_getCopiedData(EntityPlayer player) { + + return super.getCopiedData(player); + } + + @Override + public String super_getCopiedDataIdentifier(EntityPlayer player) { + + return super.getCopiedDataIdentifier(player); + } + + @Override + public boolean super_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { + + return super.pasteCopiedData(player, nbt); } @Override diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputBusME.java b/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputBusME.java index dce44ab..8b34871 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputBusME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputBusME.java @@ -502,8 +502,21 @@ public String getCopiedDataIdentifier(EntityPlayer player) { }*/ @Override -public Supplier lookup() { - return ()->MethodHandles.lookup(); +public NBTTagCompound super_getCopiedData(EntityPlayer player) { + + return super.getCopiedData(player); +} + +@Override +public String super_getCopiedDataIdentifier(EntityPlayer player) { + + return super.getCopiedDataIdentifier(player); +} + +@Override +public boolean super_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { + + return super.pasteCopiedData(player, nbt); } @Override diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputHatchME.java index afe2654..d4cca6e 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputHatchME.java @@ -366,8 +366,21 @@ public String getCopiedDataIdentifier(EntityPlayer player) { return super_getCopiedDataIdentifier(player,()->MethodHandles.lookup()); }*/ @Override -public Supplier lookup() { - return ()->MethodHandles.lookup(); +public NBTTagCompound super_getCopiedData(EntityPlayer player) { + + return super.getCopiedData(player); +} + +@Override +public String super_getCopiedDataIdentifier(EntityPlayer player) { + + return super.getCopiedDataIdentifier(player); +} + +@Override +public boolean super_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt) { + + return super.pasteCopiedData(player, nbt); } @Override diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/util/IDataCopyablePlaceHolder.java b/src/main/java/reobf/proghatches/gt/metatileentity/util/IDataCopyablePlaceHolder.java index 44ca45f..72df0a0 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/util/IDataCopyablePlaceHolder.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/util/IDataCopyablePlaceHolder.java @@ -9,10 +9,11 @@ import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; +import gregtech.api.interfaces.IDataCopyable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -public interface IDataCopyablePlaceHolder extends IFakeSuperInterface{ +public interface IDataCopyablePlaceHolder extends IDataCopyable{ NBTTagCompound getCopiedData(EntityPlayer player); default NBTTagCompound writeType(NBTTagCompound t,EntityPlayer player){ t.setString("type", this.getCopiedDataIdentifier(player)); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/util/IDataCopyablePlaceHolderSuper.java b/src/main/java/reobf/proghatches/gt/metatileentity/util/IDataCopyablePlaceHolderSuper.java index bfb38e6..401da3e 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/util/IDataCopyablePlaceHolderSuper.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/util/IDataCopyablePlaceHolderSuper.java @@ -13,9 +13,9 @@ import net.minecraft.nbt.NBTTagCompound; public interface IDataCopyablePlaceHolderSuper extends IDataCopyablePlaceHolder{ - Supplier lookup(); + //Supplier lookup(); default NBTTagCompound getCopiedData(EntityPlayer player){ - NBTTagCompound ret= impl_getCopiedData(player, super_getCopiedData(player, lookup())); + NBTTagCompound ret= impl_getCopiedData(player, super_getCopiedData(player)); ret.setString("type", getCopiedDataIdentifier(player)); return ret; @@ -25,9 +25,9 @@ default boolean pasteCopiedData(EntityPlayer player, NBTTagCompound nbt){ nbt=(NBTTagCompound) nbt.copy(); impl_pasteCopiedData(player, nbt); //conver to super id - nbt.setString("type",super_getCopiedDataIdentifier(player, lookup())); + nbt.setString("type",super_getCopiedDataIdentifier(player)); - return super_pasteCopiedData(player, nbt, lookup()); + return super_pasteCopiedData(player, nbt); } @@ -35,7 +35,7 @@ default boolean pasteCopiedData(EntityPlayer player, NBTTagCompound nbt){ NBTTagCompound impl_getCopiedData(EntityPlayer player,NBTTagCompound tag); //String impl_getCopiedDataIdentifier(EntityPlayer player); ////////// - default NBTTagCompound super_getCopiedData(EntityPlayer player,Supplier lp){ + abstract NBTTagCompound super_getCopiedData(EntityPlayer player);/*{ MethodHandle mh = getMH(2); if(mh==null){ try { @@ -55,8 +55,8 @@ default NBTTagCompound super_getCopiedData(EntityPlayer player,Supplier } catch (Throwable e) {e.printStackTrace(); throw new AssertionError(e); } - }; - default String super_getCopiedDataIdentifier(EntityPlayer player,Supplier lp){ + }; */ + abstract String super_getCopiedDataIdentifier(EntityPlayer player);/*{ MethodHandle mh = getMH(1); if(mh==null){ try { @@ -76,9 +76,9 @@ default String super_getCopiedDataIdentifier(EntityPlayer player,Supplier lp){ + abstract boolean super_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt);/*{ MethodHandle mh = getMH(3); if(mh==null){ try { @@ -98,10 +98,10 @@ default boolean super_pasteCopiedData(EntityPlayer player, NBTTagCompound nbt,Su } catch (Throwable e) {e.printStackTrace(); throw new AssertionError(e); } - }; - + }; */ + /* default public void setMH(MethodHandle MH,int index){ cache.put(getClass(), index, MH); @@ -112,5 +112,5 @@ default public MethodHandle getMH( int index){ }; -static Table cache=HashBasedTable.create(); +static Table cache=HashBasedTable.create();*/ } diff --git a/src/main/java/reobf/proghatches/main/asm/FMLPlugin.java b/src/main/java/reobf/proghatches/main/asm/FMLPlugin.java index f043a7b..46d787e 100644 --- a/src/main/java/reobf/proghatches/main/asm/FMLPlugin.java +++ b/src/main/java/reobf/proghatches/main/asm/FMLPlugin.java @@ -20,7 +20,7 @@ public String[] getASMTransformerClass() { AEItemTransformer.class.getName() , AEItemTransformer2.class.getName() , MUITransformer.class.getName(), - DataCopyableTransformer.class.getName(), + //DataCopyableTransformer.class.getName(), MFUTransformer.class.getName() };