diff --git a/dependencies.gradle b/dependencies.gradle index c39675f..7223a8e 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -34,7 +34,7 @@ * For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph */ dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.99:dev'){ transitive = false } + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.123-pre:dev'){ transitive = false } api("com.github.GTNewHorizons:StructureLib:1.4.0:dev") api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") diff --git a/src/main/java/reobf/proghatches/eucrafting/AECover.java b/src/main/java/reobf/proghatches/eucrafting/AECover.java index 9700e4f..0578275 100644 --- a/src/main/java/reobf/proghatches/eucrafting/AECover.java +++ b/src/main/java/reobf/proghatches/eucrafting/AECover.java @@ -640,7 +640,7 @@ public void chunkUnload(Data t) { public void placeCover(ForgeDirection side, ItemStack aCover, ICoverable aTileEntity) { super.placeCover(side, aCover, aTileEntity); - Data data = ((Data) aTileEntity.getComplexCoverDataAtSide(side)); + Data data = ((Data) aTileEntity.getCoverInfoAtSide(side).getCoverData()); data.setTag(aCover.getTagCompound()); data.accept(side, aTileEntity, false); @@ -649,7 +649,7 @@ public void placeCover(ForgeDirection side, ItemStack aCover, ICoverable aTileEn @Override public void onPlayerAttach(EntityPlayer player, ItemStack aCover, ICoverable aTileEntity, ForgeDirection side) { - Data data = (Data) aTileEntity.getComplexCoverDataAtSide(side); + Data data = (Data) aTileEntity.getCoverInfoAtSide(side).getCoverData(); data.getProxy() .setOwner(player); } @@ -933,7 +933,7 @@ public ModularWindow createWindow(CoverUIBuildContext buildContext) { return new AECoverUIFactory( buildContext, ((Data) buildContext.getTile() - .getComplexCoverDataAtSide(buildContext.getCoverSide()))).createWindow(); + .getCoverInfoAtSide(buildContext.getCoverSide()).getCoverData())).createWindow(); } private class AECoverUIFactory extends UIFactory { diff --git a/src/main/java/reobf/proghatches/eucrafting/BridgingData.java b/src/main/java/reobf/proghatches/eucrafting/BridgingData.java index a670d43..c57a7fb 100644 --- a/src/main/java/reobf/proghatches/eucrafting/BridgingData.java +++ b/src/main/java/reobf/proghatches/eucrafting/BridgingData.java @@ -136,7 +136,7 @@ public void update(ICoverable aTileEntity) { for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { if (side == this.side) continue; - ISerializableObject obj = aTileEntity.getComplexCoverDataAtSide(side); + ISerializableObject obj = aTileEntity.getCoverInfoAtSide(side).getCoverData(); IGridNode thenode = null; if (obj instanceof Data) thenode = ((Data) obj).getGridNode(side); if (thenode == null) { @@ -154,7 +154,7 @@ public void update(ICoverable aTileEntity) { .getWorld() .getTileEntity(npos.x, npos.y, npos.z)) .map(s -> s instanceof ICoverable ? (ICoverable) s : null) - .map(s -> s.getComplexCoverDataAtSide(side.getOpposite())) + .map(s -> s.getCoverInfoAtSide(side.getOpposite()).getCoverData()) .map(s -> s instanceof Data ? (Data) s : null) .map( s -> s.getProxy() diff --git a/src/main/java/reobf/proghatches/gt/cover/LevelControlCover.java b/src/main/java/reobf/proghatches/gt/cover/LevelControlCover.java index 18c9612..06d7c4b 100644 --- a/src/main/java/reobf/proghatches/gt/cover/LevelControlCover.java +++ b/src/main/java/reobf/proghatches/gt/cover/LevelControlCover.java @@ -349,7 +349,7 @@ protected Data doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int a } if (grid == null) { for (ForgeDirection fd : ForgeDirection.VALID_DIRECTIONS) { - ISerializableObject dat = aTileEntity.getComplexCoverDataAtSide(fd); + ISerializableObject dat = aTileEntity.getCoverInfoAtSide(fd).getCoverData(); if (dat instanceof AECover.Data) { AECover.Data ae = (reobf.proghatches.eucrafting.AECover.Data) dat; grid = ae.getProxy(); @@ -383,7 +383,13 @@ protected Data doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int a boolean ok = (aCoverVariable.invert ? amount <= aCoverVariable.amount : amount >= aCoverVariable.amount); if (aTileEntity instanceof IMachineProgress) { - ((IMachineProgress) aTileEntity).setAllowedToWork(ok); + + boolean allowedToWork = ok; + if (allowedToWork) { + ((IMachineProgress) aTileEntity).enableWorking(); + } else { + ((IMachineProgress) aTileEntity).disableWorking(); + } } return aCoverVariable; diff --git a/src/main/java/reobf/proghatches/gt/cover/LinkedBusSlaveCover.java b/src/main/java/reobf/proghatches/gt/cover/LinkedBusSlaveCover.java index 70c85b9..c6e4252 100644 --- a/src/main/java/reobf/proghatches/gt/cover/LinkedBusSlaveCover.java +++ b/src/main/java/reobf/proghatches/gt/cover/LinkedBusSlaveCover.java @@ -46,7 +46,7 @@ public boolean isCoverPlaceable(ForgeDirection side, ItemStack aStack, ICoverabl .filter(s -> s instanceof MTELinkedInputBus) .isPresent()) return false; for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { - CoverBehaviorBase beh = aTileEntity.getCoverBehaviorAtSideNew(d); + CoverBehaviorBase beh = aTileEntity.getCoverInfoAtSide(d).getCoverBehavior(); if (beh != null && beh.getClass() == ProgrammingCover.class) { return false; } diff --git a/src/main/java/reobf/proghatches/gt/cover/ProgrammingCover.java b/src/main/java/reobf/proghatches/gt/cover/ProgrammingCover.java index 344c446..fe78e29 100644 --- a/src/main/java/reobf/proghatches/gt/cover/ProgrammingCover.java +++ b/src/main/java/reobf/proghatches/gt/cover/ProgrammingCover.java @@ -110,7 +110,7 @@ public boolean isCoverPlaceable(ForgeDirection side, ItemStack aStack, ICoverabl .isPresent()) return false; for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { - CoverBehaviorBase beh = aTileEntity.getCoverBehaviorAtSideNew(d); + CoverBehaviorBase beh = aTileEntity.getCoverInfoAtSide(d).getCoverBehavior(); if (beh != null && beh.getClass() == LinkedBusSlaveCover.class) { return false; } diff --git a/src/main/java/reobf/proghatches/gt/cover/WirelessControlCover.java b/src/main/java/reobf/proghatches/gt/cover/WirelessControlCover.java index 4622d2b..c701250 100644 --- a/src/main/java/reobf/proghatches/gt/cover/WirelessControlCover.java +++ b/src/main/java/reobf/proghatches/gt/cover/WirelessControlCover.java @@ -22,7 +22,7 @@ import gregtech.api.gui.modularui.CoverUIBuildContext; import gregtech.api.gui.modularui.GTUITextures; -import gregtech.api.interfaces.covers.IControlsWorkCover; + import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IMachineProgress; @@ -81,7 +81,7 @@ public Data doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCov if ((aInputRedstone > 0)) { if (!machine.isAllowedToWork()) machine.enableWorking(); } else if (machine.isAllowedToWork()) machine.disableWorking(); - machine.setWorkDataValue(aInputRedstone); + //machine.setWorkDataValue(aInputRedstone); } else if (d.crashed) { machine.disableWorking(); } else { @@ -289,7 +289,7 @@ public boolean onCoverRemovalImpl(ForgeDirection side, int aCoverID, Data aCover boolean aForced) { if ((aTileEntity instanceof IMachineProgress)) { ((IMachineProgress) aTileEntity).enableWorking(); - ((IMachineProgress) aTileEntity).setWorkDataValue((byte) 0); + // ((IMachineProgress) aTileEntity).setWorkDataValue((byte) 0); } return true; } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java index 42e71cc..048fe89 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java @@ -34,7 +34,9 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.MTEHatchDataAccess; import gregtech.api.render.TextureFactory; +import gregtech.api.util.AssemblyLineUtils; import gregtech.api.util.GTUtility; +import gregtech.api.util.GTRecipe.RecipeAssemblyLine; import reobf.proghatches.gt.metatileentity.util.IMEStorageChangeAwareness; import reobf.proghatches.main.registration.Registration; import tectech.thing.casing.BlockGTCasingsTT; @@ -145,6 +147,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { } private void updateCache() { + cachedRecipes=null; if ((!getProxy().isPowered()) || (!getProxy().isActive())) { inv = new ItemStack[] {}; return; @@ -307,13 +310,48 @@ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlaye private long lastupdate = -99999; - @Override + //@Override public List getInventoryItems(Predicate filter) { long thistick = ((BaseMetaTileEntity) this.getBaseMetaTileEntity()).mTickTimer; if (Math.abs(lastupdate - thistick) > 100) { updateCache(); lastupdate = thistick; } - return super.getInventoryItems(filter); + return super_getInventoryItems(filter); + } + public List super_getInventoryItems(Predicate filter) { + ArrayList items = new ArrayList(); + IGregTechTileEntity te = this.getBaseMetaTileEntity(); + + for(int i = 0; i < te.getSizeInventory(); ++i) { + ItemStack slot = te.getStackInSlot(i); + if (slot != null && filter != null && filter.test(slot)) { + items.add(slot); + } + } + + return items; + } + + + List cachedRecipes; + public List getAssemblyLineRecipes() { + long thistick = ((BaseMetaTileEntity) this.getBaseMetaTileEntity()).mTickTimer; + if (Math.abs(lastupdate - thistick) > 100) { + updateCache(); + lastupdate = thistick; + } + if (cachedRecipes == null) { + cachedRecipes = new ArrayList<>(); + + for (int i = 0; i < getSizeInventory(); i++) { + cachedRecipes.addAll(AssemblyLineUtils.findALRecipeFromDataStick(getStackInSlot(i))); + } + } + + + return cachedRecipes; + + } } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java index 956f42c..27c4725 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java @@ -2666,9 +2666,9 @@ public Net getNetwork() { if (g == null) { Object optCover = this.getBaseMetaTileEntity() - .getComplexCoverDataAtSide( - this.getBaseMetaTileEntity() - .getFrontFacing()); + .getCoverInfoAtSide( this.getBaseMetaTileEntity() + .getFrontFacing()).getCoverData() + ; if (optCover instanceof AECover.Data) { IInterfaceHost iface = ((AECover.Data) optCover).getInterfaceOrNull(); diff --git a/src/main/java/reobf/proghatches/main/MyMod.java b/src/main/java/reobf/proghatches/main/MyMod.java index 3ed6508..6ad7ce2 100644 --- a/src/main/java/reobf/proghatches/main/MyMod.java +++ b/src/main/java/reobf/proghatches/main/MyMod.java @@ -493,11 +493,11 @@ public void playerInteract(final PlayerInteractEvent event) { ICoverable tileEntity = (ICoverable) te; for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - if (tileEntity.getCoverBehaviorAtSideNew(side) instanceof AECover) GTValues.NW.sendToPlayer( + if (tileEntity.getCoverInfoAtSide(side).getCoverBehavior() instanceof AECover) GTValues.NW.sendToPlayer( new GTPacketSendCoverData( side, tileEntity.getCoverIDAtSide(side), - tileEntity.getComplexCoverDataAtSide(side), + tileEntity.getCoverInfoAtSide(side).getCoverData(), tileEntity), (EntityPlayerMP) event.entityPlayer); @@ -512,7 +512,7 @@ public void playerInteract(final PlayerInteractEvent event) { .isPresent()) { IMemoryCardSensitive cv = Optional.ofNullable(event.world.getTileEntity(event.x, event.y, event.z)) .map(s -> s instanceof ICoverable ? (ICoverable) s : null) - .map(s -> s.getComplexCoverDataAtSide(ForgeDirection.getOrientation(event.face))) + .map(s -> s .getCoverInfoAtSide(ForgeDirection.getOrientation(event.face)).getCoverData()) .map(s -> s instanceof AECover.IMemoryCardSensitive ? (AECover.IMemoryCardSensitive) s : null) .orElse(null); @@ -607,7 +607,7 @@ public void breakBlock(BlockEvent.BreakEvent b) { if (te instanceof ICoverable) { ICoverable c = (ICoverable) te; for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - Optional.ofNullable(c.getComplexCoverDataAtSide(dir)) + Optional.ofNullable(c .getCoverInfoAtSide( dir).getCoverData()) .ifPresent(s -> { if (s instanceof AECover.Data) { ((AECover.Data) s).destroy(); diff --git a/src/main/java/reobf/proghatches/main/asm/ASMCallbacks.java b/src/main/java/reobf/proghatches/main/asm/ASMCallbacks.java index 40a8d14..fbe84ec 100644 --- a/src/main/java/reobf/proghatches/main/asm/ASMCallbacks.java +++ b/src/main/java/reobf/proghatches/main/asm/ASMCallbacks.java @@ -1,5 +1,6 @@ package reobf.proghatches.main.asm; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.CommonMetaTileEntity; import reobf.proghatches.oc.IActualEnvironment; @@ -9,7 +10,7 @@ public static boolean checkIsRealEnvironment(Object o) { if (o instanceof CommonMetaTileEntity) { - CommonMetaTileEntity mte = (CommonMetaTileEntity) o; + IGregTechTileEntity mte = (IGregTechTileEntity) o; if (mte.getMetaTileEntity() instanceof IActualEnvironment) { return o instanceof li.cil.oc.api.network.Environment; diff --git a/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAE2FCCompat.java b/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAE2FCCompat.java index 9083c60..1650833 100644 --- a/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAE2FCCompat.java +++ b/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAE2FCCompat.java @@ -73,7 +73,7 @@ private static boolean check(TileEntity te, ForgeDirection face) { if (te instanceof ICoverable) { ICoverable c = (ICoverable) te; - ISerializableObject data = c.getComplexCoverDataAtSide(face); + ISerializableObject data = c.getCoverInfoAtSide( face).getCoverData(); if (data instanceof AECover.Data) { return ((AECover.Data) data).supportFluid(); } diff --git a/src/main/java/reobf/proghatches/main/mixin/mixins/MixinHandleProgrammingOnRecipeStart.java b/src/main/java/reobf/proghatches/main/mixin/mixins/MixinHandleProgrammingOnRecipeStart.java index e522bce..dc72aa6 100644 --- a/src/main/java/reobf/proghatches/main/mixin/mixins/MixinHandleProgrammingOnRecipeStart.java +++ b/src/main/java/reobf/proghatches/main/mixin/mixins/MixinHandleProgrammingOnRecipeStart.java @@ -28,7 +28,7 @@ public MTEHatchInputBus startRecipeProcessing(MTEHatchInputBus a) { Arrays.stream(ForgeDirection.VALID_DIRECTIONS) .map( s -> bus.getBaseMetaTileEntity() - .getCoverBehaviorAtSideNew(s)) + .getCoverInfoAtSide(s).getCoverBehavior()) .filter(Objects::nonNull) .filter(s -> s instanceof IProgrammer) .forEach(s -> ((IProgrammer) s).impl(bus.getBaseMetaTileEntity()));; diff --git a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java index c6b9ba8..15b7714 100644 --- a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java +++ b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java @@ -47,6 +47,7 @@ import gregtech.api.util.GTRecipeBuilder; import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.GTUtility; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import reobf.proghatches.item.ItemProgrammingCircuit; import reobf.proghatches.main.Config; import reobf.proghatches.main.MyMod; @@ -2007,7 +2008,22 @@ public void run() { CraftingManager.getInstance() .getRecipeList() .add(recx); - + + GTValues.RA.stdBuilder() + .itemInputs( + GregtechItemList.Hatch_Reservoir.get(1), + new ItemStack( + GregTechAPI.sBlockMachines, + 1, + Config.metaTileEntityOffset + Registration.CircuitProviderOffsetT0) + ) + .itemOutputs( new ItemStack( + GregTechAPI.sBlockMachines, + 1, + Config.metaTileEntityOffset + Registration.WaterProviderOffset)) + .duration(1 * SECONDS) + .eut(30) + .addTo(RecipeMaps.assemblerRecipes); /* * rec = new ShapelessOreRecipe( new ItemStack( MyMod.plunger,1,1), * ItemEnum.BOOSTER_CARD.getStack(0),