Merge branch 'master' into ender-fluid-conduits

This commit is contained in:
Martin Robertz authored and GitHub committed 2021-11-15 21:08:27 +01:00
commit 4e5d374d16
5 files changed
+30 -9

No files matched your search

@@ -30,10 +30,13 @@ import net.minecraftforge.fluids.FluidTankInfo;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.function.Supplier;
import java.util.Set;
public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
@@ -44,7 +47,8 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
public static final String ICON_KEY_IN_OUT_IN = ItemConduit.ICON_KEY_IN_OUT_IN;
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
private final Set<BlockCoord> filledFromThisTick = new HashSet<>();
@SideOnly(Side.CLIENT)
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@@ -287,6 +291,7 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
@Override
public void updateEntity(World world) {
super.updateEntity(world);
filledFromThisTick.clear();
if(world.isRemote) {
return;
}
@@ -326,6 +331,15 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
if(network == null || !getConnectionMode(from).acceptsInput()) {
return 0;
}
// Guard against things that continuously call fill!
if(filledFromThisTick.contains(getLocation().getLocation(from))) {
return 0;
}
if(doFill) {
filledFromThisTick.add(getLocation().getLocation(from));
}
return network.fillFrom(this, from, resource, doFill);
}
@@ -1,6 +1,8 @@
package crazypants.enderio.conduit.liquid;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -31,6 +33,7 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
protected int numEmptyEvents = 0;
protected boolean fluidTypeLocked = false;
private int lastLightValue;
protected final Set<BlockCoord> filledFromThisTick = new HashSet<>();
@Override
public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {
@@ -191,6 +194,7 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
@Override
public void updateEntity(World world) {
filledFromThisTick.clear();
int lightValue = getLightValue();
if(lastLightValue != lightValue) {
BlockCoord bc = getLocation();
@@ -239,6 +239,15 @@ public class AdvancedLiquidConduit extends AbstractTankConduit {
if(network == null || !getConnectionMode(from).acceptsInput()) {
return 0;
}
// Guard against things that continuously call fill!
if(filledFromThisTick.contains(getLocation().getLocation(from))) {
return 0;
}
if(doFill) {
filledFromThisTick.add(getLocation().getLocation(from));
}
return network.fill(from, resource, doFill);
}
@@ -83,8 +83,6 @@ public class LiquidConduit extends AbstractTankConduit {
private ForgeDirection startPushDir = ForgeDirection.DOWN;
private final Set<BlockCoord> filledFromThisTick = new HashSet<BlockCoord>();
private long ticksSinceFailedExtract = 0;
@Override
@@ -170,9 +168,7 @@ public class LiquidConduit extends AbstractTankConduit {
return 0;
}
// Note: This is just a guard against mekansims pipes that will continuously
// call
// fill on us if we push liquid to them.
// Guard against things that continuously call fill!
if(filledFromThisTick.contains(getLocation().getLocation(from))) {
return 0;
}