Merge branch 'master' into builder
This commit is contained in:
commit
6802882d42
38 changed files with 375 additions and 394 deletions
|
@ -11,6 +11,7 @@ features or change existing behaviour or balance, please discuss it with Sengir
|
|||
If you don't, we might assume that you are using latest-greatest and waste a bunch of time trying to reproduce
|
||||
a problem that might have fixed been already. Such things makes for very grumpy devs. Grumpy devs spend
|
||||
less time coding and more time doing stuff that makes them less grumpy.
|
||||
* If the issues occurs on a server, be sure it's a vanilla forge server and <b>not</b> a mcpc+ server.
|
||||
|
||||
#### Frequently reported
|
||||
* java.lang.AbstractMethodError - Incompatibility between BC/Forge/Mod using BC API. Usually not a BC issue
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<dirname property="imported.basedir" file="${ant.file.BuildCraft}"/>
|
||||
<property name="build.dir" value="build"/>
|
||||
<property name="src.dir" value="${imported.basedir}"/>
|
||||
<property name="lang.dir" value="../buildcraft.localization"/>
|
||||
<property name="lang.dir" value="${imported.basedir}/../buildcraft.localization"/>
|
||||
<property name="resources.dir" value="${imported.basedir}/buildcraft_resources"/>
|
||||
|
||||
<property name="download.dir" value="download"/>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Wed Aug 07 16:42:06 CEST 2013
|
||||
build.number=38
|
||||
#Fri Aug 09 09:44:46 CEST 2013
|
||||
build.number=39
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<property name="mc.version" value="1.6.2"/>
|
||||
<property name="forge.version" value="9.10.0.807"/>
|
||||
<property name="bc.version" value="4.0.0"/>
|
||||
<property name="bc.version" value="4.0.1"/>
|
||||
|
||||
<property name="bc.version.full" value="${bc.version}"/>
|
||||
|
||||
|
|
8
buildcraft_resources/changelog/3.7.2
Normal file
8
buildcraft_resources/changelog/3.7.2
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
#3.7.2
|
||||
|
||||
- Added: Filtered Buffer. See http://www.youtube.com/watch?v=-Fusb7bEQW4 (SandGrainOne)
|
||||
- Changed: Added colour modifier support to facades. (CovertJaguar)
|
||||
- Changed: Tweaked selection box for plugs to make it easier to place plugs even on adjacent pipes. (CovertJaguar)
|
||||
- Bugfix: Fixed log rotation recipes for facades again. (cpw)
|
||||
- Bugfix: Fixed edge case where the ACT might not consider items as crafting equivalents if those were registered multiple times with the ore dictionary.
|
5
buildcraft_resources/changelog/4.0.1
Normal file
5
buildcraft_resources/changelog/4.0.1
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
#4.0.1
|
||||
|
||||
- Bugfix: Fixed a critical issue with the safetime tracker.
|
||||
- Bugfix: Fixed a dupe glitch in the automatic work bench.
|
|
@ -153,7 +153,7 @@ public class BuildCraftCore {
|
|||
|
||||
public static boolean loadDefaultRecipes = true;
|
||||
public static boolean forcePneumaticPower = true;
|
||||
public static boolean consumeWaterSources = true;
|
||||
public static boolean consumeWaterSources = false;
|
||||
|
||||
public static BptItem[] itemBptProps = new BptItem[Item.itemsList.length];
|
||||
|
||||
|
@ -222,9 +222,12 @@ public class BuildCraftCore {
|
|||
Property diamondGearId = BuildCraftCore.mainConfiguration.getItem("diamondGearItem.id", DefaultProps.DIAMOND_GEAR_ID);
|
||||
Property modifyWorldProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "modifyWorld", true);
|
||||
modifyWorldProp.comment = "set to false if BuildCraft should not generate custom blocks (e.g. oil)";
|
||||
|
||||
modifyWorld = modifyWorldProp.getBoolean(true);
|
||||
|
||||
Property consumeWater = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "consumeWater", consumeWaterSources);
|
||||
consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
|
||||
consumeWater.comment = "set to true if the Pump should consume water";
|
||||
|
||||
if(BuildCraftCore.modifyWorld) {
|
||||
springBlock = new BlockSpring(springId.getInt()).setUnlocalizedName("eternalSpring");
|
||||
CoreProxy.proxy.registerBlock(springBlock, ItemSpring.class);
|
||||
|
|
|
@ -194,7 +194,7 @@ public class BuildCraftEnergy {
|
|||
LanguageRegistry.addName(bucketFuel, "Fuel Bucket");
|
||||
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("fuel", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Item.bucketEmpty));
|
||||
}
|
||||
|
||||
|
||||
BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
|
||||
BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
|
||||
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
|
||||
|
@ -238,8 +238,8 @@ public class BuildCraftEnergy {
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void textureHook(TextureStitchEvent.Post event) {
|
||||
if (event.map.textureType == 0) {
|
||||
buildcraftFluidOil.setIcons(blockOil.getBlockTextureFromSide(1));
|
||||
buildcraftFluidFuel.setIcons(blockFuel.getBlockTextureFromSide(1));
|
||||
buildcraftFluidOil.setIcons(blockOil.getBlockTextureFromSide(1), blockOil.getBlockTextureFromSide(2));
|
||||
buildcraftFluidFuel.setIcons(blockFuel.getBlockTextureFromSide(1), blockFuel.getBlockTextureFromSide(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -306,6 +306,16 @@ public class BuildCraftFactory {
|
|||
'I', Item.ingotIron,
|
||||
'C', Block.chest,
|
||||
'G', BuildCraftCore.stoneGearItem);
|
||||
|
||||
if (floodGateBlock != null)
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(floodGateBlock),
|
||||
"IGI",
|
||||
"FTF",
|
||||
"IFI",
|
||||
'I', Item.ingotIron,
|
||||
'T', tankBlock != null ? tankBlock : Block.glass,
|
||||
'G', BuildCraftCore.ironGearItem,
|
||||
'F', new ItemStack(Block.fenceIron));
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
|
|
|
@ -315,6 +315,7 @@ public final class PowerHandler {
|
|||
* @return
|
||||
*/
|
||||
public float powerRequest() {
|
||||
update();
|
||||
return Math.min(maxEnergyReceived, maxEnergyStored - energyStored);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockButton;
|
||||
import net.minecraft.block.BlockLever;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -9,16 +13,35 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
public class ItemWrench extends ItemBuildCraft implements IToolWrench {
|
||||
|
||||
private final Set<Class<? extends Block>> shiftRotations = new HashSet<Class<? extends Block>>();
|
||||
|
||||
public ItemWrench(int i) {
|
||||
super(i);
|
||||
setFull3D();
|
||||
shiftRotations.add(BlockLever.class);
|
||||
shiftRotations.add(BlockButton.class);
|
||||
}
|
||||
|
||||
private boolean isShiftRotation(Class<? extends Block> cls) {
|
||||
for (Class<? extends Block> shift : shiftRotations) {
|
||||
if (shift.isAssignableFrom(cls))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
int blockId = world.getBlockId(x, y, z);
|
||||
Block block = Block.blocksList[blockId];
|
||||
if (block != null && block.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side))) {
|
||||
|
||||
if(block == null)
|
||||
return false;
|
||||
|
||||
if (player.isSneaking() != isShiftRotation(block.getClass()))
|
||||
return false;
|
||||
|
||||
if (block.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side))) {
|
||||
player.swingItem();
|
||||
return !world.isRemote;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,12 @@ public final class TileBuffer {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
if(tile != null && !tile.isInvalid())
|
||||
return true;
|
||||
return world.blockExists(x, y, z);
|
||||
}
|
||||
|
||||
public static TileBuffer[] makeBuffer(World world, int x, int y, int z, boolean loadUnloaded) {
|
||||
TileBuffer[] buffer = new TileBuffer[6];
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
|
|
@ -30,18 +30,22 @@ public class SingleUseTank extends Tank {
|
|||
public int fill(FluidStack resource, boolean doFill) {
|
||||
if (resource == null)
|
||||
return 0;
|
||||
if (acceptedFluid == null)
|
||||
if (doFill && acceptedFluid == null)
|
||||
acceptedFluid = resource.getFluid();
|
||||
if (acceptedFluid != resource.getFluid())
|
||||
return 0;
|
||||
return super.fill(resource, doFill);
|
||||
if (acceptedFluid == null || acceptedFluid == resource.getFluid())
|
||||
return super.fill(resource, doFill);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
acceptedFluid = null;
|
||||
}
|
||||
|
||||
public Fluid getAcceptedFluid(){
|
||||
|
||||
public void setAcceptedFluid(Fluid fluid) {
|
||||
this.acceptedFluid = fluid;
|
||||
}
|
||||
|
||||
public Fluid getAcceptedFluid() {
|
||||
return acceptedFluid;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,19 +28,19 @@ import net.minecraftforge.fluids.IFluidHandler;
|
|||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info/>
|
||||
*/
|
||||
public class TankManager extends ForwardingList<Tank> implements IFluidHandler, List<Tank> {
|
||||
public class TankManager<T extends Tank> extends ForwardingList<T> implements IFluidHandler, List<T> {
|
||||
|
||||
private List<Tank> tanks = new ArrayList<Tank>();
|
||||
private List<T> tanks = new ArrayList<T>();
|
||||
|
||||
public TankManager() {
|
||||
}
|
||||
|
||||
public TankManager(Tank... tanks) {
|
||||
public TankManager(T... tanks) {
|
||||
addAll(Arrays.asList(tanks));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Tank> delegate() {
|
||||
protected List<T> delegate() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package buildcraft.core.network;
|
|||
public class PacketIds {
|
||||
|
||||
public static final int TILE_UPDATE = 0;
|
||||
public static final int PIPE_DESCRIPTION = 1;
|
||||
// public static final int PIPE_DESCRIPTION = 1;
|
||||
public static final int PIPE_CONTENTS = 2;
|
||||
public static final int PIPE_LIQUID = 3;
|
||||
public static final int PIPE_POWER = 4;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TileEngineIron extends TileEngine implements IFluidHandler {
|
|||
|
||||
public static int MAX_LIQUID = FluidContainerRegistry.BUCKET_VOLUME * 10;
|
||||
public static float HEAT_PER_MJ = 0.0023F;
|
||||
public static float COOLDOWN_RATE = 0.005F;
|
||||
public static float COOLDOWN_RATE = 0.01F;
|
||||
int burnTime = 0;
|
||||
private Tank tankFuel;
|
||||
private Tank tankCoolant;
|
||||
|
|
|
@ -13,7 +13,7 @@ import buildcraft.api.core.Position;
|
|||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.GuiIds;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.fluids.FluidUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -29,8 +29,11 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import static net.minecraftforge.common.ForgeDirection.EAST;
|
||||
import static net.minecraftforge.common.ForgeDirection.NORTH;
|
||||
import static net.minecraftforge.common.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.ForgeDirection.WEST;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class BlockRefinery extends BlockContainer {
|
||||
|
||||
|
@ -77,53 +80,54 @@ public class BlockRefinery extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
|
||||
// Drop through if the player is sneaking
|
||||
if (entityplayer.isSneaking()) {
|
||||
public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
switch (ForgeDirection.getOrientation(meta)) {
|
||||
case WEST:
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal(), 3);
|
||||
break;
|
||||
case EAST:
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal(), 3);
|
||||
break;
|
||||
case NORTH:
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal(), 3);
|
||||
break;
|
||||
case SOUTH:
|
||||
default:
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal(), 3);
|
||||
break;
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (!(tile instanceof TileRefinery))
|
||||
return false;
|
||||
|
||||
ItemStack current = player.getCurrentEquippedItem();
|
||||
Item equipped = current != null ? current.getItem() : null;
|
||||
if (player.isSneaking() && equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(player, x, y, z)) {
|
||||
((TileRefinery)tile).resetFilters();
|
||||
((IToolWrench) equipped).wrenchUsed(player, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null;
|
||||
if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(entityplayer, i, j, k)) {
|
||||
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
|
||||
switch (ForgeDirection.values()[meta]) {
|
||||
case WEST:
|
||||
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.SOUTH.ordinal(), 0);
|
||||
break;
|
||||
case EAST:
|
||||
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.NORTH.ordinal(), 0);
|
||||
break;
|
||||
case NORTH:
|
||||
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.WEST.ordinal(), 0);
|
||||
break;
|
||||
case SOUTH:
|
||||
default:
|
||||
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.EAST.ordinal(), 0);
|
||||
break;
|
||||
}
|
||||
((IToolWrench) equipped).wrenchUsed(entityplayer, i, j, k);
|
||||
world.markBlockForUpdate(i, j, k);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(entityplayer.getCurrentEquippedItem());
|
||||
|
||||
if (liquid != null) {
|
||||
int qty = ((TileRefinery) world.getBlockTileEntity(i, j, k)).fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
|
||||
if (qty != 0 && !BuildCraftCore.debugMode && !entityplayer.capabilities.isCreativeMode) {
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
|
||||
Utils.consumeItem(entityplayer.inventory.getCurrentItem()));
|
||||
}
|
||||
|
||||
if (current != null && current.itemID != Item.bucketEmpty.itemID) {
|
||||
if (!world.isRemote) {
|
||||
if (FluidUtils.handleRightClick((TileRefinery) tile, ForgeDirection.getOrientation(side), player, true, false))
|
||||
return true;
|
||||
} else if (FluidContainerRegistry.isContainer(current)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
||||
entityplayer.openGui(BuildCraftFactory.instance, GuiIds.REFINERY, world, i, j, k);
|
||||
if (!world.isRemote) {
|
||||
player.openGui(BuildCraftFactory.instance, GuiIds.REFINERY, world, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -59,6 +59,7 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
|
|||
private TileBuffer[] tileBuffer = null;
|
||||
private SafeTimeTracker timer = new SafeTimeTracker();
|
||||
private int tick = Utils.RANDOM.nextInt();
|
||||
private int numFluidBlocksFound = 0;
|
||||
|
||||
public TilePump() {
|
||||
powerHandler = new PowerHandler(this, Type.MACHINE);
|
||||
|
@ -103,9 +104,9 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
|
|||
if (isFluidAllowed(fluidToPump.getFluid()) && tank.fill(fluidToPump, false) == fluidToPump.amount) {
|
||||
|
||||
if (powerHandler.useEnergy(10, 10, true) == 10) {
|
||||
index = getNextIndexToPump(true);
|
||||
|
||||
if (fluidToPump.getFluid() != FluidRegistry.WATER || BuildCraftCore.consumeWaterSources) {
|
||||
if (fluidToPump.getFluid() != FluidRegistry.WATER || BuildCraftCore.consumeWaterSources || numFluidBlocksFound < 9) {
|
||||
index = getNextIndexToPump(true);
|
||||
BlockUtil.drainBlock(worldObj, index.x, index.y, index.z, true);
|
||||
}
|
||||
|
||||
|
@ -202,6 +203,7 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
|
|||
}
|
||||
|
||||
public void rebuildQueue() {
|
||||
numFluidBlocksFound = 0;
|
||||
pumpLayerQueues.clear();
|
||||
int x = xCoord;
|
||||
int y = aimY;
|
||||
|
@ -230,6 +232,9 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
|
|||
queueForPumping(index.x - 1, index.y, index.z, visitedBlocks, fluidsFound, pumpingFluid);
|
||||
queueForPumping(index.x, index.y, index.z + 1, visitedBlocks, fluidsFound, pumpingFluid);
|
||||
queueForPumping(index.x, index.y, index.z - 1, visitedBlocks, fluidsFound, pumpingFluid);
|
||||
|
||||
if (pumpingFluid == FluidRegistry.WATER && !BuildCraftCore.consumeWaterSources && numFluidBlocksFound >= 9)
|
||||
return;
|
||||
|
||||
// if (System.nanoTime() > timeoutTime)
|
||||
// return;
|
||||
|
@ -249,6 +254,7 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
|
|||
}
|
||||
if (canDrainBlock(blockId, x, y, z, pumpingFluid)) {
|
||||
getLayerQueue(y).add(index);
|
||||
numFluidBlocksFound++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +315,12 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
|
|||
@Override
|
||||
public boolean isActive() {
|
||||
BlockIndex next = getNextIndexToPump(false);
|
||||
return isPumpableFluid(next.x, next.y, next.z);
|
||||
|
||||
if (next != null) {
|
||||
return isPumpableFluid(next.x, next.y, next.z);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,7 @@ import buildcraft.api.recipes.RefineryRecipes;
|
|||
import buildcraft.api.recipes.RefineryRecipes.Recipe;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.fluids.SingleUseTank;
|
||||
import buildcraft.core.fluids.Tank;
|
||||
import buildcraft.core.fluids.TankManager;
|
||||
import buildcraft.core.network.PacketPayload;
|
||||
|
@ -43,12 +44,11 @@ import net.minecraftforge.fluids.IFluidHandler;
|
|||
|
||||
public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowerReceptor, IInventory, IMachine {
|
||||
|
||||
private Fluid[] filters = new Fluid[2];
|
||||
public static int LIQUID_PER_SLOT = FluidContainerRegistry.BUCKET_VOLUME * 4;
|
||||
public Tank tank1 = new Tank("tank1", LIQUID_PER_SLOT);
|
||||
public Tank tank2 = new Tank("tank2", LIQUID_PER_SLOT);
|
||||
public Tank result = new Tank("result", LIQUID_PER_SLOT);
|
||||
public TankManager tankManager = new TankManager(tank1, tank2, result);
|
||||
public SingleUseTank tank1 = new SingleUseTank("tank1", LIQUID_PER_SLOT);
|
||||
public SingleUseTank tank2 = new SingleUseTank("tank2", LIQUID_PER_SLOT);
|
||||
public SingleUseTank result = new SingleUseTank("result", LIQUID_PER_SLOT);
|
||||
public TankManager<SingleUseTank> tankManager = new TankManager<SingleUseTank>(tank1, tank2, result);
|
||||
public float animationSpeed = 1;
|
||||
private int animationStage = 0;
|
||||
SafeTimeTracker time = new SafeTimeTracker();
|
||||
|
@ -124,11 +124,11 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowe
|
|||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
simpleAnimationIterate();
|
||||
return;
|
||||
|
||||
} else if (CoreProxy.proxy.isSimulating(worldObj) && updateNetworkTime.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
||||
if (updateNetworkTime.markTimeIfDelay(worldObj, BuildCraftCore.updateFactor))
|
||||
sendNetworkUpdate();
|
||||
|
||||
isActive = false;
|
||||
|
||||
Recipe currentRecipe = RefineryRecipes.findRefineryRecipe(tank1.getFluid(), tank2.getFluid());
|
||||
|
@ -217,9 +217,6 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowe
|
|||
|
||||
powerHandler.readFromNBT(data);
|
||||
initPowerProvider();
|
||||
|
||||
filters[0] = FluidRegistry.getFluid(data.getString("filter0"));
|
||||
filters[1] = FluidRegistry.getFluid(data.getString("filter1"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -231,11 +228,6 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowe
|
|||
data.setInteger("animationStage", animationStage);
|
||||
data.setFloat("animationSpeed", animationSpeed);
|
||||
powerHandler.writeToNBT(data);
|
||||
|
||||
if (filters[0] != null)
|
||||
data.setString("filter0", filters[0].getName());
|
||||
if (filters[1] != null)
|
||||
data.setString("filter1", filters[1].getName());
|
||||
}
|
||||
|
||||
public int getAnimationStage() {
|
||||
|
@ -295,12 +287,18 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowe
|
|||
public void closeChest() {
|
||||
}
|
||||
|
||||
public void resetFilters() {
|
||||
for (SingleUseTank tank : tankManager) {
|
||||
tank.setAcceptedFluid(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFilter(int number, Fluid fluid) {
|
||||
filters[number] = fluid;
|
||||
tankManager.get(number).setAcceptedFluid(fluid);
|
||||
}
|
||||
|
||||
public Fluid getFilter(int number) {
|
||||
return filters[number];
|
||||
return tankManager.get(number).getAcceptedFluid();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -312,19 +310,19 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowe
|
|||
public void getGUINetworkData(int id, int data) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
filters[0] = FluidRegistry.getFluid(data);
|
||||
setFilter(0, FluidRegistry.getFluid(data));
|
||||
break;
|
||||
case 1:
|
||||
filters[1] = FluidRegistry.getFluid(data);
|
||||
setFilter(1, FluidRegistry.getFluid(data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
if (filters[0] != null)
|
||||
iCrafting.sendProgressBarUpdate(container, 0, filters[0].getID());
|
||||
if (filters[1] != null)
|
||||
iCrafting.sendProgressBarUpdate(container, 1, filters[1].getID());
|
||||
if (getFilter(0) != null)
|
||||
iCrafting.sendProgressBarUpdate(container, 0, getFilter(0).getID());
|
||||
if (getFilter(1) != null)
|
||||
iCrafting.sendProgressBarUpdate(container, 1, getFilter(1).getID());
|
||||
}
|
||||
|
||||
/* ITANKCONTAINER */
|
||||
|
@ -333,26 +331,9 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowe
|
|||
int used = 0;
|
||||
FluidStack resourceUsing = resource.copy();
|
||||
|
||||
if (filters[0] != null || filters[1] != null) {
|
||||
if (filters[0] == resource.getFluid()) {
|
||||
used += tank1.fill(resourceUsing, doFill);
|
||||
}
|
||||
|
||||
resourceUsing.amount -= used;
|
||||
|
||||
if (filters[1] == resource.getFluid()) {
|
||||
used += tank2.fill(resourceUsing, doFill);
|
||||
}
|
||||
} else {
|
||||
used += tank1.fill(resourceUsing, doFill);
|
||||
resourceUsing.amount -= used;
|
||||
used += tank2.fill(resourceUsing, doFill);
|
||||
}
|
||||
|
||||
if (doFill && used > 0) {
|
||||
updateNetworkTime.markTime(worldObj);
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
used += tank1.fill(resourceUsing, doFill);
|
||||
resourceUsing.amount -= used;
|
||||
used += tank2.fill(resourceUsing, doFill);
|
||||
|
||||
return used;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
|
||||
if (position >= 0 && position < 2) {
|
||||
if (k == 0) {
|
||||
if (!this.isShiftKeyDown()) {
|
||||
if (!isShiftKeyDown()) {
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(mc.thePlayer.inventory.getItemStack());
|
||||
|
||||
if (liquid == null) {
|
||||
|
@ -84,7 +84,6 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
}
|
||||
|
||||
container.setFilter(position, liquid.getFluid());
|
||||
return;
|
||||
} else {
|
||||
container.setFilter(position, null);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ package buildcraft.factory.render;
|
|||
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.IInventoryRenderer;
|
||||
import buildcraft.core.fluids.Tank;
|
||||
import buildcraft.core.render.FluidRenderer;
|
||||
import buildcraft.factory.TileRefinery;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
|
@ -183,7 +184,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent
|
|||
if (list1 != null) {
|
||||
func_110628_a(FluidRenderer.getFluidSheet(liquid1));
|
||||
FluidRenderer.setColorForFluidStack(liquid1);
|
||||
GL11.glCallList(list1[(int) ((float) liquid1.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]);
|
||||
GL11.glCallList(list1[getDisplayListIndex(tile.tank1)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +196,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent
|
|||
GL11.glTranslatef(0, 0, 1);
|
||||
func_110628_a(FluidRenderer.getFluidSheet(liquid2));
|
||||
FluidRenderer.setColorForFluidStack(liquid2);
|
||||
GL11.glCallList(list2[(int) ((float) liquid2.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]);
|
||||
GL11.glCallList(list2[getDisplayListIndex(tile.tank2)]);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +210,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent
|
|||
GL11.glTranslatef(1, 0, 0.5F);
|
||||
func_110628_a(FluidRenderer.getFluidSheet(liquidResult));
|
||||
FluidRenderer.setColorForFluidStack(liquidResult);
|
||||
GL11.glCallList(list3[(int) ((float) liquidResult.amount / (float) TileRefinery.LIQUID_PER_SLOT * (FluidRenderer.DISPLAY_STAGES - 1))]);
|
||||
GL11.glCallList(list3[getDisplayListIndex(tile.result)]);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
@ -219,4 +220,8 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent
|
|||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private int getDisplayListIndex(Tank tank) {
|
||||
return Math.min((int) ((float) tank.getFluidAmount() / (float) tank.getCapacity() * (FluidRenderer.DISPLAY_STAGES - 1)), FluidRenderer.DISPLAY_STAGES - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package buildcraft.silicon;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import buildcraft.core.ItemBlockBuildCraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemLaserTable extends ItemBlock {
|
||||
public class ItemLaserTable extends ItemBlockBuildCraft {
|
||||
public ItemLaserTable(int par1) {
|
||||
super(par1);
|
||||
setMaxDamage(0);
|
||||
|
@ -12,7 +12,7 @@ public class ItemLaserTable extends ItemBlock {
|
|||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
return par1ItemStack.getItemDamage() == 0 ? "block.assemblyTableBlock" : "block.assemblyWorkbenchBlock";
|
||||
return par1ItemStack.getItemDamage() == 0 ? "tile.assemblyTableBlock" : "tile.assemblyWorkbenchBlock";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,6 +65,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
}
|
||||
private static Random rand = new Random();
|
||||
private boolean skippedFirstIconRegister;
|
||||
private char renderAxis = 'a';
|
||||
|
||||
/* Defined subprograms ************************************************* */
|
||||
public BlockGenericPipe(int i) {
|
||||
|
@ -96,6 +97,22 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void setRenderAxis(char axis) {
|
||||
this.renderAxis = axis;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
if (renderAxis == 'x')
|
||||
return side == 4 || side == 5;
|
||||
if (renderAxis == 'y')
|
||||
return side == 0 || side == 1;
|
||||
if (renderAxis == 'z')
|
||||
return side == 2 || side == 3;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) {
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
|
@ -116,39 +133,39 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
|
||||
TileEntity tile1 = world.getBlockTileEntity(i, j, k);
|
||||
TileGenericPipe tileG = (TileGenericPipe) tile1;
|
||||
if (tile1 instanceof TileGenericPipe) {
|
||||
TileGenericPipe tileG = (TileGenericPipe) tile1;
|
||||
|
||||
if (tileG.isPipeConnected(ForgeDirection.WEST)) {
|
||||
setBlockBounds(0.0F, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
if (tileG.isPipeConnected(ForgeDirection.WEST)) {
|
||||
setBlockBounds(0.0F, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
if (tileG.isPipeConnected(ForgeDirection.EAST)) {
|
||||
setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, 1.0F, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
if (tileG.isPipeConnected(ForgeDirection.EAST)) {
|
||||
setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, 1.0F, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
if (tileG.isPipeConnected(ForgeDirection.DOWN)) {
|
||||
setBlockBounds(Utils.pipeMinPos, 0.0F, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
if (tileG.isPipeConnected(ForgeDirection.DOWN)) {
|
||||
setBlockBounds(Utils.pipeMinPos, 0.0F, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
if (tileG.isPipeConnected(ForgeDirection.UP)) {
|
||||
setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, 1.0F, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
if (tileG.isPipeConnected(ForgeDirection.UP)) {
|
||||
setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, 1.0F, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
if (tileG.isPipeConnected(ForgeDirection.NORTH)) {
|
||||
setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, 0.0F, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
if (tileG.isPipeConnected(ForgeDirection.NORTH)) {
|
||||
setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, 0.0F, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
if (tileG.isPipeConnected(ForgeDirection.SOUTH)) {
|
||||
setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, 1.0F);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
if (tileG.isPipeConnected(ForgeDirection.SOUTH)) {
|
||||
setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, 1.0F);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
if (tileG != null) {
|
||||
float facadeThickness = PipeWorldRenderer.facadeThickness;
|
||||
|
||||
if (tileG.hasFacade(ForgeDirection.EAST)) {
|
||||
|
@ -181,7 +198,6 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
}
|
||||
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -253,7 +269,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
}
|
||||
}
|
||||
|
||||
public RaytraceResult doRayTrace(World world, int x, int y, int z, EntityPlayer entityPlayer) {
|
||||
private RaytraceResult doRayTrace(World world, int x, int y, int z, EntityPlayer entityPlayer) {
|
||||
double pitch = Math.toRadians(entityPlayer.rotationPitch);
|
||||
double yaw = Math.toRadians(entityPlayer.rotationYaw);
|
||||
|
||||
|
@ -273,28 +289,28 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
return doRayTrace(world, x, y, z, origin, direction);
|
||||
}
|
||||
|
||||
public RaytraceResult doRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction) {
|
||||
private RaytraceResult doRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction) {
|
||||
float xMin = Utils.pipeMinPos, xMax = Utils.pipeMaxPos, yMin = Utils.pipeMinPos, yMax = Utils.pipeMaxPos, zMin = Utils.pipeMinPos, zMax = Utils.pipeMaxPos;
|
||||
|
||||
TileEntity pipeTileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
|
||||
TileGenericPipe tileG = null;
|
||||
if(pipeTileEntity instanceof TileGenericPipe)
|
||||
tileG = (TileGenericPipe)pipeTileEntity;
|
||||
|
||||
if(tileG == null)
|
||||
if (pipeTileEntity instanceof TileGenericPipe)
|
||||
tileG = (TileGenericPipe) pipeTileEntity;
|
||||
|
||||
if (tileG == null)
|
||||
return null;
|
||||
|
||||
|
||||
Pipe pipe = tileG.pipe;
|
||||
|
||||
if (!isValid(pipe))
|
||||
return null;
|
||||
return null;
|
||||
|
||||
/**
|
||||
* pipe hits along x, y, and z axis, gate (all 6 sides) [and
|
||||
* wires+facades]
|
||||
*/
|
||||
MovingObjectPosition[] hits = new MovingObjectPosition[]{null, null, null, null, null, null, null, null, null};
|
||||
MovingObjectPosition[] hits = new MovingObjectPosition[9];
|
||||
|
||||
boolean needAxisCheck = false;
|
||||
boolean needCenterCheck = true;
|
||||
|
@ -508,6 +524,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1) {
|
||||
return new TileGenericPipe();
|
||||
}
|
||||
|
@ -560,8 +577,8 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
|
||||
/* Wrappers ************************************************************ */
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int l) {
|
||||
super.onNeighborBlockChange(world, x, y, z, l);
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int id) {
|
||||
super.onNeighborBlockChange(world, x, y, z, id);
|
||||
|
||||
Pipe pipe = getPipe(world, x, y, z);
|
||||
|
||||
|
@ -748,6 +765,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
|
||||
@SuppressWarnings({"all"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Icon getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
|
||||
TileEntity tile = iblockaccess.getBlockTileEntity(i, j, k);
|
||||
|
|
|
@ -15,5 +15,5 @@ public interface IPipeTransportPowerHook {
|
|||
|
||||
public float receiveEnergy(ForgeDirection from, float val);
|
||||
|
||||
public void requestEnergy(ForgeDirection from, float amount);
|
||||
public float requestEnergy(ForgeDirection from, float amount);
|
||||
}
|
||||
|
|
|
@ -254,12 +254,11 @@ public class PipeTransportItems extends PipeTransport {
|
|||
public ForgeDirection resolveDestination(TravelingItem data) {
|
||||
LinkedList<ForgeDirection> listOfPossibleMovements = getPossibleMovements(data);
|
||||
|
||||
if (listOfPossibleMovements.size() == 0)
|
||||
if (listOfPossibleMovements.isEmpty())
|
||||
return ForgeDirection.UNKNOWN;
|
||||
else {
|
||||
int i = container.worldObj.rand.nextInt(listOfPossibleMovements.size());
|
||||
return listOfPossibleMovements.get(i);
|
||||
}
|
||||
|
||||
int i = container.worldObj.rand.nextInt(listOfPossibleMovements.size());
|
||||
return listOfPossibleMovements.get(i);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,13 +271,13 @@ public class PipeTransportItems extends PipeTransport {
|
|||
item.blacklist.add(item.input.getOpposite());
|
||||
|
||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (!item.blacklist.contains(o) && container.pipe.outputOpen(o))
|
||||
if (canReceivePipeObjects(o, item)) {
|
||||
result.add(o);
|
||||
}
|
||||
if(item.blacklist.contains(o))
|
||||
continue;
|
||||
if (container.pipe.outputOpen(o) && canReceivePipeObjects(o, item))
|
||||
result.add(o);
|
||||
}
|
||||
|
||||
if (result.size() == 0 && allowBouncing) {
|
||||
if (allowBouncing && result.isEmpty()) {
|
||||
if (canReceivePipeObjects(item.input.getOpposite(), item)) {
|
||||
result.add(item.input.getOpposite());
|
||||
}
|
||||
|
@ -394,7 +393,7 @@ public class PipeTransportItems extends PipeTransport {
|
|||
if (passToNextPipe(item, tile)) {
|
||||
// NOOP
|
||||
} else if (tile instanceof IInventory) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(container.worldObj)) {
|
||||
if (CoreProxy.proxy.isSimulating(container.worldObj)) {
|
||||
if (item.getInsertionHandler().canInsertItem(item, (IInventory) tile)) {
|
||||
ItemStack added = Transactor.getTransactorFor(tile).add(item.getItemStack(), item.output.getOpposite(), true);
|
||||
item.getItemStack().stackSize -= added.stackSize;
|
||||
|
|
|
@ -54,7 +54,7 @@ public class PipeTransportPower extends PipeTransport {
|
|||
public short[] clientDisplayPower = new short[6];
|
||||
public int overload;
|
||||
private int[] powerQuery = new int[6];
|
||||
private int[] nextPowerQuery = new int[6];
|
||||
public int[] nextPowerQuery = new int[6];
|
||||
private long currentDate;
|
||||
private float[] internalPower = new float[6];
|
||||
public float[] internalNextPower = new float[6];
|
||||
|
@ -336,7 +336,7 @@ public class PipeTransportPower extends PipeTransport {
|
|||
public void requestEnergy(ForgeDirection from, float amount) {
|
||||
step();
|
||||
if (this.container.pipe instanceof IPipeTransportPowerHook) {
|
||||
((IPipeTransportPowerHook) this.container.pipe).requestEnergy(from, amount);
|
||||
nextPowerQuery[from.ordinal()] += ((IPipeTransportPowerHook) this.container.pipe).requestEnergy(from, amount);
|
||||
} else {
|
||||
nextPowerQuery[from.ordinal()] += amount;
|
||||
}
|
||||
|
|
|
@ -30,12 +30,12 @@ import buildcraft.core.network.IClientState;
|
|||
import buildcraft.core.network.ISyncedTile;
|
||||
import buildcraft.core.network.PacketTileState;
|
||||
import buildcraft.transport.Gate.GateKind;
|
||||
import buildcraft.transport.network.PipeRenderStatePacket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.logging.Level;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -149,21 +149,26 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (!worldObj.isRemote) {
|
||||
if (deletePipe)
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
|
||||
if (deletePipe)
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
if (pipe == null)
|
||||
return;
|
||||
|
||||
if (pipe == null)
|
||||
return;
|
||||
|
||||
if (!initialized)
|
||||
initialize(pipe);
|
||||
if (!initialized)
|
||||
initialize(pipe);
|
||||
}
|
||||
|
||||
if (!BlockGenericPipe.isValid(pipe))
|
||||
return;
|
||||
|
||||
if (blockNeighborChange) {
|
||||
pipe.updateEntity();
|
||||
|
||||
if (worldObj.isRemote)
|
||||
return;
|
||||
|
||||
if (blockNeighborChange) {
|
||||
computeConnections();
|
||||
pipe.onNeighborBlockChange(0);
|
||||
blockNeighborChange = false;
|
||||
|
@ -176,21 +181,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
|
||||
PowerReceiver provider = getPowerReceiver(null);
|
||||
|
||||
if (provider != null)
|
||||
provider.update();
|
||||
|
||||
if (pipe != null)
|
||||
pipe.updateEntity();
|
||||
}
|
||||
|
||||
// PRECONDITION: worldObj must not be null
|
||||
private void refreshRenderState() {
|
||||
|
||||
// Only done on server/SSP
|
||||
if (worldObj.isRemote)
|
||||
return;
|
||||
|
||||
// Pipe connections;
|
||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||
renderState.pipeConnectionMatrix.setConnected(o, this.pipeConnectionsBuffer[o.ordinal()]);
|
||||
|
@ -344,15 +340,6 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
|
||||
/* SMP */
|
||||
public void handleDescriptionPacket(PipeRenderStatePacket packet) {
|
||||
if (worldObj.isRemote) {
|
||||
if (pipe == null && packet.getPipeId() != 0)
|
||||
initialize(BlockGenericPipe.createPipe(packet.getPipeId()));
|
||||
renderState = packet.getRenderState();
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
bindPipe();
|
||||
|
@ -390,7 +377,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
private TileBuffer[] getTileCache() {
|
||||
public TileBuffer[] getTileCache() {
|
||||
if (tileBuffer == null && pipe != null)
|
||||
tileBuffer = TileBuffer.makeBuffer(worldObj, xCoord, yCoord, zCoord, pipe.transport.delveIntoUnloadedChunks());
|
||||
return tileBuffer;
|
||||
|
@ -429,6 +416,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
* @return true if pipes are considered connected
|
||||
*/
|
||||
protected boolean canPipeConnect(TileEntity with, ForgeDirection side) {
|
||||
if (with == null)
|
||||
return false;
|
||||
|
||||
if (hasPlug(side))
|
||||
return false;
|
||||
|
||||
|
@ -458,21 +448,21 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
|
||||
private void computeConnections() {
|
||||
TileBuffer[] cache = getTileCache();
|
||||
if (cache != null) {
|
||||
pipeConnectionsBuffer = new boolean[6];
|
||||
if (cache == null)
|
||||
return;
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileBuffer t = cache[side.ordinal()];
|
||||
t.refresh();
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileBuffer t = cache[side.ordinal()];
|
||||
t.refresh();
|
||||
|
||||
if (t.getTile() != null)
|
||||
pipeConnectionsBuffer[side.ordinal()] = canPipeConnect(t.getTile(), side);
|
||||
}
|
||||
pipeConnectionsBuffer[side.ordinal()] = canPipeConnect(t.getTile(), side);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPipeConnected(ForgeDirection with) {
|
||||
if (worldObj.isRemote)
|
||||
return renderState.pipeConnectionMatrix.isConnected(with);
|
||||
return pipeConnectionsBuffer[with.ordinal()];
|
||||
}
|
||||
|
||||
|
@ -618,6 +608,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
case 0:
|
||||
if (pipe == null && coreState.pipeId != 0)
|
||||
initialize(BlockGenericPipe.createPipe(coreState.pipeId));
|
||||
|
||||
if (pipe != null && coreState.gateKind != GateKind.None.ordinal()) {
|
||||
if (pipe.gate == null)
|
||||
pipe.gate = new GateVanilla(pipe);
|
||||
|
|
|
@ -43,11 +43,6 @@ public class PacketHandlerTransport implements IPacketHandler {
|
|||
PacketFluidUpdate packetFluid = new PacketFluidUpdate();
|
||||
packetFluid.readData(data);
|
||||
break;
|
||||
case PacketIds.PIPE_DESCRIPTION:
|
||||
PipeRenderStatePacket descPacket = new PipeRenderStatePacket();
|
||||
descPacket.readData(data);
|
||||
onPipeDescription((EntityPlayer) player, descPacket);
|
||||
break;
|
||||
case PacketIds.PIPE_CONTENTS:
|
||||
PacketPipeTransportContent packetC = new PacketPipeTransportContent();
|
||||
packetC.readData(data);
|
||||
|
@ -172,30 +167,6 @@ public class PacketHandlerTransport implements IPacketHandler {
|
|||
((PipeTransportItems)pipe.pipe.transport).handleNBTPacket(packet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a pipe description packet. (Creates the pipe object client side if needed.)
|
||||
*
|
||||
* @param descPacket
|
||||
*/
|
||||
private void onPipeDescription(EntityPlayer player, PipeRenderStatePacket descPacket) {
|
||||
World world = player.worldObj;
|
||||
|
||||
if (!world.blockExists(descPacket.posX, descPacket.posY, descPacket.posZ))
|
||||
return;
|
||||
|
||||
TileEntity entity = world.getBlockTileEntity(descPacket.posX, descPacket.posY, descPacket.posZ);
|
||||
if (entity == null)
|
||||
return;
|
||||
// entity = new TileGenericPipeProxy();
|
||||
// world.setBlockTileEntity(descPacket.posX, descPacket.posY, descPacket.posZ, entity);
|
||||
|
||||
if (!(entity instanceof TileGenericPipe))
|
||||
return;
|
||||
|
||||
TileGenericPipe tile = (TileGenericPipe) entity;
|
||||
tile.handleDescriptionPacket(descPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates items in a pipe.
|
||||
*
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
package buildcraft.transport.network;
|
||||
|
||||
import buildcraft.core.network.PacketCoordinates;
|
||||
import buildcraft.core.network.PacketIds;
|
||||
import buildcraft.transport.PipeRenderState;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class PipeRenderStatePacket extends PacketCoordinates {
|
||||
|
||||
private PipeRenderState renderState;
|
||||
public int pipeId;
|
||||
|
||||
public PipeRenderStatePacket() {
|
||||
|
||||
}
|
||||
|
||||
public PipeRenderStatePacket(PipeRenderState renderState, int pipeId, int x, int y, int z) {
|
||||
super(PacketIds.PIPE_DESCRIPTION, x, y, z);
|
||||
this.pipeId = pipeId;
|
||||
this.isChunkDataPacket = true;
|
||||
this.renderState = renderState;
|
||||
}
|
||||
|
||||
public PipeRenderState getRenderState() {
|
||||
return this.renderState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeInt(pipeId);
|
||||
renderState.writeData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
super.readData(data);
|
||||
pipeId = data.readInt();
|
||||
renderState = new PipeRenderState();
|
||||
renderState.readData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return PacketIds.PIPE_DESCRIPTION;
|
||||
}
|
||||
|
||||
public void setPipeId(int pipeId) {
|
||||
this.pipeId = pipeId;
|
||||
}
|
||||
|
||||
public int getPipeId() {
|
||||
return pipeId;
|
||||
}
|
||||
|
||||
}
|
|
@ -26,8 +26,7 @@ public class PipeFluidsIron extends Pipe<PipeTransportFluids> {
|
|||
protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllIron_Solid.ordinal();
|
||||
private PipeLogicIron logic = new PipeLogicIron(this) {
|
||||
@Override
|
||||
protected boolean isValidFacing(ForgeDirection facing) {
|
||||
TileEntity tile = pipe.container.getTile(facing);
|
||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||
if (tile instanceof TileGenericPipe) {
|
||||
Pipe otherPipe = ((TileGenericPipe) tile).pipe;
|
||||
if (otherPipe instanceof PipeFluidsWood || otherPipe instanceof PipeStructureCobblestone)
|
||||
|
|
|
@ -14,6 +14,7 @@ import buildcraft.api.power.PowerHandler;
|
|||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
import buildcraft.api.transport.PipeManager;
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.core.network.TileNetworkData;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
|
@ -39,8 +40,7 @@ public class PipeFluidsWood extends Pipe<PipeTransportFluids> implements IPowerR
|
|||
boolean lastPower = false;
|
||||
private PipeLogicWood logic = new PipeLogicWood(this) {
|
||||
@Override
|
||||
protected boolean isValidFacing(ForgeDirection facing) {
|
||||
TileEntity tile = pipe.container.getTile(facing);
|
||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||
if (!(tile instanceof IFluidHandler))
|
||||
return false;
|
||||
if (!PipeManager.canExtractFluids(pipe, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord))
|
||||
|
|
|
@ -43,8 +43,7 @@ public class PipeItemsDaizuli extends Pipe<PipeTransportItems> implements IPipeT
|
|||
private int color = EnumColor.WHITE.ordinal();
|
||||
private PipeLogicIron logic = new PipeLogicIron(this) {
|
||||
@Override
|
||||
protected boolean isValidFacing(ForgeDirection facing) {
|
||||
TileEntity tile = pipe.container.getTile(facing);
|
||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||
if (tile instanceof TileGenericPipe) {
|
||||
Pipe otherPipe = ((TileGenericPipe) tile).pipe;
|
||||
if (otherPipe instanceof PipeItemsWood)
|
||||
|
|
|
@ -12,6 +12,7 @@ import buildcraft.api.core.IIconProvider;
|
|||
import buildcraft.api.core.Position;
|
||||
import buildcraft.core.GuiIds;
|
||||
import buildcraft.core.inventory.SimpleInventory;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.network.IClientState;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
|
@ -29,7 +30,6 @@ import java.util.LinkedList;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -101,27 +101,22 @@ public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IPipeT
|
|||
// to use that filter is higher, this is why there are
|
||||
// no breaks here.
|
||||
for (int slot = 0; slot < 9; ++slot) {
|
||||
ItemStack stack = getFilters().getStackInSlot(dir.ordinal() * 9 + slot);
|
||||
ItemStack filter = getFilters().getStackInSlot(dir.ordinal() * 9 + slot);
|
||||
|
||||
if (stack != null) {
|
||||
if (filter != null)
|
||||
foundFilter = true;
|
||||
}
|
||||
|
||||
if (stack != null && stack.itemID == item.getItemStack().itemID)
|
||||
if ((Item.itemsList[item.getItemStack().itemID].isDamageable())) {
|
||||
filteredOrientations.add(dir);
|
||||
} else if (stack.getItemDamage() == item.getItemStack().getItemDamage()) {
|
||||
filteredOrientations.add(dir);
|
||||
}
|
||||
if (StackHelper.instance().isMatchingItem(filter, item.getItemStack(), true, false))
|
||||
filteredOrientations.add(dir);
|
||||
|
||||
}
|
||||
if (!foundFilter) {
|
||||
if (!foundFilter)
|
||||
defaultOrientations.add(dir);
|
||||
}
|
||||
}
|
||||
if (filteredOrientations.size() != 0)
|
||||
if (!filteredOrientations.isEmpty())
|
||||
return filteredOrientations;
|
||||
else
|
||||
return defaultOrientations;
|
||||
|
||||
return defaultOrientations;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,8 +32,7 @@ public class PipeItemsIron extends Pipe<PipeTransportItems> {
|
|||
private int solidIconIndex = PipeIconProvider.TYPE.PipeAllIron_Solid.ordinal();
|
||||
private PipeLogicIron logic = new PipeLogicIron(this) {
|
||||
@Override
|
||||
protected boolean isValidFacing(ForgeDirection facing) {
|
||||
TileEntity tile = pipe.container.getTile(facing);
|
||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||
if (tile instanceof TileGenericPipe) {
|
||||
Pipe otherPipe = ((TileGenericPipe) tile).pipe;
|
||||
if (otherPipe instanceof PipeItemsWood)
|
||||
|
|
|
@ -16,6 +16,7 @@ import buildcraft.api.power.PowerHandler;
|
|||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
import buildcraft.api.transport.PipeManager;
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.transport.TravelingItem;
|
||||
import buildcraft.core.inventory.InventoryWrapper;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
@ -38,8 +39,7 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IPowerRec
|
|||
protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal();
|
||||
private PipeLogicWood logic = new PipeLogicWood(this) {
|
||||
@Override
|
||||
protected boolean isValidFacing(ForgeDirection facing) {
|
||||
TileEntity tile = pipe.container.getTile(facing);
|
||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||
if (!(tile instanceof IInventory))
|
||||
return false;
|
||||
if (!PipeManager.canExtractItems(pipe, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord))
|
||||
|
@ -136,7 +136,7 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IPowerRec
|
|||
|
||||
entityPos.moveForwards(0.6);
|
||||
|
||||
TravelingItem entity = new TravelingItem( entityPos.x, entityPos.y, entityPos.z, stack);
|
||||
TravelingItem entity = new TravelingItem(entityPos.x, entityPos.y, entityPos.z, stack);
|
||||
|
||||
transport.injectItem(entity, entityPos.orientation);
|
||||
}
|
||||
|
@ -179,9 +179,9 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IPowerRec
|
|||
}
|
||||
|
||||
public ItemStack checkExtractGeneric(ISidedInventory inventory, boolean doRemove, ForgeDirection from) {
|
||||
if(inventory == null)
|
||||
if (inventory == null)
|
||||
return null;
|
||||
|
||||
|
||||
for (int k : inventory.getAccessibleSlotsFromSide(from.ordinal())) {
|
||||
ItemStack slot = inventory.getStackInSlot(k);
|
||||
|
||||
|
|
|
@ -8,9 +8,11 @@
|
|||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.transport.Pipe;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public abstract class PipeLogicIron {
|
||||
|
@ -43,7 +45,20 @@ public abstract class PipeLogicIron {
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract boolean isValidFacing(ForgeDirection facing);
|
||||
|
||||
private boolean isValidFacing(ForgeDirection side) {
|
||||
TileBuffer[] tileBuffer = pipe.container.getTileCache();
|
||||
if (tileBuffer == null)
|
||||
return true;
|
||||
|
||||
if (!tileBuffer[side.ordinal()].exists())
|
||||
return true;
|
||||
|
||||
TileEntity tile = tileBuffer[side.ordinal()].getTile();
|
||||
return isValidConnectingTile(tile);
|
||||
}
|
||||
|
||||
protected abstract boolean isValidConnectingTile(TileEntity tile);
|
||||
|
||||
public void initialize() {
|
||||
lastPower = pipe.container.worldObj.isBlockIndirectlyGettingPowered(pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord);
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.transport.Pipe;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public abstract class PipeLogicWood {
|
||||
|
@ -53,7 +55,19 @@ public abstract class PipeLogicWood {
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract boolean isValidFacing(ForgeDirection facing);
|
||||
private boolean isValidFacing(ForgeDirection side) {
|
||||
TileBuffer[] tileBuffer = pipe.container.getTileCache();
|
||||
if (tileBuffer == null)
|
||||
return true;
|
||||
|
||||
if (!tileBuffer[side.ordinal()].exists())
|
||||
return true;
|
||||
|
||||
TileEntity tile = tileBuffer[side.ordinal()].getTile();
|
||||
return isValidConnectingTile(tile);
|
||||
}
|
||||
|
||||
protected abstract boolean isValidConnectingTile(TileEntity tile);
|
||||
|
||||
public void initialize() {
|
||||
if (!CoreProxy.proxy.isRenderWorld(pipe.container.worldObj)) {
|
||||
|
|
|
@ -79,13 +79,13 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
return target;
|
||||
}
|
||||
|
||||
private void renderAllFaceExeptAxe(RenderBlocks renderblocks, Block block, Icon icon, int x, int y, int z, char axe) {
|
||||
float minX = (float) block.getBlockBoundsMinX();
|
||||
float minY = (float) block.getBlockBoundsMinY();
|
||||
float minZ = (float) block.getBlockBoundsMinZ();
|
||||
float maxX = (float) block.getBlockBoundsMaxX();
|
||||
float maxY = (float) block.getBlockBoundsMaxY();
|
||||
float maxZ = (float) block.getBlockBoundsMaxZ();
|
||||
private void renderAllFaceExeptAxe(RenderBlocks renderblocks, BlockGenericPipe block, Icon icon, int x, int y, int z, char axe) {
|
||||
float minX = (float) renderblocks.renderMinX;
|
||||
float minY = (float) renderblocks.renderMinY;
|
||||
float minZ = (float) renderblocks.renderMinZ;
|
||||
float maxX = (float) renderblocks.renderMaxX;
|
||||
float maxY = (float) renderblocks.renderMaxY;
|
||||
float maxZ = (float) renderblocks.renderMaxZ;
|
||||
if (axe != 'x') {
|
||||
renderTwoWayXFace(renderblocks, block, icon, x, y, z, minY, minZ, maxY, maxZ, minX);
|
||||
renderTwoWayXFace(renderblocks, block, icon, x, y, z, minY, minZ, maxY, maxZ, maxX);
|
||||
|
@ -100,25 +100,28 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private void renderTwoWayXFace(RenderBlocks renderblocks, Block block, Icon icon, int xCoord, int yCoord, int zCoord, float minY, float minZ, float maxY, float maxZ, float x) {
|
||||
block.setBlockBounds(x, minY, minZ, x, maxY, maxZ);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
private void renderTwoWayXFace(RenderBlocks renderblocks, BlockGenericPipe block, Icon icon, int xCoord, int yCoord, int zCoord, float minY, float minZ, float maxY, float maxZ, float x) {
|
||||
renderblocks.setRenderBounds(x, minY, minZ, x, maxY, maxZ);
|
||||
block.setRenderAxis('x');
|
||||
renderblocks.renderStandardBlock(block, xCoord, yCoord, zCoord);
|
||||
block.setRenderAxis('a');
|
||||
}
|
||||
|
||||
private void renderTwoWayYFace(RenderBlocks renderblocks, Block block, Icon icon, int xCoord, int yCoord, int zCoord, float minX, float minZ, float maxX, float maxZ, float y) {
|
||||
block.setBlockBounds(minX, y, minZ, maxX, y, maxZ);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
private void renderTwoWayYFace(RenderBlocks renderblocks, BlockGenericPipe block, Icon icon, int xCoord, int yCoord, int zCoord, float minX, float minZ, float maxX, float maxZ, float y) {
|
||||
renderblocks.setRenderBounds(minX, y, minZ, maxX, y, maxZ);
|
||||
block.setRenderAxis('y');
|
||||
renderblocks.renderStandardBlock(block, xCoord, yCoord, zCoord);
|
||||
block.setRenderAxis('a');
|
||||
}
|
||||
|
||||
private void renderTwoWayZFace(RenderBlocks renderblocks, Block block, Icon icon, int xCoord, int yCoord, int zCoord, float minX, float minY, float maxX, float maxY, float z) {
|
||||
block.setBlockBounds(minX, minY, z, maxX, maxY, z);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
private void renderTwoWayZFace(RenderBlocks renderblocks, BlockGenericPipe block, Icon icon, int xCoord, int yCoord, int zCoord, float minX, float minY, float maxX, float maxY, float z) {
|
||||
renderblocks.setRenderBounds(minX, minY, z, maxX, maxY, z);
|
||||
block.setRenderAxis('z');
|
||||
renderblocks.renderStandardBlock(block, xCoord, yCoord, zCoord);
|
||||
block.setRenderAxis('a');
|
||||
}
|
||||
|
||||
public void renderPipe(RenderBlocks renderblocks, IBlockAccess iblockaccess, Block block, IPipeRenderState renderState, int x, int y, int z) {
|
||||
public void renderPipe(RenderBlocks renderblocks, IBlockAccess iblockaccess, BlockGenericPipe block, IPipeRenderState renderState, int x, int y, int z) {
|
||||
|
||||
float minSize = Utils.pipeMinPos;
|
||||
float maxSize = Utils.pipeMaxPos;
|
||||
|
@ -137,55 +140,48 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
|
||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.WEST)) {
|
||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.WEST));
|
||||
block.setBlockBounds(0.0F, minSize, minSize, minSize, maxSize, maxSize);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(0.0F, minSize, minSize, minSize, maxSize, maxSize);
|
||||
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'x');
|
||||
west = true;
|
||||
}
|
||||
|
||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.EAST)) {
|
||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.EAST));
|
||||
block.setBlockBounds(maxSize, minSize, minSize, 1.0F, maxSize, maxSize);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(maxSize, minSize, minSize, 1.0F, maxSize, maxSize);
|
||||
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'x');
|
||||
east = true;
|
||||
}
|
||||
|
||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.DOWN)) {
|
||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.DOWN));
|
||||
block.setBlockBounds(minSize, 0.0F, minSize, maxSize, minSize, maxSize);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(minSize, 0.0F, minSize, maxSize, minSize, maxSize);
|
||||
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'y');
|
||||
down = true;
|
||||
}
|
||||
|
||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.UP)) {
|
||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UP));
|
||||
block.setBlockBounds(minSize, maxSize, minSize, maxSize, 1.0F, maxSize);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(minSize, maxSize, minSize, maxSize, 1.0F, maxSize);
|
||||
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'y');
|
||||
up = true;
|
||||
}
|
||||
|
||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.NORTH)) {
|
||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.NORTH));
|
||||
block.setBlockBounds(minSize, minSize, 0.0F, maxSize, maxSize, minSize);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(minSize, minSize, 0.0F, maxSize, maxSize, minSize);
|
||||
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'z');
|
||||
north = true;
|
||||
}
|
||||
|
||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.SOUTH)) {
|
||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.SOUTH));
|
||||
block.setBlockBounds(minSize, minSize, maxSize, maxSize, maxSize, 1.0F);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(minSize, minSize, maxSize, maxSize, maxSize, 1.0F);
|
||||
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'z');
|
||||
south = true;
|
||||
}
|
||||
|
||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UNKNOWN));
|
||||
block.setBlockBounds(minSize, minSize, minSize, maxSize, maxSize, maxSize);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(minSize, minSize, minSize, maxSize, maxSize, maxSize);
|
||||
if (!west)
|
||||
renderTwoWayXFace(renderblocks, block, state.currentTexture, x, y, z, minSize, minSize, maxSize, maxSize, minSize);
|
||||
if (!east)
|
||||
|
@ -199,7 +195,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
if (!south)
|
||||
renderTwoWayZFace(renderblocks, block, state.currentTexture, x, y, z, minSize, minSize, maxSize, maxSize, maxSize);
|
||||
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderblocks.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if (state.wireMatrix.hasWire(WireColor.Red)) {
|
||||
state.currentTexture = BuildCraftTransport.instance.wireIconProvider.getIcon(state.wireMatrix.getWireIconIndex(WireColor.Red));
|
||||
|
@ -277,16 +273,14 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
rotated[2][1] = Utils.pipeMinPos;
|
||||
rotated[1][0] -= zFightOffset / 2;
|
||||
transform(rotated, direction);
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
|
||||
rotated = deepClone(zeroState);
|
||||
rotated[2][0] = Utils.pipeMaxPos;
|
||||
rotated[1][0] -= zFightOffset / 2;
|
||||
transform(rotated, direction);
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
|
||||
rotated = deepClone(zeroState);
|
||||
|
@ -294,8 +288,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
rotated[0][1] = Utils.pipeMinPos;
|
||||
rotated[1][1] -= zFightOffset;
|
||||
transform(rotated, direction);
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
|
||||
rotated = deepClone(zeroState);
|
||||
|
@ -303,14 +296,12 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
rotated[0][1] = 1F;
|
||||
rotated[1][1] -= zFightOffset;
|
||||
transform(rotated, direction);
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
} else { // Solid facade
|
||||
float[][] rotated = deepClone(zeroState);
|
||||
transform(rotated, direction);
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
|
@ -344,8 +335,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
float[][] rotated = deepClone(zeroState);
|
||||
transform(rotated, direction);
|
||||
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
@ -373,8 +363,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
float[][] rotated = deepClone(zeroState);
|
||||
transform(rotated, direction);
|
||||
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
@ -396,8 +385,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
float[][] rotated = deepClone(zeroState);
|
||||
transform(rotated, direction);
|
||||
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
@ -496,34 +484,30 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
// Z render
|
||||
|
||||
if (minZ != Utils.pipeMinPos || maxZ != Utils.pipeMaxPos || !found) {
|
||||
block.setBlockBounds(cx == Utils.pipeMinPos ? cx - 0.05F : cx, cy == Utils.pipeMinPos ? cy - 0.05F : cy, minZ, cx == Utils.pipeMinPos ? cx
|
||||
renderblocks.setRenderBounds(cx == Utils.pipeMinPos ? cx - 0.05F : cx, cy == Utils.pipeMinPos ? cy - 0.05F : cy, minZ, cx == Utils.pipeMinPos ? cx
|
||||
: cx + 0.05F, cy == Utils.pipeMinPos ? cy : cy + 0.05F, maxZ);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
// X render
|
||||
|
||||
if (minX != Utils.pipeMinPos || maxX != Utils.pipeMaxPos || !found) {
|
||||
block.setBlockBounds(minX, cy == Utils.pipeMinPos ? cy - 0.05F : cy, cz == Utils.pipeMinPos ? cz - 0.05F : cz, maxX, cy == Utils.pipeMinPos ? cy
|
||||
renderblocks.setRenderBounds(minX, cy == Utils.pipeMinPos ? cy - 0.05F : cy, cz == Utils.pipeMinPos ? cz - 0.05F : cz, maxX, cy == Utils.pipeMinPos ? cy
|
||||
: cy + 0.05F, cz == Utils.pipeMinPos ? cz : cz + 0.05F);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
// Y render
|
||||
|
||||
if (minY != Utils.pipeMinPos || maxY != Utils.pipeMaxPos || !found) {
|
||||
block.setBlockBounds(cx == Utils.pipeMinPos ? cx - 0.05F : cx, minY, cz == Utils.pipeMinPos ? cz - 0.05F : cz, cx == Utils.pipeMinPos ? cx
|
||||
renderblocks.setRenderBounds(cx == Utils.pipeMinPos ? cx - 0.05F : cx, minY, cz == Utils.pipeMinPos ? cz - 0.05F : cz, cx == Utils.pipeMinPos ? cx
|
||||
: cx + 0.05F, maxY, cz == Utils.pipeMinPos ? cz : cz + 0.05F);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (center || !found) {
|
||||
block.setBlockBounds(cx == Utils.pipeMinPos ? cx - 0.05F : cx, cy == Utils.pipeMinPos ? cy - 0.05F : cy, cz == Utils.pipeMinPos ? cz - 0.05F : cz,
|
||||
renderblocks.setRenderBounds(cx == Utils.pipeMinPos ? cx - 0.05F : cx, cy == Utils.pipeMinPos ? cy - 0.05F : cy, cz == Utils.pipeMinPos ? cz - 0.05F : cz,
|
||||
cx == Utils.pipeMinPos ? cx : cx + 0.05F, cy == Utils.pipeMinPos ? cy : cy + 0.05F, cz == Utils.pipeMinPos ? cz : cz + 0.05F);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
|
@ -537,38 +521,32 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
float max = Utils.pipeMaxPos - 0.05F;
|
||||
|
||||
if (shouldRenderNormalPipeSide(state, ForgeDirection.WEST)) {
|
||||
block.setBlockBounds(Utils.pipeMinPos - 0.10F, min, min, Utils.pipeMinPos + 0.001F, max, max);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(Utils.pipeMinPos - 0.10F, min, min, Utils.pipeMinPos + 0.001F, max, max);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (shouldRenderNormalPipeSide(state, ForgeDirection.EAST)) {
|
||||
block.setBlockBounds(Utils.pipeMaxPos + 0.001F, min, min, Utils.pipeMaxPos + 0.10F, max, max);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(Utils.pipeMaxPos + 0.001F, min, min, Utils.pipeMaxPos + 0.10F, max, max);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (shouldRenderNormalPipeSide(state, ForgeDirection.DOWN)) {
|
||||
block.setBlockBounds(min, Utils.pipeMinPos - 0.10F, min, max, Utils.pipeMinPos + 0.001F, max);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(min, Utils.pipeMinPos - 0.10F, min, max, Utils.pipeMinPos + 0.001F, max);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (shouldRenderNormalPipeSide(state, ForgeDirection.UP)) {
|
||||
block.setBlockBounds(min, Utils.pipeMaxPos + 0.001F, min, max, Utils.pipeMaxPos + 0.10F, max);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(min, Utils.pipeMaxPos + 0.001F, min, max, Utils.pipeMaxPos + 0.10F, max);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (shouldRenderNormalPipeSide(state, ForgeDirection.NORTH)) {
|
||||
block.setBlockBounds(min, min, Utils.pipeMinPos - 0.10F, max, max, Utils.pipeMinPos + 0.001F);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(min, min, Utils.pipeMinPos - 0.10F, max, max, Utils.pipeMinPos + 0.001F);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (shouldRenderNormalPipeSide(state, ForgeDirection.SOUTH)) {
|
||||
block.setBlockBounds(min, min, Utils.pipeMaxPos + 0.001F, max, max, Utils.pipeMaxPos + 0.10F);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.setRenderBounds(min, min, Utils.pipeMaxPos + 0.001F, max, max, Utils.pipeMaxPos + 0.10F);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
@ -588,7 +566,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
|
||||
if (tile instanceof IPipeRenderState) {
|
||||
IPipeRenderState pipeTile = (IPipeRenderState) tile;
|
||||
renderPipe(renderer, world, block, pipeTile, x, y, z);
|
||||
renderPipe(renderer, world, (BlockGenericPipe) block, pipeTile, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue