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. Clone the Buildcraft repository into 'baseDir/BuildCraft/'
|
||||
* 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`
|
||||
* On Windows: use `gradlew.bat` instead of `gradlew`
|
||||
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);
|
||||
|
||||
TileGenericPipe tileG = null;
|
||||
if (pipeTileEntity instanceof TileGenericPipe)
|
||||
if (pipeTileEntity instanceof TileGenericPipe) {
|
||||
tileG = (TileGenericPipe) pipeTileEntity;
|
||||
}
|
||||
|
||||
if (tileG == null)
|
||||
if (tileG == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Pipe pipe = tileG.pipe;
|
||||
|
||||
if (!isValid(pipe))
|
||||
if (!isValid(pipe)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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++) {
|
||||
MovingObjectPosition hit = hits[i];
|
||||
if (hit == null)
|
||||
if (hit == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double lengthSquared = hit.hitVec.squareDistanceTo(origin);
|
||||
|
||||
|
@ -512,8 +516,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
}
|
||||
|
||||
public static void removePipe(Pipe pipe) {
|
||||
if (pipe == null)
|
||||
if (pipe == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isValid(pipe)) {
|
||||
pipe.onBlockRemoval();
|
||||
|
@ -521,8 +526,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
|
||||
World world = pipe.container.getWorldObj();
|
||||
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int x = pipe.container.xCoord;
|
||||
int y = pipe.container.yCoord;
|
||||
|
@ -547,8 +553,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
|
||||
if (world.isRemote)
|
||||
if (world.isRemote) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
|
@ -578,8 +585,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
@Override
|
||||
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int dmg) {
|
||||
|
||||
if (world.isRemote)
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
int i1 = quantityDropped(world.rand);
|
||||
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
|
||||
// from the pipe.
|
||||
if (player.isSneaking() && currentItem == null) {
|
||||
if (stripEquipment(world, x, y, z, player, pipe))
|
||||
if (stripEquipment(world, x, y, z, player, pipe)) {
|
||||
return true;
|
||||
}
|
||||
} else if (currentItem == null) {
|
||||
// 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
|
||||
return false;
|
||||
else if (currentItem.getItem() instanceof ItemPipe)
|
||||
} else if (currentItem.getItem() instanceof ItemPipe) {
|
||||
return false;
|
||||
else if (currentItem.getItem() instanceof IToolWrench)
|
||||
} else if (currentItem.getItem() instanceof IToolWrench) {
|
||||
// Only check the instance at this point. Call the IToolWrench
|
||||
// interface callbacks for the individual pipe/logic calls
|
||||
return pipe.blockActivated(player);
|
||||
else if (PipeWire.RED.isPipeWire(currentItem)) {
|
||||
} else if (PipeWire.RED.isPipeWire(currentItem)) {
|
||||
if (addOrStripWire(player, pipe, PipeWire.RED)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -775,21 +784,24 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
if (clickedOnGate) {
|
||||
pipe.gate.openGui(player);
|
||||
return true;
|
||||
} else
|
||||
} else {
|
||||
return pipe.blockActivated(player);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if (player.isSneaking()) {
|
||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Gate) {
|
||||
if (stripGate(pipe))
|
||||
if (stripGate(pipe)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -854,13 +866,15 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||
if (player.isSneaking()) {
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Facade) {
|
||||
if (stripFacade(pipe, rayTraceResult.sideHit))
|
||||
if (stripFacade(pipe, rayTraceResult.sideHit)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 false;
|
||||
}
|
||||
|
@ -884,13 +898,15 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||
if (player.isSneaking()) {
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Plug) {
|
||||
if (stripPlug(pipe, rayTraceResult.sideHit))
|
||||
if (stripPlug(pipe, rayTraceResult.sideHit)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 false;
|
||||
}
|
||||
|
@ -899,13 +915,15 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||
if (player.isSneaking()) {
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.RobotStation) {
|
||||
if (stripRobotStation(pipe, rayTraceResult.sideHit))
|
||||
if (stripRobotStation(pipe, rayTraceResult.sideHit)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 false;
|
||||
}
|
||||
|
@ -944,14 +962,16 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
// Try to strip facades first
|
||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Facade) {
|
||||
if (stripFacade(pipe, rayTraceResult.sideHit))
|
||||
if (stripFacade(pipe, rayTraceResult.sideHit)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to strip wires second, starting with yellow.
|
||||
for (PipeWire color : PipeWire.values()) {
|
||||
if (stripWire(pipe, color))
|
||||
if (stripWire(pipe, color)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return stripGate(pipe);
|
||||
|
@ -971,10 +991,12 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
@Override
|
||||
public IIcon getIcon(IBlockAccess iblockaccess, int x, int y, int z, int side) {
|
||||
TileEntity tile = iblockaccess.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileGenericPipe))
|
||||
if (!(tile instanceof TileGenericPipe)) {
|
||||
return null;
|
||||
if (((TileGenericPipe) tile).renderState.textureArray != null)
|
||||
}
|
||||
if (((TileGenericPipe) tile).renderState.textureArray != null) {
|
||||
return ((TileGenericPipe) tile).renderState.textureArray[side];
|
||||
}
|
||||
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) {
|
||||
Pipe pipe = getPipe(world, x, y, z);
|
||||
|
||||
if (isValid(pipe))
|
||||
if (isValid(pipe)) {
|
||||
return pipe.canConnectRedstone();
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(IBlockAccess iblockaccess, int x, int y, int z, int l) {
|
||||
Pipe pipe = getPipe(iblockaccess, x, y, z);
|
||||
|
||||
if (isValid(pipe))
|
||||
if (isValid(pipe)) {
|
||||
return pipe.isPoweringTo(l);
|
||||
else
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1018,10 +1042,11 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
public int isProvidingWeakPower(IBlockAccess world, int i, int j, int k, int l) {
|
||||
Pipe pipe = getPipe(world, i, j, k);
|
||||
|
||||
if (isValid(pipe))
|
||||
if (isValid(pipe)) {
|
||||
return pipe.isIndirectlyPoweringTo(l);
|
||||
else
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"all"})
|
||||
|
@ -1062,9 +1087,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
|
||||
try {
|
||||
Class<? extends Pipe> pipe = pipes.get(key);
|
||||
if (pipe != null)
|
||||
if (pipe != null) {
|
||||
return pipe.getConstructor(Item.class).newInstance(key);
|
||||
else {
|
||||
} else {
|
||||
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;
|
||||
|
||||
Pipe pipe = getPipe(worldObj, x, y, z);
|
||||
if (pipe == null)
|
||||
if (pipe == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
||||
|
||||
|
@ -1224,8 +1250,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
@Override
|
||||
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||
Pipe pipe = getPipe(worldObj, x, y, z);
|
||||
if (pipe == null)
|
||||
if (pipe == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
|
@ -93,10 +94,12 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
eventHandlers.put(getClass(), handlerMap);
|
||||
}
|
||||
EventHandler handler = handlerMap.get(event.getClass());
|
||||
if (handler == null)
|
||||
if (handler == null) {
|
||||
handler = makeEventHandler(event, handlerMap);
|
||||
if (handler.method == null)
|
||||
}
|
||||
if (handler.method == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
handler.method.invoke(this, event);
|
||||
} catch (Exception ex) {
|
||||
|
@ -137,11 +140,13 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
if (tile instanceof TileGenericPipe) {
|
||||
otherPipe = ((TileGenericPipe) tile).pipe;
|
||||
|
||||
if (!BlockGenericPipe.isFullyDefined(otherPipe))
|
||||
if (!BlockGenericPipe.isFullyDefined(otherPipe)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!PipeConnectionBans.canPipesConnect(getClass(), otherPipe.getClass()))
|
||||
if (!PipeConnectionBans.canPipesConnect(getClass(), otherPipe.getClass())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return transport.canPipeConnect(tile, side);
|
||||
}
|
||||
|
@ -251,10 +256,11 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
if (tile instanceof TileGenericPipe) {
|
||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
||||
|
||||
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe))
|
||||
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe)) {
|
||||
if (isWireConnectedTo(tile, 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) {
|
||||
if (!wireSet[wire.ordinal()])
|
||||
if (!wireSet[wire.ordinal()]) {
|
||||
return;
|
||||
}
|
||||
|
||||
// STEP 1: compute internal signal strength
|
||||
|
||||
|
@ -304,18 +311,20 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
if (tile instanceof TileGenericPipe) {
|
||||
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)) {
|
||||
tilePipe.pipe.receiveSignal(signalStrength[wire.ordinal()] - 1, wire);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean receiveSignal(int signal, PipeWire color) {
|
||||
if (container.getWorldObj() == null)
|
||||
if (container.getWorldObj() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int oldSignal = signalStrength[color.ordinal()];
|
||||
|
||||
|
@ -328,8 +337,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
}
|
||||
|
||||
return true;
|
||||
} else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean inputOpen(ForgeDirection from) {
|
||||
|
@ -344,8 +354,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
}
|
||||
|
||||
public boolean canConnectRedstone() {
|
||||
if (hasGate())
|
||||
if (hasGate()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -355,8 +366,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
ForgeDirection o = ForgeDirection.getOrientation(side).getOpposite();
|
||||
TileEntity tile = container.getTile(o);
|
||||
|
||||
if (tile instanceof TileGenericPipe && container.isPipeConnected(o))
|
||||
if (tile instanceof TileGenericPipe && container.isPipeConnected(o)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return gate.getRedstoneOutput();
|
||||
}
|
||||
|
@ -373,8 +385,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
// / @Override TODO: should be in IPipe
|
||||
public boolean isWired() {
|
||||
for (PipeWire color : PipeWire.values()) {
|
||||
if (isWired(color))
|
||||
if (isWired(color)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -410,13 +423,15 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (container.isPipeConnected(o)) {
|
||||
connections++;
|
||||
if (connections == 1)
|
||||
if (connections == 1) {
|
||||
targetOrientation = o;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (connections > 1 || connections == 0)
|
||||
if (connections > 1 || connections == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return targetOrientation.getOpposite() != side;
|
||||
}
|
||||
|
@ -439,8 +454,10 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
}
|
||||
|
||||
public void onBlockRemoval() {
|
||||
for (ItemStack stack : computeItemDrop()) {
|
||||
dropItem(stack);
|
||||
if (getWorld().getWorldInfo().getGameType() != GameType.CREATIVE) {
|
||||
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) {
|
||||
if (!(tile instanceof TileGenericPipe))
|
||||
if (!(tile instanceof TileGenericPipe)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
||||
|
||||
if (!BlockGenericPipe.isFullyDefined(tilePipe.pipe))
|
||||
if (!BlockGenericPipe.isFullyDefined(tilePipe.pipe)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tilePipe.pipe.wireSet[color.ordinal()])
|
||||
if (!tilePipe.pipe.wireSet[color.ordinal()]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (tilePipe.pipe.transport instanceof PipeTransportStructure || transport instanceof PipeTransportStructure || Utils.checkPipesConnections(
|
||||
container, tile));
|
||||
|
@ -534,13 +554,15 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
|
||||
Connections_num++;
|
||||
|
||||
if (Connections_num == 1)
|
||||
if (Connections_num == 1) {
|
||||
target_orientation = o;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Connections_num > 1 || Connections_num == 0)
|
||||
if (Connections_num > 1 || Connections_num == 0) {
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
return target_orientation.getOpposite();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import buildcraft.core.render.RenderUtils;
|
|||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -47,6 +48,14 @@ public class FacadeItemRenderer implements IItemRenderer {
|
|||
|
||||
// Render Facade
|
||||
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);
|
||||
render.setRenderBoundsFromBlock(block);
|
||||
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));
|
||||
tessellator.draw();
|
||||
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();
|
||||
|
||||
// Render StructurePipe
|
||||
|
|
|
@ -11,20 +11,14 @@ package buildcraft.transport.render;
|
|||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
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.transport.TileGenericPipe;
|
||||
|
||||
import buildcraft.transport.*;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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) {
|
||||
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) {
|
||||
TileGenericPipe pipeTile = (TileGenericPipe) tile;
|
||||
renderPipe(renderer, world, (BlockGenericPipe) block, pipeTile, x, y, z);
|
||||
|
|
Loading…
Reference in a new issue