Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

wooden conductive pipe + RP frames = poisoned blocks #722

Closed
TomyLobo opened this Issue · 12 comments

7 participants

@TomyLobo
  1. place RP frame motor pointing up and ensure it has power
  2. place RP frame on top of it
  3. place IC geothermal on top of the frame
  4. place RP frame next to the first RP frame, in the direction of the frame motor's arrow
  5. place BC wooden conductive pipe on top of the second frame
  6. activate the RP frame motor
  7. reconnect 8.a) expected: nothing special 8.b) actual: geothermal generator turns purple

The same happens to any block passing through that block from that time forward until a wooden conductive pipe is destroyed in that very block:
RP block breakers turn into batteries, IC geothermals turn into purple blocks that screw up your inventory when you right-click them and more fun like that.

@SirSengir
Owner

Not exactly a BC issue.

@AartBluestoke

pipes, with their tile cache, will probably die a horrible death any time they are moved by frames, unless frames destroy/re-place the pipes.

various things store their x/y/z location in BC, separate from their tiles world coords ... and moving them "could" cause issues.

@Quest79

Maybe Eloraam will come to the rescue next year.

@SirSengir SirSengir closed this
@TomyLobo

placing and re-destroying will kill other mods, like computercraft. come on, just fix this thing or explain to me where this tile cache is and i'll fix it and make a PR

@Krapht
Owner

Just don't put wooden conductive pipes on frames? Pipes were never originally designed to be moved.
You'll find the TileBuffer at https://github.com/BuildCraft/BuildCraft/blob/master/common/buildcraft/transport/TileGenericPipe.java#L81

@AartBluestoke

the problem is i don't think there is any sensible callback we could implement to say "o-hay, we have moved location; everything you have stored about connections, adjacent, item flow, and stuff is now broken"; eloraam just moves the item.

because fetching blocks from a chunk is expensive and pipes regularly need pipes next to them, that cache helps with bc's cpu usage quite a bit.
its also things like the coordinate stored in
https://github.com/BuildCraft/BuildCraft/blob/master/common/buildcraft/transport/Pipe.java#L53 , and caches of directions and adjacency which would break on movement. What coordinates are pipeItems stored in? -- they could end up left behind also ...

Basically, it is "hard" to have a pseudo-multiblock structure (blocks which interact with all their neighbors) move without stuff breaking.

@viliml

Wow, I just tried it, and it's real funny! With a regular wooden pipe, the geothermal turned into a nuclear reactor that doubles my inventory!

@CovertJaguar
Owner

Replace all the TileBuffer arrays with this:

/*
 * Copyright (c) CovertJaguar, 2011 http://railcraft.info
 * 
 * This code is the property of CovertJaguar
 * and may only be used with explicit written
 * permission unless otherwise specified on the
 * license page at railcraft.wikispaces.com.
 */
package mods.railcraft.common.util.misc;

import java.util.Arrays;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;

/**
 *
 * @author CovertJaguar <railcraft.wikispaces.com>
 */
public class AdjacentTileCache {

    private Timer[] timer = new Timer[6];
    private TileEntity[] cache = new TileEntity[6];
    private final TileEntity source;

    public AdjacentTileCache(TileEntity tile) {
        this.source = tile;
        for (int i = 0; i < timer.length; i++) {
            timer[i] = new Timer();
        }
    }

    private TileEntity searchSide(ForgeDirection side) {
        return MiscTools.getBlockTileEntityOnSide(source.worldObj, source.xCoord, source.yCoord, source.zCoord, side);
    }

    public void refresh() {
        for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
            cache[side.ordinal()] = searchSide(side);
        }
    }

    public void purge() {
        Arrays.fill(cache, null);
        for (Timer t : timer) {
            t.reset();
        }
    }

    public TileEntity getTileOnSide(ForgeDirection side) {
        int s = side.ordinal();
        if (cache[s] != null) {
            if (cache[s].isInvalid()) {
                cache[s] = null;
            } else {
                return cache[s];
            }
        }

        if (timer[s].hasTriggered(source.worldObj, 32)) {
            cache[s] = searchSide(side);
        }

        return cache[s];
    }
}

And call the purge() function from invalidate()/validate().

Tip: Timer is basically serving the same purpose as SafeTimeTracker

@Krapht
Owner

TileBuffer is only part of the problem though. For item pipes, all items travelling in the pipe will need the coordinates updated as each item has its own coordinates.

@CovertJaguar
Owner

Ah, hmm...true.

@viliml

Why? Why can't they just be transferred to the pipe in front that got moved too, if it was moved too, otherwise it would just drop. Hey, actually EntityPassiveItems can call all the Pipe's functions themselves(when passing the boundary of the block grid), and, if there is no block around it, setDead() and spawn the EntityItem in the world! Just PipeTransport just has to give it the correct trajectory!

@TomyLobo

I use liquid pipes, but only while not moving any frames. This works mostly fine, except it sometimes doesn't render the fluid.

Instead of item pipes, RP tubes can and should be used in conjunction with frames, so that's a lower priority issue.

Wooden Conductive pipes are the only solid issue, because they break non-BC blocks and not just themselves and they don't have any replacement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.