parent
8a3d63fcca
commit
ffee708a9b
|
@ -90,7 +90,7 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
|||
|
||||
if (pipe == null) {
|
||||
BCLog.logger.log(Level.WARN, "Pipe failed to create during placement at {0},{1},{2}", i, j, k);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (BlockGenericPipe.placePipe(pipe, world, i, j, k, block, 0, entityplayer)) {
|
||||
|
@ -107,9 +107,11 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
|||
block.stepSound.getPitch() * 0.8F);
|
||||
|
||||
itemstack.stackSize--;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -259,6 +259,10 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
}
|
||||
}
|
||||
|
||||
protected void scheduleInternalUpdate() {
|
||||
internalUpdateScheduled = true;
|
||||
}
|
||||
|
||||
public void updateSignalState() {
|
||||
for (PipeWire c : PipeWire.values()) {
|
||||
updateSignalStateForColor(c);
|
||||
|
|
|
@ -606,6 +606,12 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
blockNeighborChangedSides |= direction == ForgeDirection.UNKNOWN ? 0x3F : (1 << direction.ordinal());
|
||||
}
|
||||
|
||||
public void scheduleWireChange() {
|
||||
if (pipe != null) {
|
||||
pipe.scheduleInternalUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInjectItems(ForgeDirection from) {
|
||||
if (getPipeType() != IPipeTile.PipeType.ITEM) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -19,6 +20,8 @@ import buildcraft.BuildCraftTransport;
|
|||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.transport.IStripesActivator;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.PipeTransportItems;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
import buildcraft.transport.TravelingItem;
|
||||
|
@ -84,6 +87,8 @@ public class PipeExtensionListener {
|
|||
w.getTileEntity(r.x, r.y, r.z).writeToNBT(nbt);
|
||||
w.setBlockToAir(r.x, r.y, r.z);
|
||||
|
||||
boolean failedPlacement = false;
|
||||
|
||||
// Step 2: If retracting, remove previous pipe; if extending, add new pipe
|
||||
if (retract) {
|
||||
removedPipeStacks = w.getBlock((int) target.x, (int) target.y, (int) target.z).getDrops(w, (int) target.x, (int) target.y, (int) target.z,
|
||||
|
@ -91,9 +96,12 @@ public class PipeExtensionListener {
|
|||
|
||||
w.setBlockToAir((int) target.x, (int) target.y, (int) target.z);
|
||||
} else {
|
||||
r.stack.getItem().onItemUse(r.stack,
|
||||
if (!r.stack.getItem().onItemUse(r.stack,
|
||||
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) w, r.x, r.y, r.z).get(),
|
||||
w, r.x, r.y, r.z, 1, 0, 0, 0);
|
||||
w, r.x, r.y, r.z, 1, 0, 0, 0)) {
|
||||
failedPlacement = true;
|
||||
target.moveBackwards(1.0D);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3: Place stripes pipe back
|
||||
|
@ -113,7 +121,7 @@ public class PipeExtensionListener {
|
|||
|
||||
// Step 4: Hope for the best, clean up.
|
||||
PipeTransportItems items = (PipeTransportItems) pipeTile.pipe.transport;
|
||||
if (!retract) {
|
||||
if (!retract && !failedPlacement) {
|
||||
r.stack.stackSize--;
|
||||
}
|
||||
|
||||
|
@ -126,10 +134,11 @@ public class PipeExtensionListener {
|
|||
}
|
||||
}
|
||||
|
||||
if (!retract) {
|
||||
if (!retract && !failedPlacement) {
|
||||
TileGenericPipe newPipeTile = (TileGenericPipe) w.getTileEntity(r.x, r.y, r.z);
|
||||
newPipeTile.updateEntity();
|
||||
pipeTile.scheduleNeighborChange();
|
||||
pipeTile.scheduleWireChange();
|
||||
}
|
||||
}
|
||||
rSet.clear();
|
||||
|
|
Loading…
Reference in a new issue