Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Jan 24, 2025
1 parent 51cb986 commit 7595876
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dependencies {
api rfg.deobf("curse.maven:cofh-core-69162:2388751")
api("com.github.GTNewHorizons:Nuclear-Control:2.6.7:dev") { transitive = false }
api("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { transitive = false }
implementation("com.github.GTNewHorizons:Hodgepodge:2.6.0:dev")
//implementation("com.github.GTNewHorizons:Hodgepodge:2.6.0:dev")
api('com.github.GTNewHorizons:Botania:1.12.1-GTNH:dev') { transitive = false }
api('com.github.GTNewHorizons:HoloInventory:2.4.13-GTNH:dev') { transitive = false }
api rfg.deobf("curse.maven:extra-utilities-225561:2264384")
Expand Down
38 changes: 35 additions & 3 deletions src/main/java/reobf/proghatches/ae/TileRequestTunnel.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,43 @@ public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, A
}*/
AEItemStack left=null;

Long get = waiting.get((items));
if(get!=null){
long tmp;
waiting.put((AEItemStack) items,tmp=Math.max(0,get-items.getStackSize()));
if(tmp<=0)waiting.remove(items);

if((this.mode&1)!=0){
if(get<items.getStackSize()){//inject more than waiting for?
items=items.copy().setStackSize(get);//that's the part we need
left=(AEItemStack) items.copy();
left.decStackSize(get);//that's the rest
}
}


}else{
if((this.mode&1)!=0){

return items;//not waiting, just return items as unwanted
}

}




if(items.getItem() instanceof ItemFluidDrop){
cacheFR.add(ItemFluidDrop.getAeFluidStack(items).getFluidStack());
}else{
cacheR.add(items.getItemStack());

}
return null;


return left;
}

HashMap<StorageChannel,IMEInventory> inv=new HashMap();
Expand Down Expand Up @@ -507,7 +537,7 @@ public void jobStateChange(ICraftingLink link) {




if((mode&2)==0||last==null)
useExisting();
}
if(this.tick%40==2){
Expand Down Expand Up @@ -626,11 +656,13 @@ protected void fillStacksIntoFirstSlots( ArrayList<ItemStack> mInventory) {
}

}

int mode;
private void useExisting() {
for(Iterator<Entry<AEItemStack, Long>> itr = waiting.entrySet().iterator();itr.hasNext();){

Entry<AEItemStack, Long> e=itr.next();

if(e.getValue()<=0){itr.remove();continue;}

IAEItemStack val = e.getKey().copy().setStackSize(e.getValue());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,25 @@ private void post(){
//this.getProxy().getGrid().postEvent(new MENetworkCellArrayUpdate());
//this.getProxy().getGrid().postEvent(new MENetworkStorageEvent(handler0, StorageChannel.ITEMS));
try {

if(last!=null){
if(mInventory[0]!=null){
if(last.equals(mInventory[0])){
if(last.getStackSize()==mInventory[0].stackSize)
{return;}else{

this.getProxy().getStorage()
.postAlterationOfStoredItems(StorageChannel.ITEMS,
ImmutableList.of(last.copy().setStackSize(mInventory[0].stackSize-last.getStackSize()))
,new MachineSource(this));
last=AEItemStack.create(mInventory[0]);
return;
}
}

};


this.getProxy().getStorage()
.postAlterationOfStoredItems(StorageChannel.ITEMS,
ImmutableList.of(last.copy().setStackSize(-last.getStackSize()))
Expand All @@ -214,7 +231,7 @@ private void post(){
} catch (final GridAccessException ignore) {}
} catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
e.printStackTrace();
}

}/*
Expand Down Expand Up @@ -426,7 +443,10 @@ public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionS

@Override
public IAEItemStack extractItems(IAEItemStack input, Actionable type, BaseActionSource src) {
try{post();
try{

if(type!=Actionable.SIMULATE)post();

ItemStack in=input.getItemStack();
ItemStack thiz=mInventory[0];
if(thiz!=null&&!Platform.isSameItem(in, thiz))return null;
Expand Down
19 changes: 17 additions & 2 deletions src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,21 @@ private void post(){
try {

if(last!=null){
if(content.getFluid()!=null){
if(last.equals(content.getFluid())){
if(last.getStackSize()==content.getFluid().amount)
{return;}else{

this.getProxy().getStorage()
.postAlterationOfStoredItems(StorageChannel.FLUIDS,
ImmutableList.of(last.copy().setStackSize(content.getFluid().amount-last.getStackSize()))
,new MachineSource(this));
last=AEFluidStack.create(content.getFluid());
return;
}
}

};
this.getProxy().getStorage()
.postAlterationOfStoredItems(StorageChannel.FLUIDS,
ImmutableList.of(last.copy().setStackSize(-last.getStackSize()))
Expand All @@ -195,7 +210,7 @@ private void post(){

} catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
e.printStackTrace();
}

}/*
Expand Down Expand Up @@ -401,7 +416,7 @@ public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActio

@Override
public IAEFluidStack extractItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
post();
if(type!=Actionable.SIMULATE)post();
try{
if(content.getFluid()!=null&&content.getFluid().getFluid()!=input.getFluid()
){return null;}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/proghatches/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ item.emitterpattern.name.tooltip.0=A special pattern without inputs. Click RMB w
item.emitterpattern.name.tooltip.1=It's like an ME Level Emitter with Crafting Card, but pushes pattern instead of sending RS signal.
item.emitterpattern.name.tooltip.2=This pattern will not send materials when being pushed, but Crafting CPU will add outputs to waiting list.
item.emitterpattern.name.tooltip.3=Especially, Crafting Request Tunnel will capture the outputs when accepting this pattern.
proghatch.request_tunnel.tooltip.0=§7This is an §cMA§7 device, it's like a §cM§7olecular §cA§7ssembler, accepts patterns rather than materials from patterns.
proghatch.request_tunnel.tooltip.0=§7This is an §cMA§7 device, it's like a §cM§7olecular §cA§7ssembler, but accepts patterns rather than materials from patterns.
proghatch.request_tunnel.tooltip.1=When accepting patterns, it stores inputs into storage and records outputs. Then craft or extract materials to satisfy those outputs.
proghatch.request_tunnel.tooltip.2=Outputs will be cached in inventory, use pipes to send them back, or use wrench to specify the auto-output direction.
proghatch.request_tunnel.tooltip.3=Please use ME Interface (even if pattern contains fluids), ME Dual Interface does not work fine!

0 comments on commit 7595876

Please sign in to comment.