the real BuildCraft 6.3.1 - make pluggables easier to remove, make pluggables pop directly into your inventory when removed
This commit is contained in:
parent
dd2e3ab3e9
commit
7eaf537ecf
|
@ -1,4 +1,11 @@
|
|||
Improvements:
|
||||
* Pluggables, when removed, go directly into your inventory
|
||||
|
||||
Bugfixes:
|
||||
* [#2368] Cannot place torches on facades (asie)
|
||||
* [#2366] Startup crash in Blueprint Library (asie)
|
||||
* [#2362] No construction marker recipe (asie)
|
||||
* Pluggables can be removed more freely again (asie)
|
||||
|
||||
Languages:
|
||||
* Updates to German, French, Hungarian, Japanese, Russian, Slovak and Chinese (various authors)
|
||||
|
|
|
@ -189,6 +189,12 @@ public final class Utils {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static void dropTryIntoPlayerInventory(World world, int x, int y, int z, ItemStack stack, EntityPlayer player) {
|
||||
if (player == null || !player.inventory.addItemStackToInventory(stack)) {
|
||||
InvUtils.dropItems(world, stack, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static TileEntity getTile(World world, Position pos, ForgeDirection step) {
|
||||
Position tmp = new Position(pos);
|
||||
tmp.orientation = step;
|
||||
|
|
|
@ -729,13 +729,13 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
if (player.isSneaking()) {
|
||||
if (pipe.container.hasPipePluggable(side) && rayTraceResult != null && rayTraceResult.hitPart == Part.Pluggable
|
||||
&& pluggable.getClass().isInstance(pipe.container.getPipePluggable(side))) {
|
||||
return pipe.container.setPluggable(side, null);
|
||||
return pipe.container.setPluggable(side, null, player);
|
||||
}
|
||||
}
|
||||
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Pipe) {
|
||||
if (!pipe.container.hasPipePluggable(placementSide)) {
|
||||
pipe.container.setPluggable(placementSide, pluggable);
|
||||
pipe.container.setPluggable(placementSide, pluggable, player);
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
|
@ -754,7 +754,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
return player.isSneaking() && stripWire(pipe, color);
|
||||
return player.isSneaking() && stripWire(pipe, color, player);
|
||||
}
|
||||
|
||||
private boolean addWire(Pipe<?> pipe, PipeWire color) {
|
||||
|
@ -769,10 +769,10 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean stripWire(Pipe<?> pipe, PipeWire color) {
|
||||
private boolean stripWire(Pipe<?> pipe, PipeWire color, EntityPlayer player) {
|
||||
if (pipe.wireSet[color.ordinal()]) {
|
||||
if (!pipe.container.getWorldObj().isRemote) {
|
||||
dropWire(color, pipe);
|
||||
dropWire(color, pipe, player);
|
||||
}
|
||||
|
||||
pipe.signalStrength[color.ordinal()] = 0;
|
||||
|
@ -794,18 +794,24 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
}
|
||||
|
||||
private boolean stripEquipment(World world, int x, int y, int z, EntityPlayer player, Pipe<?> pipe, ForgeDirection side) {
|
||||
// Try to strip pluggables first
|
||||
//RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||
//if (rayTraceResult != null && rayTraceResult.hitPart != Part.Pipe) {
|
||||
if (pipe.container.hasPipePluggable(side)) {
|
||||
return pipe.container.setPluggable(side, null);
|
||||
}
|
||||
//}
|
||||
if (!world.isRemote) {
|
||||
// Try to strip pluggables first
|
||||
ForgeDirection nSide = side;
|
||||
|
||||
// Try to strip wires second, starting with yellow.
|
||||
for (PipeWire color : PipeWire.values()) {
|
||||
if (stripWire(pipe, color)) {
|
||||
return true;
|
||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart != Part.Pipe) {
|
||||
nSide = rayTraceResult.sideHit;
|
||||
}
|
||||
|
||||
if (pipe.container.hasPipePluggable(nSide)) {
|
||||
return pipe.container.setPluggable(nSide, null, player);
|
||||
}
|
||||
|
||||
// Try to strip wires second, starting with yellow.
|
||||
for (PipeWire color : PipeWire.values()) {
|
||||
if (stripWire(pipe, color, player)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -817,8 +823,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
*
|
||||
* @param pipeWire
|
||||
*/
|
||||
private void dropWire(PipeWire pipeWire, Pipe<?> pipe) {
|
||||
pipe.dropItem(pipeWire.getStack());
|
||||
private void dropWire(PipeWire pipeWire, Pipe<?> pipe, EntityPlayer player) {
|
||||
Utils.dropTryIntoPlayerInventory(pipe.container.getWorld(), pipe.container.x(),
|
||||
pipe.container.y(), pipe.container.z(), pipeWire.getStack(), player);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class FacadePluggable extends PipePluggable {
|
|||
|
||||
@Override
|
||||
public boolean isBlocking(IPipeTile pipe, ForgeDirection direction) {
|
||||
return isHollow();
|
||||
return !isHollow();
|
||||
}
|
||||
|
||||
public boolean isHollow() {
|
||||
|
|
|
@ -54,7 +54,6 @@ import buildcraft.core.DefaultProps;
|
|||
import buildcraft.core.IDropControlInventory;
|
||||
import buildcraft.core.ITileBufferHolder;
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.core.inventory.InvUtils;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.IGuiReturnHandler;
|
||||
import buildcraft.core.network.ISyncedTile;
|
||||
|
@ -88,8 +87,8 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
protected boolean pipeBound = false;
|
||||
protected boolean resyncGateExpansions = false;
|
||||
protected boolean attachPluggables = false;
|
||||
protected SideProperties sideProperties = new SideProperties();
|
||||
|
||||
private SideProperties sideProperties = new SideProperties();
|
||||
private TileBuffer[] tileBuffer;
|
||||
private int glassColor = -1;
|
||||
|
||||
|
@ -218,7 +217,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
pluggables = newPluggables;
|
||||
}
|
||||
|
||||
public boolean dropItem(TileGenericPipe pipe, ForgeDirection direction) {
|
||||
public boolean dropItem(TileGenericPipe pipe, ForgeDirection direction, EntityPlayer player) {
|
||||
boolean result = false;
|
||||
PipePluggable pluggable = pluggables[direction.ordinal()];
|
||||
if (pluggable != null) {
|
||||
|
@ -227,7 +226,8 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
ItemStack[] stacks = pluggable.getDropItems(pipe);
|
||||
if (stacks != null) {
|
||||
for (ItemStack stack : stacks) {
|
||||
InvUtils.dropItems(pipe.worldObj, stack, pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
Utils.dropTryIntoPlayerInventory(pipe.worldObj, pipe.xCoord, pipe.yCoord, pipe.zCoord,
|
||||
stack, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -909,6 +909,10 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
}
|
||||
|
||||
public boolean setPluggable(ForgeDirection direction, PipePluggable pluggable) {
|
||||
return setPluggable(direction, pluggable, null);
|
||||
}
|
||||
|
||||
public boolean setPluggable(ForgeDirection direction, PipePluggable pluggable, EntityPlayer player) {
|
||||
if (worldObj != null && worldObj.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
@ -919,7 +923,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
|
||||
// Remove old pluggable
|
||||
if (sideProperties.pluggables[direction.ordinal()] != null) {
|
||||
sideProperties.dropItem(this, direction);
|
||||
sideProperties.dropItem(this, direction, player);
|
||||
pipe.eventBus.unregisterHandler(sideProperties.pluggables[direction.ordinal()]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue