Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Feb 9, 2025
1 parent 81496bf commit 0c409cf
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/reobf/proghatches/eucrafting/AECover.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/reobf/proghatches/eucrafting/BridgingData.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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()
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/reobf/proghatches/gt/cover/LevelControlCover.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
42 changes: 40 additions & 2 deletions src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -307,13 +310,48 @@ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlaye

private long lastupdate = -99999;

@Override
//@Override
public List<ItemStack> getInventoryItems(Predicate<ItemStack> 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<RecipeAssemblyLine> cachedRecipes;
public List<RecipeAssemblyLine> 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;


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/reobf/proghatches/main/MyMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/reobf/proghatches/main/asm/ASMCallbacks.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));;
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/reobf/proghatches/main/registration/PHRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 0c409cf

Please sign in to comment.