Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Oct 23, 2024
1 parent 49c3edf commit 569cdfe
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1352,19 +1352,21 @@ public int fill(FluidStack aFluid, boolean doFill) {
public FluidStack drain(int maxDrain, boolean doDrain) {
if (getFluid() == null || !canTankBeEmptied())
return null;
if (getFluid().amount <= 0 && isFluidChangingAllowed()) {
if (getFluid().amount <= 0 /*&& isFluidChangingAllowed()*/) {
setFluid(null, getFluidSlot(getFluid()));
getBaseMetaTileEntity().markDirty();
return null;
}
FluidStack tRemove = getFluid().copy();
tRemove.amount = Math.min(maxDrain, tRemove.amount);
FluidStack f = getFluid();
int slot=getFluidSlot(f);
if (doDrain) {
getFluid().amount -= tRemove.amount;
f.amount -= tRemove.amount;
getBaseMetaTileEntity().markDirty();
}
if (getFluid() == null || getFluid().amount <= 0 && isFluidChangingAllowed()) {
setFluid(null, getFluidSlot(getFluid()));
if (f == null || f.amount <= 0 /*&& isFluidChangingAllowed()*/) {
setFluid(null, slot);
getBaseMetaTileEntity().markDirty();
}
return tRemove;
Expand All @@ -1380,18 +1382,18 @@ public FluidStack drain(ForgeDirection from, FluidStack aFluid, boolean doDrain)
if (aFluid == null || !hasFluid(aFluid))
return null;
FluidStack tStored = mStoredFluid[getFluidSlot(aFluid)].getFluid();
if (tStored.amount <= 0 && isFluidChangingAllowed()) {
if (tStored.amount <= 0 /*&& isFluidChangingAllowed()*/) {
setFluid(null, getFluidSlot(tStored));
getBaseMetaTileEntity().markDirty();
return null;
return drain(from, aFluid, doDrain);
}
FluidStack tRemove = tStored.copy();
tRemove.amount = Math.min(aFluid.amount, tRemove.amount);
if (doDrain) {
tStored.amount -= tRemove.amount;
getBaseMetaTileEntity().markDirty();
}
if (tStored.amount <= 0 && isFluidChangingAllowed()) {
if (tStored.amount <= 0/* && isFluidChangingAllowed()*/) {
setFluid(null, getFluidSlot(tStored));
getBaseMetaTileEntity().markDirty();
}
Expand Down Expand Up @@ -2378,5 +2380,14 @@ public Net getNetwork(){

}

@Override
public FluidStack drain(ForgeDirection side, int maxDrain, boolean doDrain) {

return drain( maxDrain, doDrain);
}
@Override
public boolean canDrain(ForgeDirection side, Fluid aFluid) {

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1552,4 +1552,7 @@ protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inve


}



}
33 changes: 22 additions & 11 deletions src/main/java/reobf/proghatches/main/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public static void get(GT_Multiblock_Tooltip_Builder obj, String key, boolean de
if (in == null) {
if (defaulted) {
obj.addMachineType("!!!error!!! failed to translate");
obj.getClass().getMethod("toolTipFinisher", String.class).invoke(obj,"do not remove en_US folder!");

//obj.getClass().getMethod("toolTipFinisher", String.class).invoke(obj,);
finisher(obj,"do not remove en_US folder!");



Expand All @@ -105,8 +105,8 @@ public static void get(GT_Multiblock_Tooltip_Builder obj, String key, boolean de

MethodType tp = MethodType.fromMethodDescriptorString(

type + (func.equals("toolTipFinisher") ? "V"
: "L"+GT_Multiblock_Tooltip_Builder.class.getName().replace(".", "/")+";")
type + (/*func.equals("toolTipFinisher") ? "V"
:*/ "L"+GT_Multiblock_Tooltip_Builder.class.getName().replace(".", "/")+";")

, Config.class.getClassLoader());
call(obj, args, MethodHandles.lookup().findVirtual(GT_Multiblock_Tooltip_Builder.class, func, tp), tp);
Expand All @@ -122,15 +122,26 @@ public static void get(GT_Multiblock_Tooltip_Builder obj, String key, boolean de
}

if (Config.appendAddedBy)
try {

obj.getClass().getMethod("toolTipFinisher", String.class).invoke(obj,LangManager.translateToLocal("programmable_hatches.addedby"));

} catch (Exception e) {
finisher(obj,LangManager.translateToLocal("programmable_hatches.addedby"));
;
}

private static void finisher(Object obj,String str) {
try {

e.printStackTrace();
obj.getClass().getMethod("toolTipFinisher", String.class).invoke(obj,str);
} catch (Exception e) {
try {
MyMod.LOG.warn("toolTipFinisher with String arg not found.");
MyMod.LOG.warn("Try toolTipFinisher with String[] arg.");
e.printStackTrace();
obj.getClass().getMethod("toolTipFinisher", String[].class).invoke(obj,new Object[]{new String[]{str}});
} catch (Exception ee) {
MyMod.LOG.fatal("????");
ee.printStackTrace();
}
;
e.printStackTrace();
}
}

private static void call(Object callee, String args, MethodHandle virtual, MethodType type) {
Expand Down

0 comments on commit 569cdfe

Please sign in to comment.