Merge branch '6.5.x' of github.com:BuildCraft/BuildCraft into 7.1.x

This commit is contained in:
asiekierka 2015-08-03 19:17:40 +02:00
commit 27ff200ca2
45 changed files with 396 additions and 152 deletions

View file

@ -163,7 +163,7 @@ public abstract class DockingStation {
}
public boolean linkIsDocked() {
if (isTaken()) {
if (robotTaking() != null) {
return robotTaking().getDockingStation() == this;
} else {
return false;

View file

@ -22,7 +22,7 @@ apply plugin: 'forge' // adds the forge dependency
apply plugin: 'maven' // for uploading to a maven repo
apply plugin: 'checkstyle'
version = "7.0.16"
version = "7.0.18"
group= "com.mod-buildcraft"
archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]

View file

@ -0,0 +1,16 @@
Improvements:
* Packages can now be thrown via Dispensers and Stripes Pipes (asie)
Bugs fixed:
* [#2904] Crash on corrupt facade (asie)
* [#2892] Disconnect on large-resolution Zone Planner fullscreen (asie)
* [#2891] Boxes ignoring the south and east boundaries when rounding (hea3ven)
* Accidentally setting an area in the Zone Planner GUI upon pressing fullscreen (asie)
* Compact Lens->Filter "diodes" not acting correctly (asie)
* Gate Copiers not clearing correctly (asie)
* Paintbrush not being re-dyeable if not fully used (asie)
* Robots going to unreachable stations passing through walls (hea3ven)
* Stripes Pipe "breaking" fluid blocks (asie)
* Wrench failing to rotate double chests and beds (asie)

View file

@ -0,0 +1,18 @@
Improvements:
* [#2941] Knights and Butchers now respect all your fancy sword enchantments, knockbacks and damage modifiers. Woo! (asie)
* [#2926] Fluid pipes are now extra glowy (asie)
Bugs fixed:
* [#2942] Autarchic Gates not reacting to short pulses on Single Energy Pulse mode (asie)
* [#2935, attempted] Programming Table robot board mixups (asie)
* [#2929] Builders unable to place liquid in survival mode (asie)
* [#2921] Architect Table's defined area box not visible >64 blocks (ganymedes01)
* [#2914] Advanced Crafting Table excess tick times in certain circumstances (asie)
* [#2898] Robot crash on chunk unload/reload (hea3ven)
* [#2862] Pipe name not displaying in WAILA (asie)
* Fluid tanks rendering incorrectly in Builder (asie)
* Knight/Butcher not emitting Forge attack events (asie)
* Restoring robot block breaking state could fail (hea3ven)
* Stripes pipes placing extra blocks, and the behaviour of the stripes robot placing blocks (hea3ven)

View file

@ -1,3 +1,3 @@
1.6.4:BuildCraft:4.2.2
1.7.2:BuildCraft:6.0.16
1.7.10:BuildCraft:7.0.16
1.7.10:BuildCraft:7.0.18

View file

@ -649,10 +649,12 @@ public class BuildCraftCore extends BuildCraftMod {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(paintbrushItem), " iw", " gi", "s ",
's', "stickWood", 'g', "gearWood", 'w', new ItemStack(Blocks.wool, 1, 0), 'i', Items.string);
ItemStack anyPaintbrush = new ItemStack(paintbrushItem, 1, OreDictionary.WILDCARD_VALUE);
for (int i = 0; i < 16; i++) {
ItemStack outputStack = new ItemStack(paintbrushItem);
NBTUtils.getItemData(outputStack).setByte("color", (byte) i);
CoreProxy.proxy.addShapelessRecipe(outputStack, paintbrushItem, EnumColor.fromId(i).getDye());
CoreProxy.proxy.addShapelessRecipe(outputStack, anyPaintbrush, EnumColor.fromId(i).getDye());
}
if (Loader.isModLoaded("BuildCraft|Silicon")) {

View file

@ -9,6 +9,7 @@
package buildcraft;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@ -55,6 +56,7 @@ import buildcraft.silicon.TilePackager;
import buildcraft.silicon.TileProgrammingTable;
import buildcraft.silicon.TileStampingTable;
import buildcraft.silicon.network.PacketHandlerSilicon;
import buildcraft.transport.stripes.StripesHandlerDispenser;
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftSilicon extends BuildCraftMod {
@ -143,6 +145,9 @@ public class BuildCraftSilicon extends BuildCraftMod {
loadRecipes();
}
BlockDispenser.dispenseBehaviorRegistry.putObject(packageItem, new ItemPackage.DispenseBehaviour());
StripesHandlerDispenser.items.add(packageItem);
SiliconProxy.proxy.registerRenderers();
}

View file

@ -12,7 +12,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -22,7 +21,6 @@ import buildcraft.core.GuiIds;
import buildcraft.core.lib.block.BlockBuildCraft;
public class BlockArchitect extends BlockBuildCraft {
private IIcon[] led;
public BlockArchitect() {
super(Material.iron);

View file

@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.Constants;
import buildcraft.BuildCraftCore;
@ -350,4 +351,10 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
public int getLEDLevel(int led) {
return (led == 0 ? isProcessing : box != null && box.isInitialized()) ? 15 : 0;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return Double.MAX_VALUE;
}
}

View file

@ -968,4 +968,8 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
box.readData(stream);
fluidTank.readData(stream);
}
public Tank[] getFluidTanks() {
return fluidTanks;
}
}

View file

@ -26,6 +26,7 @@ import buildcraft.core.lib.gui.AdvancedSlot;
import buildcraft.core.lib.gui.GuiAdvancedInterface;
import buildcraft.core.lib.network.command.CommandWriter;
import buildcraft.core.lib.network.command.PacketCommand;
import buildcraft.core.lib.render.FluidRenderer;
import buildcraft.core.lib.utils.StringUtils;
public class GuiBuilder extends GuiAdvancedInterface {
@ -125,6 +126,7 @@ public class GuiBuilder extends GuiAdvancedInterface {
for (int i = 0; i < builder.fluidTanks.length; i++) {
Tank tank = builder.fluidTanks[i];
if (tank.getFluid() != null && tank.getFluid().amount > 0) {
mc.renderEngine.bindTexture(FluidRenderer.getFluidSheet(tank.getFluid()));
drawFluid(tank.getFluid(), guiLeft + 179 + 18 * i, guiTop + 145, 16, 47, tank.getCapacity());
drawTexturedModalRect(guiLeft + 179 + 18 * i, guiTop + 145, 0, 54, 16, 47);
}

View file

@ -17,6 +17,7 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IAreaProvider;
@ -155,6 +156,10 @@ public class Box implements IBox, ISerializable {
@Override
public boolean contains(double x, double y, double z) {
return contains(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z));
}
public boolean contains(int x, int y, int z) {
return x >= xMin && x <= xMax && y >= yMin && y <= yMax && z >= zMin && z <= zMax;
}

View file

@ -12,6 +12,7 @@ import java.util.HashSet;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBed;
import net.minecraft.block.BlockButton;
import net.minecraft.block.BlockChest;
import net.minecraft.block.BlockLever;
@ -22,10 +23,11 @@ import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.lib.items.ItemBuildCraft;
import buildcraft.core.lib.utils.BlockUtils;
public class ItemWrench extends ItemBuildCraft implements IToolWrench {
private final Set<Class<? extends Block>> shiftRotations = new HashSet<Class<? extends Block>>();
private final Set<Class<? extends Block>> blacklistedRotations = new HashSet<Class<? extends Block>>();
public ItemWrench() {
super();
@ -35,11 +37,12 @@ public class ItemWrench extends ItemBuildCraft implements IToolWrench {
shiftRotations.add(BlockLever.class);
shiftRotations.add(BlockButton.class);
shiftRotations.add(BlockChest.class);
blacklistedRotations.add(BlockBed.class);
setHarvestLevel("wrench", 0);
}
private boolean isShiftRotation(Class<? extends Block> cls) {
for (Class<? extends Block> shift : shiftRotations) {
private boolean isClass(Set<Class<? extends Block>> set, Class<? extends Block> cls) {
for (Class<? extends Block> shift : set) {
if (shift.isAssignableFrom(cls)) {
return true;
}
@ -51,11 +54,16 @@ public class ItemWrench extends ItemBuildCraft implements IToolWrench {
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
Block block = world.getBlock(x, y, z);
if (block == null) {
if (block == null || isClass(blacklistedRotations, block.getClass())) {
return false;
}
if (player.isSneaking() != isShiftRotation(block.getClass())) {
if (player.isSneaking() != isClass(shiftRotations, block.getClass())) {
return false;
}
// Double chests should NOT be rotated.
if (block instanceof BlockChest && BlockUtils.getOtherDoubleChest(world.getTileEntity(x, y, z)) != null) {
return false;
}

View file

@ -14,7 +14,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.item.ItemStack;
import net.minecraft.world.WorldSettings;
import buildcraft.core.lib.fluids.Tank;
public class BuildingSlotMapIterator {
private static final int MAX_PER_ITEM = 80;
@ -39,7 +41,15 @@ public class BuildingSlotMapIterator {
if (builder != null) {
availablePairs.add(new BuilderItemMetaPair(null));
for (int i = 0; i < builder.getSizeInventory(); i++) {
availablePairs.add(new BuilderItemMetaPair(builder.getStackInSlot(i)));
ItemStack stack = builder.getStackInSlot(i);
if (stack != null) {
availablePairs.add(new BuilderItemMetaPair(stack));
}
}
for (Tank t : builder.getFluidTanks()) {
if (t.getFluid() != null && t.getFluid().getFluid().getBlock() != null) {
availablePairs.add(new BuilderItemMetaPair(new ItemStack(t.getFluid().getFluid().getBlock())));
}
}
}

View file

@ -28,6 +28,7 @@ import buildcraft.core.LaserData;
import buildcraft.core.internal.IBoxProvider;
import buildcraft.core.lib.RFBattery;
import buildcraft.core.lib.block.TileBuildCraft;
import buildcraft.core.lib.fluids.Tank;
import buildcraft.core.lib.network.Packet;
import buildcraft.core.lib.network.command.CommandWriter;
import buildcraft.core.lib.network.command.ICommandReceiver;
@ -189,4 +190,8 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
public boolean drainBuild(FluidStack fluidStack, boolean realDrain) {
return false;
}
public Tank[] getFluidTanks() {
return new Tank[0];
}
}

View file

@ -22,6 +22,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.IInvSlot;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.core.lib.utils.BlockUtils;
public final class InvUtils {
@ -218,26 +219,7 @@ public final class InvUtils {
*/
public static IInventory getInventory(IInventory inv) {
if (inv instanceof TileEntityChest) {
TileEntityChest chest = (TileEntityChest) inv;
TileEntityChest adjacent = null;
if (chest.adjacentChestXNeg != null) {
adjacent = chest.adjacentChestXNeg;
}
if (chest.adjacentChestXPos != null) {
adjacent = chest.adjacentChestXPos;
}
if (chest.adjacentChestZNeg != null) {
adjacent = chest.adjacentChestZNeg;
}
if (chest.adjacentChestZPos != null) {
adjacent = chest.adjacentChestZPos;
}
TileEntityChest adjacent = BlockUtils.getOtherDoubleChest((TileEntityChest) inv);
if (adjacent != null) {
return new InventoryLargeChest("", inv, adjacent);
}

View file

@ -21,7 +21,9 @@ import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import buildcraft.core.lib.EntityBlock;
@ -69,6 +71,10 @@ public final class RenderEntityBlock extends Render {
setBounds(minX, minY, minZ, maxX, maxY, maxZ);
}
public void setSkyBlockLight(World world, int x, int y, int z, int light) {
this.brightness = world.getSkyBlockTypeBrightness(EnumSkyBlock.Sky, x, y, z) << 16 | light;
}
public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k) {
return baseBlock.getMixedBrightnessForBlock(iblockaccess, i, j, k);
}

View file

@ -20,14 +20,13 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.server.S27PacketExplosion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.ForgeEventFactory;
@ -302,4 +301,31 @@ public final class BlockUtils {
}
return done;
}
public static TileEntityChest getOtherDoubleChest(TileEntity inv) {
if (inv instanceof TileEntityChest) {
TileEntityChest chest = (TileEntityChest) inv;
TileEntityChest adjacent = null;
if (chest.adjacentChestXNeg != null) {
adjacent = chest.adjacentChestXNeg;
}
if (chest.adjacentChestXPos != null) {
adjacent = chest.adjacentChestXPos;
}
if (chest.adjacentChestZNeg != null) {
adjacent = chest.adjacentChestZNeg;
}
if (chest.adjacentChestZPos != null) {
adjacent = chest.adjacentChestZPos;
}
return adjacent;
}
return null;
}
}

View file

@ -71,7 +71,7 @@ public final class CraftingUtils {
ingredients.add(item2);
return new ShapelessRecipes(new ItemStack(item1.getItem(), 1, newDamage), ingredients);
} else {
} else if (itemNum > 0) {
// End repair recipe handler
List recipes = CraftingManager.getInstance().getRecipeList();
@ -83,6 +83,10 @@ public final class CraftingUtils {
}
}
return null;
} else {
// No items - no recipe!
return null;
}
}

View file

@ -1,10 +1,12 @@
package buildcraft.core.lib.utils;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.IFluidContainerItem;
@ -23,8 +25,14 @@ public final class FluidUtils {
return FluidContainerRegistry.getFluidForFilledItem(stack);
} else if (stack.getItem() instanceof ItemBlock) {
Block b = Block.getBlockFromItem(stack.getItem());
if (b != null && b instanceof IFluidBlock && ((IFluidBlock) b).getFluid() != null) {
return new FluidStack(((IFluidBlock) b).getFluid(), 1000);
if (b != null) {
if (b instanceof IFluidBlock && ((IFluidBlock) b).getFluid() != null) {
return new FluidStack(((IFluidBlock) b).getFluid(), 1000);
} else if (b == Blocks.lava) {
return new FluidStack(FluidRegistry.getFluid("lava"), 1000);
} else if (b == Blocks.water) {
return new FluidStack(FluidRegistry.getFluid("water"), 1000);
}
}
}
}

View file

@ -172,4 +172,8 @@ public class CoreProxy implements ICoreProxy {
public TileEntity getServerTile(TileEntity source) {
return source;
}
public EntityPlayer getClientPlayer() {
return null;
}
}

View file

@ -159,4 +159,8 @@ public class CoreProxyClient extends CoreProxy {
}
return source;
}
public EntityPlayer getClientPlayer() {
return Minecraft.getMinecraft().thePlayer;
}
}

View file

@ -261,23 +261,19 @@ public class TileFloodGate extends TileBuildCraft implements IFluidHandler {
public void readData(ByteBuf stream) {
for (int i = 0; i < 6; i++) {
blockedSides[i] = stream.readBoolean();
System.out.println("Rsides=" + i + "=" + blockedSides[i]);
}
}
@Override
public void writeData(ByteBuf stream) {
for (int i = 0; i < 6; i++) {
System.out.println("Wsides=" + i + "=" + blockedSides[i]);
stream.writeBoolean(blockedSides[i]);
}
}
public void switchSide(ForgeDirection side) {
System.out.println("Csides=" + side.ordinal() + "=" + blockedSides[side.ordinal()]);
if (side.ordinal() != 1) {
blockedSides[side.ordinal()] = !blockedSides[side.ordinal()];
System.out.println("Ssides=" + side.ordinal() + "=" + blockedSides[side.ordinal()]);
rebuildQueue();
sendNetworkUpdate();

View file

@ -23,7 +23,8 @@ public class BoardProgrammingRecipe implements IProgrammingRecipe {
@Override
public int compare(ItemStack o1, ItemStack o2) {
return recipe.getEnergyCost(o1) - recipe.getEnergyCost(o2);
int i = (recipe.getEnergyCost(o1) - recipe.getEnergyCost(o2)) * 200;
return i != 0 ? i : ItemRedstoneBoard.getBoardNBT(o1).getID().compareTo(ItemRedstoneBoard.getBoardNBT(o2).getID());
}
}

View file

@ -43,6 +43,7 @@ import net.minecraft.util.StatCollector;
import net.minecraft.util.StringUtils;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import cpw.mods.fml.relauncher.Side;
@ -52,6 +53,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
@ -82,6 +84,7 @@ import buildcraft.core.lib.network.command.CommandWriter;
import buildcraft.core.lib.network.command.ICommandReceiver;
import buildcraft.core.lib.network.command.PacketCommand;
import buildcraft.core.lib.utils.NetworkUtils;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.robotics.ai.AIRobotMain;
import buildcraft.robotics.ai.AIRobotShutdown;
import buildcraft.robotics.ai.AIRobotSleep;
@ -991,16 +994,50 @@ public class EntityRobot extends EntityRobotBase implements
}
public void attackTargetEntityWithCurrentItem(Entity par1Entity) {
if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) worldObj, (int) posX, (int) posY, (int) posZ).get(),
par1Entity))) {
return;
}
if (par1Entity.canAttackWithItem()) {
if (!par1Entity.hitByEntity(this)) {
this.setLastAttacker(par1Entity);
EnchantmentHelper.func_151385_b(this, par1Entity);
ItemStack itemstack = itemInUse;
Object object = par1Entity;
float attackDamage = 2.0F;
int knockback = 0;
if (itemstack != null && object instanceof EntityLivingBase) {
itemstack.getItem().hitEntity(itemstack, (EntityLivingBase) object, this);
if (par1Entity instanceof EntityLivingBase) {
attackDamage += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase) par1Entity);
knockback += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase) par1Entity);
}
if (attackDamage > 0.0F) {
int fireAspect = EnchantmentHelper.getFireAspectModifier(this);
if (par1Entity instanceof EntityLivingBase && fireAspect > 0 && !par1Entity.isBurning()) {
par1Entity.setFire(fireAspect * 4);
}
if (par1Entity.attackEntityFrom(new EntityDamageSource("robot", this), attackDamage)) {
this.setLastAttacker(par1Entity);
if (knockback > 0) {
par1Entity.addVelocity((double) (-MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F), 0.1D, (double) (MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F));
this.motionX *= 0.6D;
this.motionZ *= 0.6D;
this.setSprinting(false);
}
if (par1Entity instanceof EntityLivingBase) {
EnchantmentHelper.func_151384_a((EntityLivingBase) par1Entity, this);
}
EnchantmentHelper.func_151385_b(this, par1Entity);
ItemStack itemstack = itemInUse;
if (itemstack != null && par1Entity instanceof EntityLivingBase) {
itemstack.getItem().hitEntity(itemstack, (EntityLivingBase) par1Entity, this);
}
}
}
}
}

View file

@ -55,8 +55,21 @@ public class AIRobotBreak extends AIRobot {
@Override
public void update() {
if (block == null || block.isAir(robot.worldObj, blockToBreak.x, blockToBreak.y, blockToBreak.z)) {
if (block == null) {
block = robot.worldObj.getBlock(blockToBreak.x, blockToBreak.y, blockToBreak.z);
if (block == null) {
setSuccess(false);
terminate();
return;
}
meta = robot.worldObj.getBlockMetadata(blockToBreak.x, blockToBreak.y, blockToBreak.z);
hardness = block.getBlockHardness(robot.worldObj, blockToBreak.x, blockToBreak.y, blockToBreak.z);
speed = getBreakSpeed(robot, robot.getHeldItem(), block, meta);
}
if (block.isAir(robot.worldObj, blockToBreak.x, blockToBreak.y, blockToBreak.z)) {
setSuccess(false);
terminate();
return;
}
if (hardness != 0) {

View file

@ -65,10 +65,14 @@ public class AIRobotGotoStation extends AIRobot {
if (station == null) {
terminate();
} else if (ai instanceof AIRobotGotoBlock) {
startDelegateAI(new AIRobotStraightMoveTo(robot,
stationIndex.x + 0.5F + stationSide.offsetX * 0.5F,
stationIndex.y + 0.5F + stationSide.offsetY * 0.5F,
stationIndex.z + 0.5F + stationSide.offsetZ * 0.5F));
if (ai.success()) {
startDelegateAI(new AIRobotStraightMoveTo(robot,
stationIndex.x + 0.5F + stationSide.offsetX * 0.5F,
stationIndex.y + 0.5F + stationSide.offsetY * 0.5F,
stationIndex.z + 0.5F + stationSide.offsetZ * 0.5F));
} else {
terminate();
}
} else {
setSuccess(true);
if (stationSide.offsetY == 0) {

View file

@ -27,8 +27,10 @@ import buildcraft.core.lib.network.command.PacketCommand;
import buildcraft.core.lib.render.DynamicTextureBC;
import buildcraft.core.lib.utils.NetworkUtils;
import buildcraft.robotics.TileZonePlan;
import buildcraft.robotics.map.MapWorld;
public class ContainerZonePlan extends BuildCraftContainer implements ICommandReceiver {
private static final int MAX_PACKET_LENGTH = 30000;
public DynamicTextureBC mapTexture;
public ZonePlan currentAreaSelection;
@ -92,9 +94,10 @@ public class ContainerZonePlan extends BuildCraftContainer implements ICommandRe
gui.refreshSelectedArea();
} else if ("receiveImage".equals(command)) {
int size = stream.readUnsignedMedium();
int pos = stream.readUnsignedMedium();
for (int i = 0; i < size; ++i) {
mapTexture.colorMap[i] = 0xFF000000 | MapColor.mapColorArray[stream.readUnsignedByte()].colorValue;
for (int i = 0; i < Math.min(size - pos, MAX_PACKET_LENGTH); ++i) {
mapTexture.colorMap[pos + i] = 0xFF000000 | MapColor.mapColorArray[stream.readUnsignedByte()].colorValue;
}
}
} else if (side.isServer()) {
@ -123,28 +126,36 @@ public class ContainerZonePlan extends BuildCraftContainer implements ICommandRe
private void computeMap(int cx, int cz, int width, int height, int blocksPerPixel, EntityPlayer player) {
final byte[] textureData = new byte[width * height];
MapWorld w = BuildCraftRobotics.manager.getWorld(map.getWorldObj());
int startX = cx - width * blocksPerPixel / 2;
int startZ = cz - height * blocksPerPixel / 2;
int mapStartX = map.chunkStartX << 4;
int mapStartZ = map.chunkStartZ << 4;
for (int i = 0; i < width; ++i) {
for (int j = 0; j < height; ++j) {
int x = startX + i * blocksPerPixel;
int z = startZ + j * blocksPerPixel;
int ix = x - (map.chunkStartX << 4);
int iz = z - (map.chunkStartZ << 4);
int ix = x - mapStartX;
int iz = z - mapStartZ;
if (ix >= 0 && iz >= 0 && ix < TileZonePlan.RESOLUTION && iz < TileZonePlan.RESOLUTION) {
textureData[i + j * width] = (byte) BuildCraftRobotics.manager.getWorld(map.getWorldObj())
.getColor(x, z);
textureData[i + j * width] = (byte) w.getColor(x, z);
}
}
}
BuildCraftCore.instance.sendToPlayer(player, new PacketCommand(this, "receiveImage", new CommandWriter() {
public void write(ByteBuf data) {
data.writeMedium(textureData.length);
data.writeBytes(textureData);
}
}));
final int len = MAX_PACKET_LENGTH;
for (int i = 0; i < textureData.length; i += len) {
final int pos = i;
BuildCraftCore.instance.sendToPlayer(player, new PacketCommand(this, "receiveImage", new CommandWriter() {
public void write(ByteBuf data) {
data.writeMedium(textureData.length);
data.writeMedium(pos);
data.writeBytes(textureData, pos, Math.min(textureData.length - pos, len));
}
}));
}
}
}

View file

@ -234,10 +234,6 @@ public class GuiZonePlan extends GuiAdvancedInterface {
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
textField.mouseClicked(mouseX - guiLeft, mouseY - guiTop, mouseButton);
int blocksX = (mouseX - mapXMin) * zoomLevel;
int blocksZ = (mouseY - mapYMin) * zoomLevel;
@ -255,22 +251,27 @@ public class GuiZonePlan extends GuiAdvancedInterface {
uploadMap();
refreshSelectedArea();
return;
} else {
inSelection = true;
selX1 = mouseX;
selY1 = mouseY;
selX2 = 0;
selY2 = 0;
return;
}
} else {
AdvancedSlot slot = getSlotAtLocation(mouseX, mouseY);
}
if (slot instanceof AreaSlot) {
colorSelected = (AreaSlot) slot;
super.mouseClicked(mouseX, mouseY, mouseButton);
textField.mouseClicked(mouseX - guiLeft, mouseY - guiTop, mouseButton);
newSelection.setColor(0, 0, colorSelected.color.getDarkHex(), alpha);
getContainer().loadArea(colorSelected.color.ordinal());
}
AdvancedSlot slot = getSlotAtLocation(mouseX, mouseY);
if (slot instanceof AreaSlot) {
colorSelected = (AreaSlot) slot;
newSelection.setColor(0, 0, colorSelected.color.getDarkHex(), alpha);
getContainer().loadArea(colorSelected.color.ordinal());
}
}

View file

@ -25,6 +25,11 @@ public class EntityPackage extends EntityThrowable {
this.pkg = stack;
}
public EntityPackage(World world, double x, double y, double z, ItemStack stack) {
super(world, x, y, z);
this.pkg = stack;
}
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);

View file

@ -2,12 +2,16 @@ package buildcraft.silicon;
import java.util.List;
import net.minecraft.block.BlockDispenser;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -17,6 +21,25 @@ import buildcraft.core.lib.utils.NBTUtils;
import buildcraft.silicon.render.PackageFontRenderer;
public class ItemPackage extends ItemBuildCraft {
public static final class DispenseBehaviour extends BehaviorDefaultDispenseItem {
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
if (stack != null && stack.getItem() instanceof ItemPackage) {
World world = source.getWorld();
EnumFacing enumfacing = BlockDispenser.func_149937_b(source.getBlockMetadata());
EntityPackage entityPackage = new EntityPackage(source.getWorld(),
source.getX() + enumfacing.getFrontOffsetX(),
source.getY() + enumfacing.getFrontOffsetY(),
source.getZ() + enumfacing.getFrontOffsetZ(), stack.copy());
entityPackage.setThrowableHeading(enumfacing.getFrontOffsetX(), enumfacing.getFrontOffsetY() + 0.1F, enumfacing.getFrontOffsetZ(), 1.1F, 6.0F);
world.spawnEntityInWorld(entityPackage);
stack.splitStack(1);
}
return stack;
}
}
public ItemPackage() {
super();
setMaxStackSize(1);

View file

@ -158,7 +158,9 @@ public class TileProgrammingTable extends TileLaserTableBase implements IInvento
}
}
if ((oldId != null && !oldId.equals(currentRecipeId)) || (oldId == null && currentRecipeId != null)) {
if ((oldId != null && currentRecipeId != null && !oldId.equals(currentRecipeId))
|| (oldId == null && currentRecipeId != null)
|| (oldId != null && currentRecipeId == null)) {
optionId = -1;
updateRecipe();
queueNetworkUpdate();

View file

@ -62,6 +62,7 @@ import buildcraft.core.CoreConstants;
import buildcraft.core.lib.block.BlockBuildCraft;
import buildcraft.core.lib.utils.MatrixTranformations;
import buildcraft.core.lib.utils.Utils;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.transport.gates.GatePluggable;
import buildcraft.transport.render.PipeRendererWorld;
@ -491,6 +492,17 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable
return null;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
// HACK: WAILA compatibility
EntityPlayer clientPlayer = CoreProxy.proxy.getClientPlayer();
if (clientPlayer != null) {
return getPickBlock(target, world, x, y, z, clientPlayer);
} else {
return new ItemStack(getPipe(world, x, y, z).item, 1, getPipe(world, x, y, z).container.getItemMetadata());
}
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);

View file

@ -156,7 +156,9 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
public String getItemStackDisplayName(ItemStack itemstack) {
switch (getFacadeType(itemstack)) {
case Basic:
return super.getItemStackDisplayName(itemstack) + ": " + getFacadeStateDisplayName(getFacadeStates(itemstack)[0]);
FacadeState[] states = getFacadeStates(itemstack);
String displayName = states.length > 0 ? getFacadeStateDisplayName(states[0]) : "CORRUPT";
return super.getItemStackDisplayName(itemstack) + ": " + displayName;
case Phased:
return StringUtils.localize("item.FacadePhased.name");
default:

View file

@ -75,7 +75,10 @@ public class ItemGateCopier extends ItemBuildCraft {
player.addChatMessage(new ChatComponentTranslation("chat.gateCopier.clear"));
return true;
}
data = new NBTTagCompound();
stack.setTagCompound(data);
gate.writeStatementsToNBT(data);
data.setByte("material", (byte) gate.material.ordinal());
data.setByte("logic", (byte) gate.logic.ordinal());

View file

@ -22,12 +22,17 @@ public class LensFilterHandler {
for (ForgeDirection dir: event.destinations) {
int sideColor = -1;
int sideLensColor = -1;
// Get the side's color
// (1/2) From this pipe's outpost
PipePluggable pluggable = container.getPipePluggable(dir);
if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) {
sideColor = ((LensPluggable) pluggable).color;
if (pluggable != null && pluggable instanceof LensPluggable) {
if (((LensPluggable) pluggable).isFilter) {
sideColor = ((LensPluggable) pluggable).color;
} else {
sideLensColor = ((LensPluggable) pluggable).color;
}
}
// (2/2) From the other pipe's outpost
@ -37,8 +42,11 @@ public class LensFilterHandler {
pluggable = otherContainer.getPipePluggable(dir.getOpposite());
if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) {
int otherColor = ((LensPluggable) pluggable).color;
// Check if colors conflict - if so, the side is unpassable
if (sideColor >= 0 && otherColor != sideColor) {
// Filter colors conflict - the side is unpassable
continue;
} else if (sideLensColor != -1 && sideColor != otherColor) {
// The closer lens color differs from the further away filter color - the side is unpassable
continue;
} else {
sideColor = otherColor;

View file

@ -452,6 +452,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler,
changed = true;
renderCache.fluidID = fluidType != null ? fluidType.getFluid().getID() : 0;
renderCache.color = fluidType != null ? fluidType.getFluid().getColor(fluidType) : 0;
renderCache.flags = FluidRenderData.getFlags(fluidType);
delta.set(0);
}

View file

@ -21,6 +21,7 @@ import buildcraft.api.gates.IGate;
import buildcraft.api.gates.IGateExpansion;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.IStatement;
import buildcraft.core.lib.utils.MathUtils;
import buildcraft.transport.statements.ActionEnergyPulsar;
import buildcraft.transport.statements.ActionSingleEnergyPulse;
@ -38,7 +39,6 @@ public final class GateExpansionPulsar extends GateExpansionBuildcraft implement
}
private class GateExpansionControllerPulsar extends GateExpansionController {
private static final int PULSE_PERIOD = 10;
private boolean isActive;
private boolean singlePulse;
@ -58,7 +58,7 @@ public final class GateExpansionPulsar extends GateExpansionBuildcraft implement
@Override
public void startResolution() {
if (isActive()) {
if (isActive) {
disablePulse();
}
}
@ -84,46 +84,35 @@ public final class GateExpansionPulsar extends GateExpansionBuildcraft implement
@Override
public void tick(IGate gate) {
if (!isActive && hasPulsed) {
hasPulsed = false;
}
if (tick++ % PULSE_PERIOD != 0) {
// only do the treatement once every period
return;
}
if (!isActive) {
gate.setPulsing(false);
return;
}
gate.setPulsing(isActive);
if (pipeTile instanceof IEnergyHandler && (!singlePulse || !hasPulsed)) {
gate.setPulsing(true);
((IEnergyHandler) pipeTile).receiveEnergy(ForgeDirection.UNKNOWN, Math.min(1 << (count - 1), 64) * 10,
if (pipeTile instanceof IEnergyHandler && ((singlePulse && !hasPulsed) || (!singlePulse && isActive))) {
((IEnergyHandler) pipeTile).receiveEnergy(ForgeDirection.UNKNOWN, MathUtils.clamp(1 << (count - 1), 1, 64) * 10,
false);
hasPulsed = true;
} else {
gate.setPulsing(true);
}
}
private void enableSinglePulse(int count) {
singlePulse = true;
isActive = true;
singlePulse = true;
hasPulsed = false;
this.count = count;
}
private void enablePulse(int count) {
isActive = true;
hasPulsed = false;
singlePulse = false;
this.count = count;
}
private void disablePulse() {
if (!isActive) {
hasPulsed = false;
}
isActive = false;
this.count = 0;
}

View file

@ -80,6 +80,7 @@ public class PacketFluidUpdate extends PacketCoordinates {
if (delta.get(0)) {
renderCache.fluidID = data.readShort();
renderCache.color = renderCache.fluidID != 0 ? data.readInt() : 0xFFFFFF;
renderCache.flags = renderCache.fluidID != 0 ? data.readUnsignedByte() : 0;
}
for (ForgeDirection dir : ForgeDirection.values()) {
@ -101,6 +102,7 @@ public class PacketFluidUpdate extends PacketCoordinates {
data.writeShort(renderCache.fluidID);
if (renderCache.fluidID != 0) {
data.writeInt(renderCache.color);
data.writeByte(renderCache.flags);
}
}

View file

@ -13,12 +13,14 @@ import java.util.Collection;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.IFluidBlock;
import cofh.api.energy.IEnergyHandler;
import buildcraft.BuildCraftTransport;
@ -216,7 +218,11 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnerg
if (!BlockUtils.isUnbreakableBlock(getWorld(), (int) p.x, (int) p.y, (int) p.z)) {
Block block = getWorld().getBlock((int) p.x, (int) p.y, (int) p.z);
int metadata = getWorld().getBlockMetadata((int) p.x, (int) p.y, (int) p.z);
if (block instanceof BlockLiquid || block instanceof IFluidBlock) {
return maxReceive;
}
ItemStack stack = new ItemStack(block, 1, metadata);
EntityPlayer player = CoreProxy.proxy.getBuildCraftPlayer((WorldServer) getWorld(),
(int) p.x, (int) p.y, (int) p.z).get();

View file

@ -40,9 +40,7 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal();
protected RFBattery battery;
private boolean full;
private int requestedEnergy, sources, lastRequestedEnergy;
private boolean allowExtraction = false;
public PipePowerWood(Item item) {

View file

@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.IntHashMap;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
@ -111,9 +112,11 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
initialized = false;
}
private DisplayFluidList getDisplayFluidLists(int liquidId, World world) {
if (displayFluidLists.containsItem(liquidId)) {
return (DisplayFluidList) displayFluidLists.lookup(liquidId);
private DisplayFluidList getDisplayFluidLists(int liquidId, int skylight, int flags, World world) {
int listId = (liquidId & 0x3FFFF) << 13 | flags << 5 | (skylight & 31);
if (displayFluidLists.containsItem(listId)) {
return (DisplayFluidList) displayFluidLists.lookup(listId);
}
Fluid fluid = FluidRegistry.getFluid(liquidId);
@ -123,7 +126,7 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
}
DisplayFluidList d = new DisplayFluidList();
displayFluidLists.addKey(liquidId, d);
displayFluidLists.addKey(listId, d);
RenderInfo block = new RenderInfo();
@ -134,6 +137,7 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
}
block.texture = fluid.getStillIcon();
block.brightness = skylight << 16 | flags & 31;
float size = CoreConstants.PIPE_MAX_POS - CoreConstants.PIPE_MIN_POS;
@ -751,7 +755,7 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
GL11.glTranslatef((float) x, (float) y, (float) z);
// sides
int skylight = pipe.container.getWorld().getSkyBlockTypeBrightness(EnumSkyBlock.Sky, pipe.container.x(), pipe.container.y(), pipe.container.z());
boolean sides = false, above = false;
@ -766,7 +770,8 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
continue;
}
DisplayFluidList d = getDisplayFluidLists(renderData.fluidID, pipe.container.getWorldObj());
DisplayFluidList d = getDisplayFluidLists(renderData.fluidID, skylight,
fluidRenderData.flags, pipe.container.getWorldObj());
if (d == null) {
continue;
@ -806,8 +811,9 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
GL11.glPopMatrix();
}
if (renderData.amount[6] > 0) {
DisplayFluidList d = getDisplayFluidLists(renderData.fluidID, pipe.container.getWorldObj());
if (fluidRenderData.amount[6] > 0) {
DisplayFluidList d = getDisplayFluidLists(renderData.fluidID, skylight,
fluidRenderData.flags, pipe.container.getWorldObj());
if (d != null) {
int stage = (int) ((float) renderData.amount[6] / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));

View file

@ -43,40 +43,44 @@ public class StripesHandlerBucket implements IStripesHandler {
ForgeDirection direction, ItemStack stack, EntityPlayer player,
IStripesActivator activator) {
if (world.isAirBlock(x, y, z)) {
Block underblock = world.getBlock(x, y - 1, z);
if (((ItemBucket) stack.getItem()).tryPlaceContainedLiquid(world, x, y - 1, z)) {
if (((ItemBucket) stack.getItem()).tryPlaceContainedLiquid(world, x, direction.ordinal() < 2 ? y : (y - 1), z)) {
activator.sendItem(emptyBucket, direction.getOpposite());
stack.stackSize--;
if (stack.stackSize > 0) {
activator.sendItem(stack, direction.getOpposite());
}
return true;
} else {
if (!FluidContainerRegistry.isEmptyContainer(stack)) {
activator.sendItem(stack, direction.getOpposite());
return true;
}
FluidStack fluidStack = BlockUtils.drainBlock(underblock, world, x, y - 1, z, true);
ItemStack filledBucket = getFilledBucket(fluidStack, underblock);
if (fluidStack == null || filledBucket == null) {
activator.sendItem(stack, direction.getOpposite());
return true;
}
activator.sendItem(filledBucket, direction.getOpposite());
stack.stackSize--;
if (stack.stackSize > 0) {
activator.sendItem(stack, direction.getOpposite());
}
return true;
}
}
return false;
if (!FluidContainerRegistry.isEmptyContainer(stack)) {
activator.sendItem(stack, direction.getOpposite());
return true;
}
Block targetBlock = world.getBlock(x, y, z);
FluidStack fluidStack = BlockUtils.drainBlock(targetBlock, world, x, y, z, true);
if (fluidStack == null) {
targetBlock = world.getBlock(x, y - 1, z);
fluidStack = BlockUtils.drainBlock(targetBlock, world, x, y - 1, z, true);
}
ItemStack filledBucket = getFilledBucket(fluidStack, targetBlock);
if (fluidStack == null || filledBucket == null) {
activator.sendItem(stack, direction.getOpposite());
return true;
}
activator.sendItem(filledBucket, direction.getOpposite());
stack.stackSize--;
if (stack.stackSize > 0) {
activator.sendItem(stack, direction.getOpposite());
}
return true;
}
}

View file

@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.Position;
import buildcraft.api.transport.IStripesActivator;
import buildcraft.api.transport.IStripesHandler;
@ -34,19 +33,16 @@ public class StripesHandlerPlaceBlock implements IStripesHandler {
public boolean handle(World world, int x, int y, int z,
ForgeDirection direction, ItemStack stack, EntityPlayer player,
IStripesActivator activator) {
if (!world.isAirBlock(x, y, z) && stack.tryPlaceItemIntoWorld(player, world, x, y, z, 1, 0.0f, 0.0f, 0.0f)) {
return true;
} else if (world.isAirBlock(x, y, z)) {
Position src = new Position(x, y, z);
src.orientation = direction;
src.moveBackwards(1.0D);
if (stack.tryPlaceItemIntoWorld(player, world, (int) src.x, (int) src.y, (int) src.z, direction.ordinal(), 0.0f, 0.0f, 0.0f)) {
if (stack.stackSize > 0) {
activator.sendItem(stack, direction.getOpposite());
}
return true;
if (!world.isAirBlock(x, y, z)) {
return false;
}
if (stack.tryPlaceItemIntoWorld(player, world, x, y, z, direction.ordinal(), 0.0f,
0.0f, 0.0f)) {
if (stack.stackSize > 0) {
activator.sendItem(stack, direction.getOpposite());
}
return true;
}
return false;
}

View file

@ -1,14 +1,24 @@
package buildcraft.transport.utils;
import net.minecraftforge.fluids.FluidStack;
public class FluidRenderData {
public int fluidID, color;
public int fluidID, color, flags;
public int[] amount = new int[7];
public FluidRenderData duplicate() {
FluidRenderData n = new FluidRenderData();
n.fluidID = fluidID;
n.color = color;
n.flags = flags;
System.arraycopy(this.amount, 0, n.amount, 0, 7);
return n;
}
public static int getFlags(FluidStack s) {
if (s == null) {
return 0;
}
return s.getFluid().getLuminosity(s);
}
}