Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Aug 18, 2024
1 parent dd4514c commit 4c85a03
Show file tree
Hide file tree
Showing 21 changed files with 527 additions and 72 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ catch (Exception ignored) {

// Pulls version first from the VERSION env and then git tag
String identifiedVersion = null
String versionOverride = '0.0.18p8'
String versionOverride = '0.0.18p9'
try {
// Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/reobf/proghatches/eucrafting/IEUManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface IDrain {
public default boolean isP2POut() {
return false;
}

public boolean allowOvercommit();
public long getVoltage();

public default long inject(long a, long v) {
Expand Down
123 changes: 74 additions & 49 deletions src/main/java/reobf/proghatches/eucrafting/PartEUP2PInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import reobf.proghatches.eucrafting.IEUManager.IDrain;
import reobf.proghatches.eucrafting.TileFluidInterface_EU.SISOPatternDetail;
import reobf.proghatches.eucrafting.TileFluidInterface_EU.WrappedPatternDetail;
import reobf.proghatches.gt.metatileentity.util.IInputStateProvider;
import reobf.proghatches.gt.metatileentity.util.IRecipeProcessingAwareDualHatch;
import reobf.proghatches.lang.LangManager;
import reobf.proghatches.main.MyMod;
import reobf.proghatches.util.ProghatchesUtil;
Expand Down Expand Up @@ -132,6 +134,7 @@
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.modularui.widget.CoverCycleButtonWidget;
import gregtech.common.tileentities.machines.IDualInputHatch;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.item.IC2Items;
import ic2.core.Ic2Items;
Expand Down Expand Up @@ -559,6 +562,31 @@ public TileEntity getTargetInv(){

return te;
}
public IMetaTileEntity getTargetTile0(){
if((duty&0b100)>0){return null;}
TileEntity te;
if(data!=null){
DimensionalCoord pos = data.getPos();
te= data.getTile().getWorldObj().getTileEntity(pos.x,pos.y,pos.z);
}else{
int x=this.host.getTile().xCoord;
int y=this.host.getTile().yCoord;
int z=this.host.getTile().zCoord;
ForgeDirection fd = this.getSide();
te=this.host.getTile().getWorldObj().getTileEntity(
x+fd.offsetX,y+fd.offsetY,z+fd.offsetZ);
}
if(te==null)
return null;

if(te instanceof IGregTechTileEntity){
IMetaTileEntity mte = ((IGregTechTileEntity) te).getMetaTileEntity();
return mte;
}
return null;

}
@Deprecated
public IMetaTileEntity getTargetTile(){
if((duty&0b100)>0){return null;}
TileEntity te;
Expand Down Expand Up @@ -621,64 +649,58 @@ public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall)
try {
this.getOutputs().forEach(all::add);
} catch (GridAccessException e) {}
//phase0
for(PartEUP2PInterface part:all){
boolean order=part.pushtick==getTick();
if(part.pass==-1&&!order){
part.pass=0;
}

if(part.pass==0){
IMetaTileEntity t = part.getTargetTile();
if(t!=null&&t instanceof IIdleStateProvider){
if(((IIdleStateProvider) t).failThisTick()){
if(part.fails++==0){part.pass=1;if(part.passReason==0)part.passReason=2;};//fail 1 time, assume no valid inputs, just pass it

/*if(pass<=0){
ok=true;
for(PartEUP2PInterface t:all){
IMetaTileEntity te = t.getTargetTile0();
if(te instanceof IDualInputHatch){
if(((IDualInputHatch) te).getFirstNonEmptyInventory().isPresent()){
ok=false;
}
}else{
dummy.add(part);
if(te instanceof IInputStateProvider){
if(false==((IInputStateProvider) te).isInputEmpty())
ok=false;
}
}
}
}
//phase1
boolean allok=all.stream().filter(s->!dummy.contains(s)).map(s->s.pass==1).reduce(Boolean::logicalAnd).orElse(false);
if(allok){
ok=true;
all.forEach(s->s.pass=2);
if(ok)pass=2;
}
*/



}


/*if (!this.isOutput()) {
boolean[] hasFail=new boolean[1];
all.add(this);
try {
this.getOutputs().forEach(all::add);
} catch (GridAccessException e) {}
all.forEach(s->{
IMetaTileEntity t = s.getTargetTile();
if(t!=null&&t instanceof IIdleStateProvider){
if(((IIdleStateProvider) t).failThisTick()){
if(s.fails++==0){s.pass=true;};//fail 2 times, so assume no valid inputs, just pass it
if(2>1){
//phase0
for(PartEUP2PInterface part:all){
boolean order=part.pushtick==getTick();
if(part.pass==-1&&!order){
part.pass=0;
}

if(part.pass==0){
IMetaTileEntity t = part.getTargetTile();
if(t!=null&&t instanceof IIdleStateProvider){
if(((IIdleStateProvider) t).failThisTick()){
if(part.fails++==0){part.pass=1;if(part.passReason==0)part.passReason=2;};//fail 1 time, assume no valid inputs, just pass it
}
}else{
dummy.add(part);
}
}
}
//phase1
boolean allok=all.stream().filter(s->!dummy.contains(s)).map(s->s.pass==1).reduce(Boolean::logicalAnd).orElse(false);
if(allok){
ok=true;
all.forEach(s->s.pass=2);
}
//if(!(!prev_pass&&pass))
if(!pass)
{hasFail[0]=true;}
}
});
}


if(!hasFail[0]&&amp>0){ok=true;}

}
*/

}



Expand Down Expand Up @@ -1011,7 +1033,7 @@ public void addCraftingOption(ICraftingMedium medium, ICraftingPatternDetails ap
TileFluidInterface_EU.wrap(api, a, b, Integer.MAX_VALUE - 1));

} else {
craftingTracker.addCraftingOption(medium, api);
craftingTracker.addCraftingOption(PartEUP2PInterface.this/*medium*/, api);
}
}

Expand Down Expand Up @@ -1898,4 +1920,7 @@ public void complete() {

}
public long getAmp(){return this.amp;};
public boolean allowOvercommit() {
return true;
}
}
46 changes: 45 additions & 1 deletion src/main/java/reobf/proghatches/eucrafting/PartEUSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IInterfaceViewable;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.BusRenderHelper;
Expand Down Expand Up @@ -66,6 +67,7 @@
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand All @@ -76,13 +78,16 @@
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import reobf.proghatches.eucrafting.IEUManager.ISource;
import reobf.proghatches.gt.metatileentity.ProgrammingCircuitProvider;
import reobf.proghatches.gt.metatileentity.ProgrammingCircuitProvider.CircuitProviderPatternDetial;
import reobf.proghatches.gt.metatileentity.util.ArrayListInv;
import reobf.proghatches.gt.metatileentity.util.FakePatternInv;
import reobf.proghatches.lang.LangManager;
import reobf.proghatches.main.MyMod;
import reobf.proghatches.util.ProghatchesUtil;

public class PartEUSource extends AEBasePart
implements IGuiProvidingPart, ICraftingProvider, IGridTickable, IInstantCompletable, IPartGT5Power, ISource,ILazer {
implements IGuiProvidingPart, ICraftingProvider, IGridTickable, IInstantCompletable, IPartGT5Power, ISource,ILazer,IInterfaceViewable {

public static class WailaDataProvider extends BasePartWailaDataProvider {

Expand Down Expand Up @@ -984,5 +989,44 @@ public ForgeDirection getLazerDir() {
public List<ILazer> getLazerP2POuts() {
return null;
}

@Override
public int rows() {
// TODO Auto-generated method stub
return 0;
}

@Override
public int rowSize() {
// TODO Auto-generated method stub
return 0;
}

@Override
public IInventory getPatterns() {

return ProgrammingCircuitProvider.EMPTY;//new ArrayListInv(ImmutableList.of(buildToken(1)));
}



@Override
public boolean shouldDisplay() {

return false;
}


@Override
public TileEntity getTileEntity() {

return getTile();
}

@Override
public String getName() {

return "";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import reobf.proghatches.eucrafting.IEUManager.IDrain;
import reobf.proghatches.eucrafting.TileFluidInterface_EU.SISOPatternDetail;
import reobf.proghatches.eucrafting.TileFluidInterface_EU.WrappedPatternDetail;
import reobf.proghatches.gt.metatileentity.util.IDisallowOptimize;
import reobf.proghatches.lang.LangManager;
import reobf.proghatches.main.MyMod;
import reobf.proghatches.util.ProghatchesUtil;
Expand Down Expand Up @@ -558,7 +559,7 @@ public static ICraftingPatternDetails wrap(ICraftingPatternDetails d, ItemStack
return new WrappedPatternDetail(d, extraIn, extraOut, priority);
}

public static class WrappedPatternDetail implements ICraftingPatternDetails {
public static class WrappedPatternDetail implements ICraftingPatternDetails,IDisallowOptimize {
@Override
public boolean equals(Object obj) {
if (obj == null) {
Expand Down Expand Up @@ -694,7 +695,7 @@ public void setPriority(int priority) {
}
}

public static class SISOPatternDetail implements ICraftingPatternDetails {
public static class SISOPatternDetail implements ICraftingPatternDetails,IDisallowOptimize {

public SISOPatternDetail(ItemStack in, ItemStack out) {
Objects.requireNonNull(in);
Expand Down Expand Up @@ -830,7 +831,7 @@ public void addCraftingOption(ICraftingMedium medium, ICraftingPatternDetails ap
wrap(api, a, b, Integer.MAX_VALUE - 1));

} else {
craftingTracker.addCraftingOption(medium, api);
craftingTracker.addCraftingOption(TileFluidInterface_EU.this/*medium*/, api);
}
}

Expand Down Expand Up @@ -1202,4 +1203,7 @@ protected ItemStack getItemFromTile(Object obj) {
return getCrafterIcon();
}
public long getAmp(){return this.amp;};
public boolean allowOvercommit() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
import mcp.mobius.waila.api.IWailaDataAccessor;
import reobf.proghatches.gt.metatileentity.util.BaseSlotPatched;
import reobf.proghatches.gt.metatileentity.util.FirstObjectHolder;
import reobf.proghatches.gt.metatileentity.util.IInputStateProvider;
import reobf.proghatches.gt.metatileentity.util.IRecipeProcessingAwareDualHatch;
import reobf.proghatches.gt.metatileentity.util.ListeningFluidTank;
import reobf.proghatches.gt.metatileentity.util.MappingItemHandler;
Expand All @@ -112,7 +113,7 @@
import reobf.proghatches.main.MyMod;
import reobf.proghatches.util.ProghatchesUtil;

public class BufferedDualInputHatch extends DualInputHatch implements IRecipeProcessingAwareDualHatch {
public class BufferedDualInputHatch extends DualInputHatch implements IRecipeProcessingAwareDualHatch,IInputStateProvider {
public Deque<Long> scheduled=new LinkedList<>();//no randomaccess, LinkedList will work fine


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static net.minecraft.util.StatCollector.translateToLocal;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;

Expand Down Expand Up @@ -41,7 +42,7 @@
import net.minecraftforge.fluids.FluidStack;
import reobf.proghatches.gt.metatileentity.util.IMEStorageChangeAwareness;
import reobf.proghatches.main.registration.Registration;
import scala.actors.threadpool.Arrays;


public class DataHatchME extends GT_MetaTileEntity_Hatch_DataAccess implements IPowerChannelState,IGridProxyable,IMEStorageChangeAwareness{
public DataHatchME(int aID, String aName, String aNameRegional) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,4 +863,9 @@ public IGridNode getActionableNode() {
return this.getGridNode(ForgeDirection.UP);
}
public Object getTile(){return this.getBaseMetaTileEntity();}
@Override
public boolean allowsPatternOptimization() {
// TODO Auto-generated method stub
return IInterfaceViewable.super.allowsPatternOptimization();
}
}
Loading

0 comments on commit 4c85a03

Please sign in to comment.