Fix several bugs with fluids (null vs. EMPTY).
Fix IAEFluidStack NBT serialization. Fix fluid export bus not exporting. Fix fluid formation planes. Fix fluid annihilation planes.
This commit is contained in:
@@ -95,7 +95,7 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel {
|
||||
FluidDummyItem itemFacade = (FluidDummyItem) stack.getItem();
|
||||
|
||||
FluidStack fluidStack = itemFacade.getFluidStack(stack);
|
||||
if (fluidStack == null) {
|
||||
if (fluidStack.isEmpty()) {
|
||||
fluidStack = new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,21 +18,15 @@
|
||||
|
||||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.particle.BreakingParticle;
|
||||
import net.minecraft.client.particle.IAnimatedSprite;
|
||||
import net.minecraft.client.particle.IParticleFactory;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.particles.BasicParticleType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class MatterCannonFX extends BreakingParticle {
|
||||
public class MatterCannonFX extends SpriteTexturedParticle {
|
||||
|
||||
public static final BasicParticleType TYPE = new BasicParticleType(false);
|
||||
|
||||
@@ -42,7 +36,7 @@ public class MatterCannonFX extends BreakingParticle {
|
||||
|
||||
public MatterCannonFX(final World par1World, final double x, final double y, final double z,
|
||||
IAnimatedSprite sprite) {
|
||||
super(par1World, x, y, z, new ItemStack(Items.DIAMOND));
|
||||
super(par1World, x, y, z);
|
||||
this.particleGravity = 0;
|
||||
this.particleBlue = 1;
|
||||
this.particleGreen = 1;
|
||||
@@ -59,6 +53,11 @@ public class MatterCannonFX extends BreakingParticle {
|
||||
this.particleScale *= 1.2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IParticleRenderType getRenderType() {
|
||||
return IParticleRenderType.PARTICLE_SHEET_OPAQUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
this.prevPosX = this.posX;
|
||||
|
||||
@@ -71,7 +71,6 @@ public class PacketCompressedNBT extends AppEngPacket {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: this is pointless, PacketBuffer.writeNBT will already compress
|
||||
// api
|
||||
public PacketCompressedNBT(final CompoundNBT din) throws IOException {
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -25,8 +27,12 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.util.EnumCycler;
|
||||
|
||||
public final class PacketConfigButton extends AppEngPacket {
|
||||
private final Settings option;
|
||||
@@ -54,18 +60,16 @@ public final class PacketConfigButton extends AppEngPacket {
|
||||
@Override
|
||||
public void serverPacketData(final INetworkInfo manager, final PlayerEntity player) {
|
||||
final ServerPlayerEntity sender = (ServerPlayerEntity) player;
|
||||
// FIXME if( sender.openContainer instanceof AEBaseContainer )
|
||||
// FIXME {
|
||||
// FIXME final AEBaseContainer baseContainer = (AEBaseContainer)
|
||||
// sender.openContainer;
|
||||
// FIXME if( baseContainer.getTarget() instanceof IConfigurableObject )
|
||||
// FIXME {
|
||||
// FIXME final IConfigManager cm = ( (IConfigurableObject)
|
||||
// baseContainer.getTarget() ).getConfigManager();
|
||||
// FIXME final Enum<?> newState = EnumCycler.rotateEnum( cm.getSetting(
|
||||
// this.option ), this.rotationDirection, this.option.getPossibleValues() );
|
||||
// FIXME cm.putSetting( this.option, newState );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
if (sender.openContainer instanceof AEBaseContainer) {
|
||||
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
if (baseContainer.getTarget() instanceof IConfigurableObject) {
|
||||
final IConfigManager cm = ((IConfigurableObject) baseContainer.getTarget()).getConfigManager();
|
||||
Enum setting = cm.getSetting(this.option);
|
||||
Enum newState = EnumCycler.rotateEnum(setting, this.rotationDirection,
|
||||
(EnumSet) this.option.getPossibleValues());
|
||||
cm.putSetting(this.option, newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.OutputStream;
|
||||
import java.nio.BufferOverflowException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.render.effects.MatterCannonFX;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
|
||||
@@ -82,14 +82,9 @@ public class PacketMatterCannon extends AppEngPacket {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void clientPacketData(final INetworkInfo network, final PlayerEntity player) {
|
||||
try {
|
||||
|
||||
final World world = Minecraft.getInstance().world;
|
||||
for (int a = 1; a < this.len; a++) {
|
||||
// FIXME final MatterCannonFX fx = new MatterCannonFX( world, this.x + this.dx *
|
||||
// a, this.y + this.dy * a, this.z + this.dz * a, new ItemStack( Items.DIAMOND )
|
||||
// );
|
||||
|
||||
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||
Minecraft.getInstance().particles.addParticle(MatterCannonFX.TYPE, this.x + this.dx * a,
|
||||
this.y + this.dy * a, this.z + this.dz * a, 0, 0, 0);
|
||||
}
|
||||
} catch (final Exception ignored) {
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ public class ContainerFluidTerminal extends AEBaseContainer
|
||||
} else if (action == InventoryAction.EMPTY_ITEM) {
|
||||
// See how much we can drain from the item
|
||||
final FluidStack extract = fh.drain(Integer.MAX_VALUE, FluidAction.SIMULATE);
|
||||
if (extract == null || extract.getAmount() < 1) {
|
||||
if (extract.isEmpty() || extract.getAmount() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public class ContainerFluidTerminal extends AEBaseContainer
|
||||
final int toStore = (int) (extract.getAmount() - notStorable.getStackSize());
|
||||
final FluidStack storable = fh.drain(toStore, FluidAction.SIMULATE);
|
||||
|
||||
if (storable == null || storable.getAmount() == 0) {
|
||||
if (storable.isEmpty() || storable.getAmount() == 0) {
|
||||
return;
|
||||
} else {
|
||||
extract.setAmount(storable.getAmount());
|
||||
|
||||
@@ -335,7 +335,7 @@ public class DualityFluidInterface
|
||||
|
||||
// make sure strange things didn't happen...
|
||||
final FluidStack canExtract = this.tanks.drain(slot, toStore.getFluidStack(), false);
|
||||
if (canExtract == null || canExtract.getAmount() != toStore.getStackSize()) {
|
||||
if (canExtract.isEmpty() || canExtract.getAmount() != toStore.getStackSize()) {
|
||||
changed = true;
|
||||
} else {
|
||||
IAEFluidStack notStored = Platform.poweredInsert(src, dest, toStore, this.interfaceRequestSource);
|
||||
@@ -345,7 +345,7 @@ public class DualityFluidInterface
|
||||
// extract items!
|
||||
changed = true;
|
||||
final FluidStack removed = this.tanks.drain(slot, toStore.getFluidStack(), true);
|
||||
if (removed == null || toStore.getStackSize() != removed.getAmount()) {
|
||||
if (removed.isEmpty() || toStore.getStackSize() != removed.getAmount()) {
|
||||
throw new IllegalStateException("bad attempt at managing tanks. ( drain )");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.fluids.items;
|
||||
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -44,7 +45,7 @@ public class FluidDummyItem extends AEBaseItem {
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack stack) {
|
||||
FluidStack fluidStack = this.getFluidStack(stack);
|
||||
if (fluidStack == null) {
|
||||
if (fluidStack.isEmpty()) {
|
||||
fluidStack = new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME);
|
||||
}
|
||||
return fluidStack.getTranslationKey();
|
||||
@@ -55,11 +56,11 @@ public class FluidDummyItem extends AEBaseItem {
|
||||
CompoundNBT tag = is.getTag();
|
||||
return FluidStack.loadFluidStackFromNBT(tag);
|
||||
}
|
||||
return null;
|
||||
return FluidStack.EMPTY;
|
||||
}
|
||||
|
||||
public void setFluidStack(ItemStack is, FluidStack fs) {
|
||||
if (fs == null) {
|
||||
if (fs.isEmpty()) {
|
||||
is.setTag(null);
|
||||
} else {
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
|
||||
@@ -96,7 +96,7 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
|
||||
|
||||
// Drain the fluid from the tank
|
||||
FluidStack gathered = this.fluidHandler.drain(requestedFluidStack, mode.getFluidAction());
|
||||
if (gathered == null) {
|
||||
if (gathered.isEmpty()) {
|
||||
// If nothing was pulled from the tank, return null
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,8 @@ public class PartFluidExportBus extends PartSharedFluidBus {
|
||||
final TileEntity te = this.getConnectedTE();
|
||||
LazyOptional<IFluidHandler> fhOpt = LazyOptional.empty();
|
||||
if (te != null) {
|
||||
te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, this.getSide().getFacing().getOpposite());
|
||||
fhOpt = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,
|
||||
this.getSide().getFacing().getOpposite());
|
||||
}
|
||||
if (fhOpt.isPresent()) {
|
||||
try {
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -17,10 +18,14 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -117,8 +122,11 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
|
||||
final FluidStack fs = input.getFluidStack();
|
||||
fs.setAmount(FluidAttributes.BUCKET_VOLUME);
|
||||
|
||||
final FluidTank tank = new FluidTank(FluidAttributes.BUCKET_VOLUME, e -> e.isFluidEqual(fs));
|
||||
if (!FluidUtil.tryPlaceFluid(null, w, Hand.MAIN_HAND, pos, tank, fs)) {
|
||||
final FluidTank tank = new FluidTank(FluidAttributes.BUCKET_VOLUME);
|
||||
tank.fill(fs, IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
FakePlayer fakePlayer = FakePlayerFactory.getMinecraft((ServerWorld) w);
|
||||
if (!FluidUtil.tryPlaceFluid(fakePlayer, w, Hand.MAIN_HAND, pos, tank, fs)) {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, FluidAction action) {
|
||||
if (resource == null || resource.isEmpty() || resource.getAmount() <= 0) {
|
||||
if (resource.isEmpty() || resource.getAmount() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
|
||||
@Override
|
||||
public FluidStack drain(final FluidStack fluid, final FluidAction action) {
|
||||
if (fluid == null || fluid.getAmount() <= 0) {
|
||||
if (fluid.isEmpty() || fluid.getAmount() <= 0) {
|
||||
return FluidStack.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,20 @@
|
||||
package appeng.fluids.util;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.fluid.EmptyFluid;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -39,7 +47,8 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
private static final String NBT_STACKSIZE = "cnt";
|
||||
private static final String NBT_REQUESTABLE = "req";
|
||||
private static final String NBT_CRAFTABLE = "craft";
|
||||
private static final String NBT_FLUIDSTACK = "fs";
|
||||
private static final String NBT_FLUID_ID = "f";
|
||||
private static final String NBT_FLUID_TAG = "ft";
|
||||
|
||||
private final Fluid fluid;
|
||||
private CompoundNBT tagCompound;
|
||||
@@ -57,47 +66,53 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
}
|
||||
|
||||
private AEFluidStack(@Nonnull final FluidStack fluidStack) {
|
||||
this.fluid = fluidStack.getFluid();
|
||||
|
||||
if (this.fluid == null) {
|
||||
throw new IllegalArgumentException("Fluid is null.");
|
||||
private AEFluidStack(@Nonnull Fluid fluid, long amount, @Nullable CompoundNBT tag) {
|
||||
if (fluid == Fluids.EMPTY) {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
this.setStackSize(fluidStack.getAmount());
|
||||
this.fluid = Preconditions.checkNotNull(fluid);
|
||||
this.setStackSize(amount);
|
||||
this.setCraftable(false);
|
||||
this.setCountRequestable(0);
|
||||
|
||||
if (fluidStack.getTag() != null) {
|
||||
this.tagCompound = fluidStack.getTag().copy();
|
||||
}
|
||||
this.tagCompound = tag;
|
||||
}
|
||||
|
||||
public static AEFluidStack fromFluidStack(final FluidStack input) {
|
||||
if (input == null) {
|
||||
if (input.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new AEFluidStack(input);
|
||||
Fluid fluid = input.getFluid();
|
||||
if (fluid == null) {
|
||||
throw new IllegalArgumentException("Fluid is null.");
|
||||
}
|
||||
|
||||
long amount = input.getAmount();
|
||||
CompoundNBT tag = null;
|
||||
if (input.getTag() != null) {
|
||||
tag = input.getTag().copy();
|
||||
}
|
||||
return new AEFluidStack(fluid, amount, tag);
|
||||
}
|
||||
|
||||
public static IAEFluidStack fromNBT(final CompoundNBT data) {
|
||||
final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(data.getCompound(NBT_FLUIDSTACK));
|
||||
|
||||
if (fluidStack == null) {
|
||||
ResourceLocation fluidId = new ResourceLocation(data.getString(NBT_FLUID_ID));
|
||||
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidId);
|
||||
if (fluid == null || fluid == Fluids.EMPTY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final AEFluidStack fluid = AEFluidStack.fromFluidStack(fluidStack);
|
||||
fluid.setStackSize(data.getLong(NBT_STACKSIZE));
|
||||
fluid.setCountRequestable(data.getLong(NBT_REQUESTABLE));
|
||||
fluid.setCraftable(data.getBoolean(NBT_CRAFTABLE));
|
||||
|
||||
if (fluid.hasTagCompound()) {
|
||||
fluid.tagCompound = fluid.tagCompound.copy();
|
||||
CompoundNBT tag = null;
|
||||
if (data.contains(NBT_FLUID_TAG, Constants.NBT.TAG_COMPOUND)) {
|
||||
tag = data.getCompound(NBT_FLUID_TAG);
|
||||
}
|
||||
|
||||
return fluid;
|
||||
long amount = data.getLong(NBT_STACKSIZE);
|
||||
|
||||
AEFluidStack fluidStack = new AEFluidStack(fluid, amount, tag);
|
||||
fluidStack.setCountRequestable(data.getLong(NBT_REQUESTABLE));
|
||||
fluidStack.setCraftable(data.getBoolean(NBT_CRAFTABLE));
|
||||
return fluidStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,14 +127,10 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final CompoundNBT data) {
|
||||
data.getCompound(NBT_FLUIDSTACK).putString("FluidName", this.fluid.getRegistryName().toString());
|
||||
data.getCompound(NBT_FLUIDSTACK).putInt("Amount", 0);
|
||||
data.putString(NBT_FLUID_ID, this.fluid.getRegistryName().toString());
|
||||
if (this.hasTagCompound()) {
|
||||
data.getCompound(NBT_FLUIDSTACK).put("Tag", this.tagCompound);
|
||||
} else {
|
||||
data.getCompound(NBT_FLUIDSTACK).remove("Tag");
|
||||
data.put(NBT_FLUID_TAG, this.tagCompound);
|
||||
}
|
||||
|
||||
data.putLong(NBT_STACKSIZE, this.getStackSize());
|
||||
data.putLong(NBT_REQUESTABLE, this.getCountRequestable());
|
||||
data.putBoolean(NBT_CRAFTABLE, this.isCraftable());
|
||||
@@ -234,7 +245,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
final long stackSize = buffer.readVarLong();
|
||||
final long countRequestable = buffer.readVarLong();
|
||||
|
||||
if (fluidStack == null) {
|
||||
if (fluidStack.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,6 @@ public class AEFluidTank extends FluidTank implements IAEFluidTank {
|
||||
public AEFluidTank(IAEFluidInventory host, int capacity) {
|
||||
super(capacity);
|
||||
this.host = host;
|
||||
// FIXME if( host instanceof TileEntity )
|
||||
// FIXME {
|
||||
// FIXME this.setTileEntity( (TileEntity) host );
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -92,7 +92,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
public IAEFluidStack extractItems(final IAEFluidStack request, final Actionable type, final IActionSource src) {
|
||||
final FluidStack removed = this.handler.drain(request.getFluidStack(), type.getFluidAction());
|
||||
|
||||
if (removed == null || removed.getAmount() == 0) {
|
||||
if (removed.isEmpty() || removed.getAmount() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
if (a == b) {
|
||||
return false;
|
||||
}
|
||||
if (a == null || b == null) {
|
||||
if (a.isEmpty() || b.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return !a.getFluid().equals(b.getFluid());
|
||||
@@ -292,8 +292,8 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
private final IAEFluidStack aeStack;
|
||||
|
||||
CachedFluidStack(final FluidStack is) {
|
||||
if (is == null) {
|
||||
this.fluidStack = null;
|
||||
if (is.isEmpty()) {
|
||||
this.fluidStack = FluidStack.EMPTY;
|
||||
this.aeStack = null;
|
||||
} else {
|
||||
this.fluidStack = is.copy();
|
||||
|
||||
@@ -275,7 +275,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack != FluidStack.EMPTY;
|
||||
return !stack.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -284,10 +284,10 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
final IStorageChannel<IAEFluidStack> chan = AEApi.instance().storage()
|
||||
.getStorageChannel(IFluidStorageChannel.class);
|
||||
TileCondenser.this
|
||||
.addPower((resource == null ? 0.0 : (double) resource.getAmount()) / chan.transferFactor());
|
||||
.addPower((resource.isEmpty() ? 0.0 : (double) resource.getAmount()) / chan.transferFactor());
|
||||
}
|
||||
|
||||
return resource == null ? 0 : resource.getAmount();
|
||||
return resource.isEmpty() ? 0 : resource.getAmount();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -443,7 +443,7 @@ public class Platform {
|
||||
}
|
||||
|
||||
public static String getModId(final IAEFluidStack fs) {
|
||||
if (fs == null || fs.getFluidStack() == null) {
|
||||
if (fs == null || fs.getFluidStack().isEmpty()) {
|
||||
return "** Null";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user