mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 10:34:40 +00:00
Refactor: Replace Ae2Reflect usages with direct method calls (#326)
Co-authored-by: Martin Robertz <[email protected]> Co-authored-by: Kogepan229 <[email protected]> Co-authored-by: Kogepan229 <[email protected]>
This commit is contained in:
16 files changed
+100
-97
No files matched your search
@@ -145,7 +145,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
}
|
||||
|
||||
if (handler.isPreformatted()) {
|
||||
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included
|
||||
final String list = (handler.getWhitelist() == IncludeExclude.WHITELIST ? GuiText.Included
|
||||
: GuiText.Excluded).getLocal();
|
||||
lines.add(GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal());
|
||||
|
||||
|
||||
@@ -84,16 +84,15 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
}
|
||||
|
||||
final IInventory upgrades = this.getUpgradesInventory();
|
||||
Upgrades u;
|
||||
for (int x = 0; x < upgrades.getSizeInventory(); x++) {
|
||||
final ItemStack is = upgrades.getStackInSlot(x);
|
||||
if (is != null && is.getItem() instanceof IUpgradeModule) {
|
||||
final Upgrades u = ((IUpgradeModule) is.getItem()).getType(is);
|
||||
if (u != null) {
|
||||
switch (u) {
|
||||
case VOID_OVERFLOW -> cardVoidOverflow = true;
|
||||
case DISTRIBUTION -> cardDistribution = true;
|
||||
default -> {}
|
||||
}
|
||||
if (is == null) continue;
|
||||
if (is.getItem() instanceof IUpgradeModule upgradeItem && (u = upgradeItem.getType(is)) != null) {
|
||||
switch (u) {
|
||||
case VOID_OVERFLOW -> cardVoidOverflow = true;
|
||||
case DISTRIBUTION -> cardDistribution = true;
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -78,8 +77,8 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
@Override
|
||||
public IFluidCellInventory getCellInv() {
|
||||
Object o = this.getInternal();
|
||||
if (o instanceof MEPassThrough) {
|
||||
o = Ae2Reflect.getInternal((MEPassThrough<?>) o);
|
||||
if (o instanceof MEPassThrough<?>pt) {
|
||||
o = pt.getInternal();
|
||||
}
|
||||
return (IFluidCellInventory) (o instanceof IFluidCellInventory ? o : null);
|
||||
}
|
||||
@@ -87,16 +86,22 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterable<IAEFluidStack> getPartitionInv() {
|
||||
return (Iterable<IAEFluidStack>) Ae2Reflect.getPartitionList(this).getItems();
|
||||
return getPartitionList().getItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreformatted() {
|
||||
return !Ae2Reflect.getPartitionList(this).isEmpty();
|
||||
return !getPartitionList().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public IncludeExclude getIncludeExcludeMode() {
|
||||
return getWhitelist();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IncludeExclude getWhitelist() {
|
||||
return IncludeExclude.WHITELIST;
|
||||
}
|
||||
|
||||
@@ -113,11 +118,7 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
@Override
|
||||
public boolean canGetInv() {
|
||||
IFluidCellInventory cellInv = this.getCellInv();
|
||||
if (cellInv instanceof CreativeFluidCellInventory) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return !(cellInv instanceof CreativeFluidCellInventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,7 +165,6 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
IFluidCellInventory cellInventory = this.getCellInv();
|
||||
if (cellInventory instanceof FluidCellInventory ci) {
|
||||
return ci.getRestriction();
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -11,5 +11,9 @@ public interface IFluidCellInventoryHandler {
|
||||
|
||||
boolean isPreformatted();
|
||||
|
||||
/** use {@link IFluidCellInventoryHandler#getWhitelist} instead */
|
||||
@Deprecated
|
||||
IncludeExclude getIncludeExcludeMode();
|
||||
|
||||
IncludeExclude getWhitelist();
|
||||
}
|
||||
Reference in new issue
Block a user