merged with BuildCraft-5.0.x
This commit is contained in:
commit
db3638fa1c
5 changed files with 132 additions and 66 deletions
|
@ -36,7 +36,9 @@ less time coding and more time doing stuff that makes them less grumpy.
|
||||||
1. Create a base directory for the build
|
1. Create a base directory for the build
|
||||||
1. Clone the Buildcraft repository into 'baseDir/BuildCraft/'
|
1. Clone the Buildcraft repository into 'baseDir/BuildCraft/'
|
||||||
* Optional: Copy BuildCraft localization repository into `baseDir/BuildCraft-Localization`
|
* Optional: Copy BuildCraft localization repository into `baseDir/BuildCraft-Localization`
|
||||||
1. Navigate to basedir/BuildCraft in a shell and run `gradlew setupCIWorkspace build` (this may take a while).
|
1. Navigate to basedir/BuildCraft in a shell and run one of two commands:
|
||||||
|
* `gradlew setupCIWorkspace build` to just build a current jar (this may take a while).
|
||||||
|
* `gradlew setupDecompWorkspace` to setup a complete developement enviroment.
|
||||||
* With `Gradle` installed: use `gradle` instead of `gradlew`
|
* With `Gradle` installed: use `gradle` instead of `gradlew`
|
||||||
* On Windows: use `gradlew.bat` instead of `gradlew`
|
* On Windows: use `gradlew.bat` instead of `gradlew`
|
||||||
1. The compiled and obfuscated jar will be in 'baseDir/BuildCraft/build/libs'
|
1. The compiled and obfuscated jar will be in 'baseDir/BuildCraft/build/libs'
|
||||||
|
|
|
@ -292,16 +292,19 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
TileEntity pipeTileEntity = world.getTileEntity(x, y, z);
|
TileEntity pipeTileEntity = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
TileGenericPipe tileG = null;
|
TileGenericPipe tileG = null;
|
||||||
if (pipeTileEntity instanceof TileGenericPipe)
|
if (pipeTileEntity instanceof TileGenericPipe) {
|
||||||
tileG = (TileGenericPipe) pipeTileEntity;
|
tileG = (TileGenericPipe) pipeTileEntity;
|
||||||
|
}
|
||||||
|
|
||||||
if (tileG == null)
|
if (tileG == null) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Pipe pipe = tileG.pipe;
|
Pipe pipe = tileG.pipe;
|
||||||
|
|
||||||
if (!isValid(pipe))
|
if (!isValid(pipe)) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pipe hits along x, y, and z axis, gate (all 6 sides) [and
|
* pipe hits along x, y, and z axis, gate (all 6 sides) [and
|
||||||
|
@ -381,8 +384,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
|
|
||||||
for (int i = 0; i < hits.length; i++) {
|
for (int i = 0; i < hits.length; i++) {
|
||||||
MovingObjectPosition hit = hits[i];
|
MovingObjectPosition hit = hits[i];
|
||||||
if (hit == null)
|
if (hit == null) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double lengthSquared = hit.hitVec.squareDistanceTo(origin);
|
double lengthSquared = hit.hitVec.squareDistanceTo(origin);
|
||||||
|
|
||||||
|
@ -512,8 +516,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removePipe(Pipe pipe) {
|
public static void removePipe(Pipe pipe) {
|
||||||
if (pipe == null)
|
if (pipe == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isValid(pipe)) {
|
if (isValid(pipe)) {
|
||||||
pipe.onBlockRemoval();
|
pipe.onBlockRemoval();
|
||||||
|
@ -521,8 +526,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
|
|
||||||
World world = pipe.container.getWorldObj();
|
World world = pipe.container.getWorldObj();
|
||||||
|
|
||||||
if (world == null)
|
if (world == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int x = pipe.container.xCoord;
|
int x = pipe.container.xCoord;
|
||||||
int y = pipe.container.yCoord;
|
int y = pipe.container.yCoord;
|
||||||
|
@ -547,8 +553,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
|
|
||||||
if (world.isRemote)
|
if (world.isRemote) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
|
@ -578,8 +585,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
@Override
|
@Override
|
||||||
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int dmg) {
|
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int dmg) {
|
||||||
|
|
||||||
if (world.isRemote)
|
if (world.isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int i1 = quantityDropped(world.rand);
|
int i1 = quantityDropped(world.rand);
|
||||||
for (int j1 = 0; j1 < i1; j1++) {
|
for (int j1 = 0; j1 < i1; j1++) {
|
||||||
|
@ -689,20 +697,21 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
// Right click while sneaking with empty hand to strip equipment
|
// Right click while sneaking with empty hand to strip equipment
|
||||||
// from the pipe.
|
// from the pipe.
|
||||||
if (player.isSneaking() && currentItem == null) {
|
if (player.isSneaking() && currentItem == null) {
|
||||||
if (stripEquipment(world, x, y, z, player, pipe))
|
if (stripEquipment(world, x, y, z, player, pipe)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
} else if (currentItem == null) {
|
} else if (currentItem == null) {
|
||||||
// Fall through the end of the test
|
// Fall through the end of the test
|
||||||
} else if (currentItem.getItem() == Items.sign)
|
} else if (currentItem.getItem() == Items.sign) {
|
||||||
// Sign will be placed anyway, so lets show the sign gui
|
// Sign will be placed anyway, so lets show the sign gui
|
||||||
return false;
|
return false;
|
||||||
else if (currentItem.getItem() instanceof ItemPipe)
|
} else if (currentItem.getItem() instanceof ItemPipe) {
|
||||||
return false;
|
return false;
|
||||||
else if (currentItem.getItem() instanceof IToolWrench)
|
} else if (currentItem.getItem() instanceof IToolWrench) {
|
||||||
// Only check the instance at this point. Call the IToolWrench
|
// Only check the instance at this point. Call the IToolWrench
|
||||||
// interface callbacks for the individual pipe/logic calls
|
// interface callbacks for the individual pipe/logic calls
|
||||||
return pipe.blockActivated(player);
|
return pipe.blockActivated(player);
|
||||||
else if (PipeWire.RED.isPipeWire(currentItem)) {
|
} else if (PipeWire.RED.isPipeWire(currentItem)) {
|
||||||
if (addOrStripWire(player, pipe, PipeWire.RED)) {
|
if (addOrStripWire(player, pipe, PipeWire.RED)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -775,21 +784,24 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
if (clickedOnGate) {
|
if (clickedOnGate) {
|
||||||
pipe.gate.openGui(player);
|
pipe.gate.openGui(player);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else {
|
||||||
return pipe.blockActivated(player);
|
return pipe.blockActivated(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean addOrStripGate(World world, int x, int y, int z, EntityPlayer player, Pipe pipe) {
|
private boolean addOrStripGate(World world, int x, int y, int z, EntityPlayer player, Pipe pipe) {
|
||||||
if (addGate(player, pipe))
|
if (addGate(player, pipe)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Gate) {
|
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Gate) {
|
||||||
if (stripGate(pipe))
|
if (stripGate(pipe)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -854,13 +866,15 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Facade) {
|
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Facade) {
|
||||||
if (stripFacade(pipe, rayTraceResult.sideHit))
|
if (stripFacade(pipe, rayTraceResult.sideHit)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rayTraceResult != null && (rayTraceResult.hitPart != Part.Facade)) {
|
if (rayTraceResult != null && (rayTraceResult.hitPart != Part.Facade)) {
|
||||||
if (addFacade(player, pipe, rayTraceResult.sideHit != null && rayTraceResult.sideHit != ForgeDirection.UNKNOWN ? rayTraceResult.sideHit : side))
|
if (addFacade(player, pipe, rayTraceResult.sideHit != null && rayTraceResult.sideHit != ForgeDirection.UNKNOWN ? rayTraceResult.sideHit : side)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -884,13 +898,15 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Plug) {
|
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Plug) {
|
||||||
if (stripPlug(pipe, rayTraceResult.sideHit))
|
if (stripPlug(pipe, rayTraceResult.sideHit)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rayTraceResult != null && (rayTraceResult.hitPart == Part.Pipe || rayTraceResult.hitPart == Part.Gate)) {
|
if (rayTraceResult != null && (rayTraceResult.hitPart == Part.Pipe || rayTraceResult.hitPart == Part.Gate)) {
|
||||||
if (addPlug(player, pipe, rayTraceResult.sideHit != null && rayTraceResult.sideHit != ForgeDirection.UNKNOWN ? rayTraceResult.sideHit : side))
|
if (addPlug(player, pipe, rayTraceResult.sideHit != null && rayTraceResult.sideHit != ForgeDirection.UNKNOWN ? rayTraceResult.sideHit : side)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -899,13 +915,15 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.RobotStation) {
|
if (rayTraceResult != null && rayTraceResult.hitPart == Part.RobotStation) {
|
||||||
if (stripRobotStation(pipe, rayTraceResult.sideHit))
|
if (stripRobotStation(pipe, rayTraceResult.sideHit)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rayTraceResult != null && (rayTraceResult.hitPart == Part.Pipe || rayTraceResult.hitPart == Part.Gate)) {
|
if (rayTraceResult != null && (rayTraceResult.hitPart == Part.Pipe || rayTraceResult.hitPart == Part.Gate)) {
|
||||||
if (addRobotStation(player, pipe, rayTraceResult.sideHit != null && rayTraceResult.sideHit != ForgeDirection.UNKNOWN ? rayTraceResult.sideHit : side))
|
if (addRobotStation(player, pipe, rayTraceResult.sideHit != null && rayTraceResult.sideHit != ForgeDirection.UNKNOWN ? rayTraceResult.sideHit : side)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -944,14 +962,16 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
// Try to strip facades first
|
// Try to strip facades first
|
||||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Facade) {
|
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Facade) {
|
||||||
if (stripFacade(pipe, rayTraceResult.sideHit))
|
if (stripFacade(pipe, rayTraceResult.sideHit)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to strip wires second, starting with yellow.
|
// Try to strip wires second, starting with yellow.
|
||||||
for (PipeWire color : PipeWire.values()) {
|
for (PipeWire color : PipeWire.values()) {
|
||||||
if (stripWire(pipe, color))
|
if (stripWire(pipe, color)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return stripGate(pipe);
|
return stripGate(pipe);
|
||||||
|
@ -971,10 +991,12 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(IBlockAccess iblockaccess, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess iblockaccess, int x, int y, int z, int side) {
|
||||||
TileEntity tile = iblockaccess.getTileEntity(x, y, z);
|
TileEntity tile = iblockaccess.getTileEntity(x, y, z);
|
||||||
if (!(tile instanceof TileGenericPipe))
|
if (!(tile instanceof TileGenericPipe)) {
|
||||||
return null;
|
return null;
|
||||||
if (((TileGenericPipe) tile).renderState.textureArray != null)
|
}
|
||||||
|
if (((TileGenericPipe) tile).renderState.textureArray != null) {
|
||||||
return ((TileGenericPipe) tile).renderState.textureArray[side];
|
return ((TileGenericPipe) tile).renderState.textureArray[side];
|
||||||
|
}
|
||||||
return ((TileGenericPipe) tile).renderState.currentTexture;
|
return ((TileGenericPipe) tile).renderState.currentTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -993,20 +1015,22 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
|
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
Pipe pipe = getPipe(world, x, y, z);
|
Pipe pipe = getPipe(world, x, y, z);
|
||||||
|
|
||||||
if (isValid(pipe))
|
if (isValid(pipe)) {
|
||||||
return pipe.canConnectRedstone();
|
return pipe.canConnectRedstone();
|
||||||
else
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int isProvidingStrongPower(IBlockAccess iblockaccess, int x, int y, int z, int l) {
|
public int isProvidingStrongPower(IBlockAccess iblockaccess, int x, int y, int z, int l) {
|
||||||
Pipe pipe = getPipe(iblockaccess, x, y, z);
|
Pipe pipe = getPipe(iblockaccess, x, y, z);
|
||||||
|
|
||||||
if (isValid(pipe))
|
if (isValid(pipe)) {
|
||||||
return pipe.isPoweringTo(l);
|
return pipe.isPoweringTo(l);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1018,10 +1042,11 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
public int isProvidingWeakPower(IBlockAccess world, int i, int j, int k, int l) {
|
public int isProvidingWeakPower(IBlockAccess world, int i, int j, int k, int l) {
|
||||||
Pipe pipe = getPipe(world, i, j, k);
|
Pipe pipe = getPipe(world, i, j, k);
|
||||||
|
|
||||||
if (isValid(pipe))
|
if (isValid(pipe)) {
|
||||||
return pipe.isIndirectlyPoweringTo(l);
|
return pipe.isIndirectlyPoweringTo(l);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"all"})
|
@SuppressWarnings({"all"})
|
||||||
|
@ -1062,9 +1087,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class<? extends Pipe> pipe = pipes.get(key);
|
Class<? extends Pipe> pipe = pipes.get(key);
|
||||||
if (pipe != null)
|
if (pipe != null) {
|
||||||
return pipe.getConstructor(Item.class).newInstance(key);
|
return pipe.getConstructor(Item.class).newInstance(key);
|
||||||
else {
|
} else {
|
||||||
BCLog.logger.warning("Detected pipe with unknown key (" + key + "). Did you remove a buildcraft addon?");
|
BCLog.logger.warning("Detected pipe with unknown key (" + key + "). Did you remove a buildcraft addon?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,8 +1188,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
int z = target.blockZ;
|
int z = target.blockZ;
|
||||||
|
|
||||||
Pipe pipe = getPipe(worldObj, x, y, z);
|
Pipe pipe = getPipe(worldObj, x, y, z);
|
||||||
if (pipe == null)
|
if (pipe == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
||||||
|
|
||||||
|
@ -1224,8 +1250,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
@Override
|
@Override
|
||||||
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||||
Pipe pipe = getPipe(worldObj, x, y, z);
|
Pipe pipe = getPipe(worldObj, x, y, z);
|
||||||
if (pipe == null)
|
if (pipe == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldSettings.GameType;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
|
@ -93,10 +94,12 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
eventHandlers.put(getClass(), handlerMap);
|
eventHandlers.put(getClass(), handlerMap);
|
||||||
}
|
}
|
||||||
EventHandler handler = handlerMap.get(event.getClass());
|
EventHandler handler = handlerMap.get(event.getClass());
|
||||||
if (handler == null)
|
if (handler == null) {
|
||||||
handler = makeEventHandler(event, handlerMap);
|
handler = makeEventHandler(event, handlerMap);
|
||||||
if (handler.method == null)
|
}
|
||||||
|
if (handler.method == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
handler.method.invoke(this, event);
|
handler.method.invoke(this, event);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -137,11 +140,13 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof TileGenericPipe) {
|
||||||
otherPipe = ((TileGenericPipe) tile).pipe;
|
otherPipe = ((TileGenericPipe) tile).pipe;
|
||||||
|
|
||||||
if (!BlockGenericPipe.isFullyDefined(otherPipe))
|
if (!BlockGenericPipe.isFullyDefined(otherPipe)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!PipeConnectionBans.canPipesConnect(getClass(), otherPipe.getClass()))
|
if (!PipeConnectionBans.canPipesConnect(getClass(), otherPipe.getClass())) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return transport.canPipeConnect(tile, side);
|
return transport.canPipeConnect(tile, side);
|
||||||
}
|
}
|
||||||
|
@ -251,10 +256,11 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof TileGenericPipe) {
|
||||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
||||||
|
|
||||||
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe))
|
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe)) {
|
||||||
if (isWireConnectedTo(tile, color)) {
|
if (isWireConnectedTo(tile, color)) {
|
||||||
foundBiggerSignal |= receiveSignal(tilePipe.pipe.signalStrength[color.ordinal()] - 1, color);
|
foundBiggerSignal |= receiveSignal(tilePipe.pipe.signalStrength[color.ordinal()] - 1, color);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,8 +290,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSignalStateForColor(PipeWire wire) {
|
private void updateSignalStateForColor(PipeWire wire) {
|
||||||
if (!wireSet[wire.ordinal()])
|
if (!wireSet[wire.ordinal()]) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// STEP 1: compute internal signal strength
|
// STEP 1: compute internal signal strength
|
||||||
|
|
||||||
|
@ -304,18 +311,20 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof TileGenericPipe) {
|
||||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
||||||
|
|
||||||
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe) && tilePipe.pipe.wireSet[wire.ordinal()])
|
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe) && tilePipe.pipe.wireSet[wire.ordinal()]) {
|
||||||
if (isWireConnectedTo(tile, wire)) {
|
if (isWireConnectedTo(tile, wire)) {
|
||||||
tilePipe.pipe.receiveSignal(signalStrength[wire.ordinal()] - 1, wire);
|
tilePipe.pipe.receiveSignal(signalStrength[wire.ordinal()] - 1, wire);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean receiveSignal(int signal, PipeWire color) {
|
private boolean receiveSignal(int signal, PipeWire color) {
|
||||||
if (container.getWorldObj() == null)
|
if (container.getWorldObj() == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int oldSignal = signalStrength[color.ordinal()];
|
int oldSignal = signalStrength[color.ordinal()];
|
||||||
|
|
||||||
|
@ -328,8 +337,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inputOpen(ForgeDirection from) {
|
public boolean inputOpen(ForgeDirection from) {
|
||||||
|
@ -344,8 +354,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConnectRedstone() {
|
public boolean canConnectRedstone() {
|
||||||
if (hasGate())
|
if (hasGate()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -355,8 +366,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
ForgeDirection o = ForgeDirection.getOrientation(side).getOpposite();
|
ForgeDirection o = ForgeDirection.getOrientation(side).getOpposite();
|
||||||
TileEntity tile = container.getTile(o);
|
TileEntity tile = container.getTile(o);
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe && container.isPipeConnected(o))
|
if (tile instanceof TileGenericPipe && container.isPipeConnected(o)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return gate.getRedstoneOutput();
|
return gate.getRedstoneOutput();
|
||||||
}
|
}
|
||||||
|
@ -373,8 +385,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
// / @Override TODO: should be in IPipe
|
// / @Override TODO: should be in IPipe
|
||||||
public boolean isWired() {
|
public boolean isWired() {
|
||||||
for (PipeWire color : PipeWire.values()) {
|
for (PipeWire color : PipeWire.values()) {
|
||||||
if (isWired(color))
|
if (isWired(color)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -410,13 +423,15 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
if (container.isPipeConnected(o)) {
|
if (container.isPipeConnected(o)) {
|
||||||
connections++;
|
connections++;
|
||||||
if (connections == 1)
|
if (connections == 1) {
|
||||||
targetOrientation = o;
|
targetOrientation = o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connections > 1 || connections == 0)
|
if (connections > 1 || connections == 0) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return targetOrientation.getOpposite() != side;
|
return targetOrientation.getOpposite() != side;
|
||||||
}
|
}
|
||||||
|
@ -439,8 +454,10 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBlockRemoval() {
|
public void onBlockRemoval() {
|
||||||
for (ItemStack stack : computeItemDrop()) {
|
if (getWorld().getWorldInfo().getGameType() != GameType.CREATIVE) {
|
||||||
dropItem(stack);
|
for (ItemStack stack : computeItemDrop()) {
|
||||||
|
dropItem(stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,16 +519,19 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWireConnectedTo(TileEntity tile, PipeWire color) {
|
public boolean isWireConnectedTo(TileEntity tile, PipeWire color) {
|
||||||
if (!(tile instanceof TileGenericPipe))
|
if (!(tile instanceof TileGenericPipe)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
||||||
|
|
||||||
if (!BlockGenericPipe.isFullyDefined(tilePipe.pipe))
|
if (!BlockGenericPipe.isFullyDefined(tilePipe.pipe)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!tilePipe.pipe.wireSet[color.ordinal()])
|
if (!tilePipe.pipe.wireSet[color.ordinal()]) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return (tilePipe.pipe.transport instanceof PipeTransportStructure || transport instanceof PipeTransportStructure || Utils.checkPipesConnections(
|
return (tilePipe.pipe.transport instanceof PipeTransportStructure || transport instanceof PipeTransportStructure || Utils.checkPipesConnections(
|
||||||
container, tile));
|
container, tile));
|
||||||
|
@ -534,13 +554,15 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
|
|
||||||
Connections_num++;
|
Connections_num++;
|
||||||
|
|
||||||
if (Connections_num == 1)
|
if (Connections_num == 1) {
|
||||||
target_orientation = o;
|
target_orientation = o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Connections_num > 1 || Connections_num == 0)
|
if (Connections_num > 1 || Connections_num == 0) {
|
||||||
return ForgeDirection.UNKNOWN;
|
return ForgeDirection.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
return target_orientation.getOpposite();
|
return target_orientation.getOpposite();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import buildcraft.core.render.RenderUtils;
|
||||||
import buildcraft.transport.ItemFacade;
|
import buildcraft.transport.ItemFacade;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -47,6 +48,14 @@ public class FacadeItemRenderer implements IItemRenderer {
|
||||||
|
|
||||||
// Render Facade
|
// Render Facade
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
// Enable glBlending for transparency
|
||||||
|
if (block.getRenderBlockPass() > 0) {
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
block.setBlockBounds(0F, 0F, 1F - 1F / 16F, 1F, 1F, 1F);
|
block.setBlockBounds(0F, 0F, 1F - 1F / 16F, 1F, 1F, 1F);
|
||||||
render.setRenderBoundsFromBlock(block);
|
render.setRenderBoundsFromBlock(block);
|
||||||
GL11.glTranslatef(translateX, translateY, translateZ);
|
GL11.glTranslatef(translateX, translateY, translateZ);
|
||||||
|
@ -75,6 +84,12 @@ public class FacadeItemRenderer implements IItemRenderer {
|
||||||
render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 5, decodedMeta));
|
render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 5, decodedMeta));
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
|
// Disable blending
|
||||||
|
if (block.getRenderBlockPass() > 0) {
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
// Render StructurePipe
|
// Render StructurePipe
|
||||||
|
|
|
@ -11,20 +11,14 @@ package buildcraft.transport.render;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.core.CoreConstants;
|
import buildcraft.core.CoreConstants;
|
||||||
import buildcraft.transport.BlockGenericPipe;
|
|
||||||
import buildcraft.transport.PipeIconProvider;
|
|
||||||
import buildcraft.transport.PipeRenderState;
|
|
||||||
import buildcraft.transport.TransportProxy;
|
|
||||||
import buildcraft.core.utils.MatrixTranformations;
|
import buildcraft.core.utils.MatrixTranformations;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.*;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
||||||
|
@ -267,6 +261,12 @@ public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
||||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
// Here to prevent Minecraft from crashing when nothing renders on render pass zero
|
||||||
|
// This is likely a bug, and has been submitted as an issue to the Forge team
|
||||||
|
renderer.setRenderBounds(0, 0, 0, 0, 0, 0);
|
||||||
|
renderer.renderStandardBlock(Blocks.stone, x, y, z);
|
||||||
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof TileGenericPipe) {
|
||||||
TileGenericPipe pipeTile = (TileGenericPipe) tile;
|
TileGenericPipe pipeTile = (TileGenericPipe) tile;
|
||||||
renderPipe(renderer, world, (BlockGenericPipe) block, pipeTile, x, y, z);
|
renderPipe(renderer, world, (BlockGenericPipe) block, pipeTile, x, y, z);
|
||||||
|
|
Loading…
Add table
Reference in a new issue