Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Feb 27, 2025
1 parent 6ff0f33 commit e5f4a56
Show file tree
Hide file tree
Showing 19 changed files with 591 additions and 30 deletions.
16 changes: 13 additions & 3 deletions src/main/java/reobf/proghatches/ae/TileOrbSwitcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import com.google.common.base.Objects;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.math.Alignment;
import com.gtnewhorizons.modularui.api.math.Color;
import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget;
import com.gtnewhorizons.modularui.common.widget.textfield.NumericWidget;

import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
Expand Down Expand Up @@ -75,6 +78,7 @@ public void validate() {
boolean meta;
boolean circuit=true;
boolean index;
private int amount=1;

public void pretick(){

Expand Down Expand Up @@ -104,7 +108,7 @@ public void pretick(){

select=mte.getStackInSlot(((IConfigurationCircuitSupport) mte).getCircuitSlot());
if(select!=null){select=select.copy();
select.stackSize=1;}
select.stackSize=amount;}
}
}
}else{
Expand All @@ -113,7 +117,7 @@ public void pretick(){
for(int i=0;i<inv.getInventoryStackLimit();i++){
if(inv.getStackInSlot(i)!=null&&inv.getStackInSlot(i).stackSize>0){
select=inv.getStackInSlot(i).copy();
select.stackSize=1;
select.stackSize=amount;

}

Expand Down Expand Up @@ -222,6 +226,8 @@ public void writeToNBT(NBTTagCompound compound) {
compound.setByte("facing", (byte) facing.ordinal());
compound.setBoolean("nbt",nbt);
compound.setBoolean("meta",meta);
compound.setByte("amount", (byte) amount);

super.writeToNBT(compound);
}

Expand All @@ -235,6 +241,8 @@ public void readFromNBT(NBTTagCompound compound) {
facing=ForgeDirection.VALID_DIRECTIONS[compound.getByte("facing")];
nbt=compound.getBoolean("nbt");
meta=compound.getBoolean("meta");
amount=compound.getByte("amount");
if(amount<0)amount=1;
super.readFromNBT(compound);
}

Expand Down Expand Up @@ -403,7 +411,9 @@ public ModularWindow createWindow(UIBuildContext buildContext) {
builder.bindPlayerInventory(buildContext.getPlayer());
}


builder.widget(new NumericWidget().setSetter(val -> amount = (int) val).setGetter(() -> amount).setBounds(1, Integer.MAX_VALUE-1).setScrollValues(1, 4, 64).setTextAlignment(Alignment.Center).setTextColor(Color.WHITE.normal).setSize(70, 18).setPos(43, 3).setBackground(GTUITextures.BACKGROUND_TEXT_FIELD)
.addTooltip(StatCollector.translateToLocal("proghatches.orb_switcher.amount"))
);
builder.widget(
new CycleButtonWidget().setToggle(() -> nbt, s -> nbt = s)
.setTextureGetter(s -> {
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/reobf/proghatches/ae/part2/RequestTunnel.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import reobf.proghatches.ae.PatternCraftingJob;

import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
Expand Down Expand Up @@ -61,6 +62,14 @@ public RequestTunnel() {
@Override
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table,
ForgeDirection ejectionDirection) {

try {
PatternCraftingJob job = new PatternCraftingJob(patternDetails, getProxy().getStorage());
getProxy().getCrafting().getCraftingPatterns();
} catch (GridAccessException e) {
}


for (int i = 0; i < table.getSizeInventory(); i++) {
ItemStack is = table.getStackInSlot(i);
if (is != null) {
Expand Down Expand Up @@ -233,7 +242,7 @@ public boolean acceptsPlans() {
public ImmutableSet<ICraftingLink> getRequestedJobs() {
return last == null ? ImmutableSet.of() : ImmutableSet.of(last);
}

boolean returnAll=true;
@Override
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
if (mode == Actionable.SIMULATE) {
Expand Down Expand Up @@ -274,12 +283,16 @@ public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, A

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

if(!returnAll)
return items;// not waiting, just return items as unwanted
}

}

if(returnAll){
long size=left.getStackSize();
left.decStackSize(size);
items.incStackSize(size);
}
if (items.getItem() instanceof ItemFluidDrop) {
cacheFR.add(
ItemFluidDrop.getAeFluidStack(items)
Expand All @@ -288,7 +301,7 @@ public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, A
cacheR.add(items.getItemStack());

}

if(left.getStackSize()==0)left=null;
return left;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1760,8 +1760,8 @@ private IDualInputInventory wrap(DualInvBuffer to) {

return to;
}

final int mask = new Random().nextInt();
static Random ran=new Random();
final int mask = ran.nextInt();

public static class Recipe {

Expand Down Expand Up @@ -1826,7 +1826,7 @@ public NBTTagCompound ser() {
}
tag.setInteger("ff", f.length);
for (int ii = 0; ii < i.length; ii++) {
if (i[ii] != null) tag.setTag("i" + i, writeToNBT(i[ii], new NBTTagCompound()));
if (i[ii] != null) tag.setTag("i" + ii, writeToNBT(i[ii], new NBTTagCompound()));
}
tag.setInteger("ii", i.length);
return tag;
Expand Down
Loading

0 comments on commit e5f4a56

Please sign in to comment.