diff --git a/api/buildcraft/api/blueprints/SchematicTile.java b/api/buildcraft/api/blueprints/SchematicTile.java index e37bf490..b3f06f06 100755 --- a/api/buildcraft/api/blueprints/SchematicTile.java +++ b/api/buildcraft/api/blueprints/SchematicTile.java @@ -72,6 +72,7 @@ public class SchematicTile extends SchematicBlock { if (tile != null) { tile.writeToNBT(tileNBT); } + tileNBT = (NBTTagCompound) tileNBT.copy(); } } diff --git a/build.gradle b/build.gradle index 01ac13ca..c9c5f460 100755 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ apply plugin: 'forge' // adds the forge dependency apply plugin: 'maven' // for uploading to a maven repo apply plugin: 'checkstyle' -version = "6.3.3" +version = "6.3.6" 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] diff --git a/buildcraft_resources/assets/buildcraft/lang/en_US.lang b/buildcraft_resources/assets/buildcraft/lang/en_US.lang index 73f45871..50f3848c 100644 --- a/buildcraft_resources/assets/buildcraft/lang/en_US.lang +++ b/buildcraft_resources/assets/buildcraft/lang/en_US.lang @@ -406,3 +406,7 @@ bc_update.new_version=§cNew version of BuildCraft available: %s for Minecraft % bc_update.download=§cDownload from http://www.mod-buildcraft.com/download bc_update.once=This message only displays once bc_update.again=Type '/buildcraft version' if you want to see it again + +command.buildcraft.version=BuildCraft %s for Minecraft %s (Latest: %s). +command.buildcraft.versioninfo=Version information. +command.buildcraft.available=Available Commands: diff --git a/buildcraft_resources/assets/buildcraft/textures/items/fillerParameters/arrow_down.png b/buildcraft_resources/assets/buildcraft/textures/items/fillerParameters/arrow_down.png new file mode 100644 index 00000000..6667e10e Binary files /dev/null and b/buildcraft_resources/assets/buildcraft/textures/items/fillerParameters/arrow_down.png differ diff --git a/buildcraft_resources/assets/buildcraft/textures/items/fillerParameters/arrow_up.png b/buildcraft_resources/assets/buildcraft/textures/items/fillerParameters/arrow_up.png new file mode 100644 index 00000000..db5322e4 Binary files /dev/null and b/buildcraft_resources/assets/buildcraft/textures/items/fillerParameters/arrow_up.png differ diff --git a/buildcraft_resources/changelog/6.3.4 b/buildcraft_resources/changelog/6.3.4 new file mode 100644 index 00000000..08dfa774 --- /dev/null +++ b/buildcraft_resources/changelog/6.3.4 @@ -0,0 +1,5 @@ +Bugfixes: +[#2425] Crash with Artifice (asie) +[#2423] Builders use uncolored pipes for colored pipes (asie) +[#2419] No RecipeSorter configuration for PipeColoringRecipe (asie) +[#2418] Searchbar crash in creative mode (asie) diff --git a/buildcraft_resources/changelog/6.3.5 b/buildcraft_resources/changelog/6.3.5 new file mode 100644 index 00000000..3b592470 --- /dev/null +++ b/buildcraft_resources/changelog/6.3.5 @@ -0,0 +1,14 @@ +Additions: +[#2430] Support for most BuildCraft Factory blocks in the Builder (hea3ven) +Polish localization update (nister6000) + +Bugfixes: +[#2445] Edge case bugs in Auto Workbenches +[#2428] Massive Refinery bandwidth usage +[#2426] Refinery accepts fuel as input (warlordjones) +[#2422] Lists only use the first stack in each line (hea3ven) +[#2411] Accept Equivalents button does not sync properly in Lists (hea3ven) +[#2408] Too high oil viscosity (warlordjones) +[#2345] Partial localization for BC commands (warlordjones) +Assembly Table GUI synchronization broken + diff --git a/buildcraft_resources/changelog/6.3.6 b/buildcraft_resources/changelog/6.3.6 new file mode 100644 index 00000000..63cb3b99 --- /dev/null +++ b/buildcraft_resources/changelog/6.3.6 @@ -0,0 +1,2 @@ +Bugfixes: +Revert Auto Workbench behaviour change diff --git a/buildcraft_resources/versions.txt b/buildcraft_resources/versions.txt index 9bf3fc34..04649a27 100755 --- a/buildcraft_resources/versions.txt +++ b/buildcraft_resources/versions.txt @@ -1,3 +1,3 @@ 1.6.4:BuildCraft:4.2.2 1.7.2:BuildCraft:6.0.16 -1.7.10:BuildCraft:6.3.3 +1.7.10:BuildCraft:6.3.6 diff --git a/common/buildcraft/BuildCraftBuilders.java b/common/buildcraft/BuildCraftBuilders.java index 981c7fe3..54f52614 100644 --- a/common/buildcraft/BuildCraftBuilders.java +++ b/common/buildcraft/BuildCraftBuilders.java @@ -325,6 +325,7 @@ public class BuildCraftBuilders extends BuildCraftMod { schemes.registerSchematicBlock(Blocks.furnace, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true); schemes.registerSchematicBlock(Blocks.lit_furnace, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true); schemes.registerSchematicBlock(Blocks.chest, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true); + schemes.registerSchematicBlock(Blocks.trapped_chest, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true); schemes.registerSchematicBlock(Blocks.dispenser, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true); schemes.registerSchematicBlock(Blocks.dropper, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true); diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index 651750e7..77c9dcd6 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -151,11 +151,11 @@ public class BuildCraftEnergy extends BuildCraftMod { double fuelLavaMultiplier = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "fuel.lava.combustion", 1.0F, "adjust energy value of Lava in Combustion Engines").getDouble(1.0F); double fuelOilMultiplier = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "fuel.oil.combustion", 1.0F, "adjust energy value of Oil in Combustion Engines").getDouble(1.0F); double fuelFuelMultiplier = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "fuel.fuel.combustion", 1.0F, "adjust energy value of Fuel in Combustion Engines").getDouble(1.0F); - + int fuelLavaEnergyOutput = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "fuel.lava.combustion.energyOutput", 20, "adjust output energy by Lava in Combustion Engines").getInt(20); int fuelOilEnergyOutput = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "fuel.oil.combustion.energyOutput", 30, "adjust output energy by Oil in Combustion Engines").getInt(30); int fuelFuelEnergyOutput = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "fuel.fuel.combustion.energyOutput", 60, "adjust output energy by Fuel in Combustion Engines").getInt(60); - + BuildCraftCore.mainConfiguration.save(); if (oilDesertBiomeId > 0) { @@ -183,7 +183,7 @@ public class BuildCraftEnergy extends BuildCraftMod { // Oil and fuel if (!FluidRegistry.isFluidRegistered("oil")) { - buildcraftFluidOil = new Fluid("oil").setDensity(800).setViscosity(15000); + buildcraftFluidOil = new Fluid("oil").setDensity(800).setViscosity(10000); FluidRegistry.registerFluid(buildcraftFluidOil); } else { BCLog.logger.warn("Not using BuildCraft oil - issues might occur!"); @@ -349,7 +349,7 @@ public class BuildCraftEnergy extends BuildCraftMod { NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); StatementManager.registerTriggerProvider(new EnergyStatementProvider()); - + BuilderAPI.schematicRegistry.registerSchematicBlock(engineBlock, SchematicEngine.class); if (BuildCraftCore.loadDefaultRecipes) { @@ -362,7 +362,7 @@ public class BuildCraftEnergy extends BuildCraftMod { @Mod.EventHandler public void postInit(FMLPostInitializationEvent evt) { - + if (BuildCraftCore.modifyWorld) { MinecraftForge.EVENT_BUS.register(OilPopulate.INSTANCE); MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeInitializer()); diff --git a/common/buildcraft/BuildCraftFactory.java b/common/buildcraft/BuildCraftFactory.java index 2b322046..c690b365 100644 --- a/common/buildcraft/BuildCraftFactory.java +++ b/common/buildcraft/BuildCraftFactory.java @@ -37,6 +37,7 @@ import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import buildcraft.api.blueprints.BuilderAPI; +import buildcraft.api.blueprints.SchematicTile; import buildcraft.builders.schematics.SchematicIgnoreMeta; import buildcraft.compat.CompatHooks; import buildcraft.core.DefaultProps; @@ -68,9 +69,10 @@ import buildcraft.factory.TileQuarry; import buildcraft.factory.TileRefinery; import buildcraft.factory.TileTank; import buildcraft.factory.network.PacketHandlerFactory; +import buildcraft.factory.schematics.SchematicAutoWorkbench; import buildcraft.factory.schematics.SchematicPump; import buildcraft.factory.schematics.SchematicRefinery; -import buildcraft.factory.schematics.SchematicTank; +import buildcraft.factory.schematics.SchematicTileIgnoreState; @Mod(name = "BuildCraft Factory", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE) public class BuildCraftFactory extends BuildCraftMod { @@ -160,9 +162,13 @@ public class BuildCraftFactory extends BuildCraftMod { FactoryProxy.proxy.initializeTileEntities(); BuilderAPI.schematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class); - BuilderAPI.schematicRegistry.registerSchematicBlock(tankBlock, SchematicTank.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(tankBlock, SchematicTileIgnoreState.class); BuilderAPI.schematicRegistry.registerSchematicBlock(frameBlock, SchematicIgnoreMeta.class); BuilderAPI.schematicRegistry.registerSchematicBlock(pumpBlock, SchematicPump.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(miningWellBlock, SchematicTileIgnoreState.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(floodGateBlock, SchematicTileIgnoreState.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(autoWorkbenchBlock, SchematicAutoWorkbench.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(hopperBlock, SchematicTile.class); if (BuildCraftCore.loadDefaultRecipes) { loadRecipes(); diff --git a/common/buildcraft/BuildCraftTransport.java b/common/buildcraft/BuildCraftTransport.java index 827e8758..84c54231 100644 --- a/common/buildcraft/BuildCraftTransport.java +++ b/common/buildcraft/BuildCraftTransport.java @@ -506,6 +506,7 @@ public class BuildCraftTransport extends BuildCraftMod { } GameRegistry.addRecipe(new PipeColoringRecipe()); + RecipeSorter.register("buildcraft:pipecoloring", PipeColoringRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); CoreProxy.proxy.addCraftingRecipe(new ItemStack(filteredBufferBlock, 1), "wdw", "wcw", "wpw", 'w', "plankWood", 'd', diff --git a/common/buildcraft/core/CommandBuildCraft.java b/common/buildcraft/core/CommandBuildCraft.java index 142186b3..a7baaee2 100644 --- a/common/buildcraft/core/CommandBuildCraft.java +++ b/common/buildcraft/core/CommandBuildCraft.java @@ -15,7 +15,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.util.ChatComponentText; - +import net.minecraft.util.StatCollector; import buildcraft.core.proxy.CoreProxy; public class CommandBuildCraft extends CommandBase { @@ -58,8 +58,8 @@ public class CommandBuildCraft extends CommandBase { return; } else if (arguments[0].matches("help")) { sender.addChatMessage(new ChatComponentText("Format: '" + this.getCommandName() + " '")); - sender.addChatMessage(new ChatComponentText("Available commands:")); - sender.addChatMessage(new ChatComponentText("- version : Version information.")); + sender.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("command.buildcraft.available"))); + sender.addChatMessage(new ChatComponentText(" - version :" + StatCollector.translateToLocal("command.buildcraft.versioninfo"))); return; } @@ -69,7 +69,7 @@ public class CommandBuildCraft extends CommandBase { private void commandVersion(ICommandSender sender, String[] arguments) { String colour = Version.isOutdated() ? "\u00A7c" : "\u00A7a"; - sender.addChatMessage(new ChatComponentText(String.format(colour + "BuildCraft %s for Minecraft %s (Latest: %s).", Version.getVersion(), + sender.addChatMessage(new ChatComponentText(String.format(colour + StatCollector.translateToLocal("command.buildcraft.version"), Version.getVersion(), CoreProxy.proxy.getMinecraftVersion(), Version.getRecommendedVersion()))); // TODD This takes too much realstate. See how to improve diff --git a/common/buildcraft/core/DefaultProps.java b/common/buildcraft/core/DefaultProps.java index fe9a9049..68630ce4 100644 --- a/common/buildcraft/core/DefaultProps.java +++ b/common/buildcraft/core/DefaultProps.java @@ -16,7 +16,7 @@ public final class DefaultProps { public static final String DEPENDENCY_TRANSPORT = "required-after:BuildCraft|Transport@" + Version.VERSION; public static final String NET_CHANNEL_NAME = "BC"; - public static int NETWORK_UPDATE_RANGE = 128; + public static int NETWORK_UPDATE_RANGE = 64; public static int PIPE_CONTENTS_RENDER_DIST = 24; public static String TEXTURE_PATH_GUI = "textures/gui"; diff --git a/common/buildcraft/core/ItemList.java b/common/buildcraft/core/ItemList.java index 058c3853..7d2bc9e1 100644 --- a/common/buildcraft/core/ItemList.java +++ b/common/buildcraft/core/ItemList.java @@ -77,14 +77,18 @@ public class ItemList extends ItemBuildCraft { stacks[slot].stackSize = 1; } - if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && slot == 0) { + if (slot == 0) { relatedItems.clear(); ores.clear(); if (stack == null) { isOre = false; } else { - setClientPreviewLists(); + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { + setClientPreviewLists(); + } else { + isOre = OreDictionary.getOreIDs(stacks[0]).length > 0; + } } } } @@ -199,7 +203,7 @@ public class ItemList extends ItemBuildCraft { return oreMatch(stacks[0], item); } else { for (ItemStack stack : stacks) { - if (stack != null && StackHelper.isMatchingItemOrList(stacks[0], item)) { + if (stack != null && StackHelper.isMatchingItemOrList(stack, item)) { return true; } } diff --git a/common/buildcraft/core/inventory/InventoryConcatenator.java b/common/buildcraft/core/inventory/InventoryConcatenator.java index 657efcd1..a1c07735 100644 --- a/common/buildcraft/core/inventory/InventoryConcatenator.java +++ b/common/buildcraft/core/inventory/InventoryConcatenator.java @@ -98,5 +98,8 @@ public final class InventoryConcatenator implements IInventory { @Override public void markDirty() { + for (IInventory inv : invMap) { + inv.markDirty(); + } } } diff --git a/common/buildcraft/core/recipes/RefineryRecipeManager.java b/common/buildcraft/core/recipes/RefineryRecipeManager.java index ceead523..aee15af7 100644 --- a/common/buildcraft/core/recipes/RefineryRecipeManager.java +++ b/common/buildcraft/core/recipes/RefineryRecipeManager.java @@ -8,12 +8,12 @@ */ package buildcraft.core.recipes; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import net.minecraftforge.fluids.FluidStack; - import buildcraft.BuildCraftCore; import buildcraft.api.core.BCLog; import buildcraft.api.recipes.IFlexibleRecipe; @@ -23,6 +23,8 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager { public static final RefineryRecipeManager INSTANCE = new RefineryRecipeManager(); private HashMap> recipes = new HashMap>(); + private ArrayList validFluids1 = new ArrayList(); + private ArrayList validFluids2 = new ArrayList(); private RefineryRecipeManager() { } @@ -38,6 +40,7 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager { FlexibleRecipe recipe = new FlexibleRecipe(id, result, energy, delay, ingredient); recipes.put(id, recipe); + validFluids1.add(ingredient); } @Override @@ -48,7 +51,7 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager { if (BuildCraftCore.recipesBlacklist.contains(name)) { return; } - + if (ingredient1 == null || ingredient2 == null || result == null) { BCLog.logger.warn("Rejected refinery recipe " + id + " due to a null FluidStack!"); } @@ -56,6 +59,8 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager { FlexibleRecipe recipe = new FlexibleRecipe(id, result, energy, delay, ingredient1, ingredient2); recipes.put(id, recipe); + validFluids1.add(ingredient1); + validFluids2.add(ingredient2); } @Override @@ -67,7 +72,7 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager { public IFlexibleRecipe getRecipe(String id) { return recipes.get(id); } - + @Override public void removeRecipe(IFlexibleRecipe recipe) { removeRecipe(recipe.getId()); @@ -77,4 +82,12 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager { public void removeRecipe(String id) { recipes.remove(id); } + + public ArrayList getValidFluidStacks1() { + return validFluids1; + } + + public ArrayList getValidFluidStacks2() { + return validFluids2; + } } diff --git a/common/buildcraft/factory/BlockMiner.java b/common/buildcraft/factory/BlockMiner.java index 4cf925ab..2134a627 100644 --- a/common/buildcraft/factory/BlockMiner.java +++ b/common/buildcraft/factory/BlockMiner.java @@ -75,7 +75,7 @@ public class BlockMiner { public void invalidate() { world.destroyBlockInWorldPartially(minerId, x, y, z, -1); } - + public int acceptEnergy(int offeredAmount) { energyRequired = BlockUtils.computeBlockBreakEnergy(world, x, y, z); diff --git a/common/buildcraft/factory/TileAutoWorkbench.java b/common/buildcraft/factory/TileAutoWorkbench.java index 4621ac43..001c35bc 100644 --- a/common/buildcraft/factory/TileAutoWorkbench.java +++ b/common/buildcraft/factory/TileAutoWorkbench.java @@ -98,6 +98,12 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory return CoreProxy.proxy.getBuildCraftPlayer((WorldServer) worldObj, xCoord, yCoord + 1, zCoord); } + @Override + public void markDirty() { + super.markDirty(); + inv.markDirty(); + } + @Override public int getSizeInventory() { return 10; @@ -214,9 +220,11 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory if (craftSlot == null) { craftSlot = new SlotCrafting(getInternalPlayer().get(), craftMatrix, craftResult, 0, 0, 0); } + if (resultInv.getStackInSlot(SLOT_RESULT) != null) { return; } + update++; if (update % UPDATE_TIME == 0) { updateCrafting(); diff --git a/common/buildcraft/factory/TileRefinery.java b/common/buildcraft/factory/TileRefinery.java index b2ed3f42..61c92741 100644 --- a/common/buildcraft/factory/TileRefinery.java +++ b/common/buildcraft/factory/TileRefinery.java @@ -9,14 +9,12 @@ package buildcraft.factory; import io.netty.buffer.ByteBuf; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; - import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; @@ -24,8 +22,8 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; - import buildcraft.BuildCraftCore; +import buildcraft.BuildCraftEnergy; import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.recipes.CraftingResult; import buildcraft.api.recipes.IFlexibleCrafter; @@ -62,8 +60,10 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve public TileRefinery() { super(); this.setBattery(new RFBattery(10000, 1500, 0)); + this.tanks[0].setAcceptedFluid(BuildCraftEnergy.fluidOil); + this.tanks[1].setAcceptedFluid(BuildCraftEnergy.fluidOil); } - + @Override public int getSizeInventory() { return 0; @@ -178,7 +178,7 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve public boolean hasWork() { return isActive; } - + @Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); @@ -299,10 +299,14 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve int used = 0; FluidStack resourceUsing = resource.copy(); - used += tanks[0].fill(resourceUsing, doFill); - resourceUsing.amount -= used; - used += tanks[1].fill(resourceUsing, doFill); - + if (RefineryRecipeManager.INSTANCE.getValidFluidStacks1().contains(resource)) { + used += tanks[0].fill(resourceUsing, doFill); + resourceUsing.amount -= used; + } + if (RefineryRecipeManager.INSTANCE.getValidFluidStacks2().contains(resource)) { + used += tanks[1].fill(resourceUsing, doFill); + resourceUsing.amount -= used; + } updateRecipe(); return used; @@ -330,8 +334,6 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve break; } } - - sendNetworkUpdate(); } @Override diff --git a/common/buildcraft/factory/schematics/SchematicAutoWorkbench.java b/common/buildcraft/factory/schematics/SchematicAutoWorkbench.java new file mode 100644 index 00000000..65c5ae78 --- /dev/null +++ b/common/buildcraft/factory/schematics/SchematicAutoWorkbench.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.factory.schematics; + +import java.util.ArrayList; +import java.util.LinkedList; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import buildcraft.BuildCraftFactory; +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicTile; +import buildcraft.api.core.IInvSlot; +import buildcraft.api.core.JavaTools; +import buildcraft.core.inventory.InventoryIterator; +import buildcraft.factory.TileAutoWorkbench; + +public class SchematicAutoWorkbench extends SchematicTile { + + @Override + public void storeRequirements(IBuilderContext context, int x, int y, int z) { + TileAutoWorkbench autoWb = getTile(context, x, y, z); + if (autoWb != null) { + ArrayList rqs = new ArrayList(); + rqs.add(new ItemStack(BuildCraftFactory.autoWorkbenchBlock)); + + for (IInvSlot slot : InventoryIterator.getIterable(autoWb.craftMatrix, ForgeDirection.UP)) { + ItemStack stack = slot.getStackInSlot(); + if (stack != null) { + stack = stack.copy(); + stack.stackSize = 1; + rqs.add(stack); + } + } + + storedRequirements = JavaTools.concat(storedRequirements, rqs + .toArray(new ItemStack[rqs.size()])); + } + } + + @Override + public void initializeFromObjectAt(IBuilderContext context, int x, int y, int z) { + super.initializeFromObjectAt(context, x, y, z); + + tileNBT.removeTag("Items"); + } + + @Override + public void placeInWorld(IBuilderContext context, int x, int y, int z, LinkedList stacks) { + super.placeInWorld(context, x, y, z, stacks); + + TileAutoWorkbench autoWb = getTile(context, x, y, z); + if (autoWb != null) { + for (IInvSlot slot : InventoryIterator.getIterable(autoWb.craftMatrix, ForgeDirection.UP)) { + ItemStack stack = slot.getStackInSlot(); + if (stack != null) { + stack.stackSize = 1; + } + } + } + } + + @Override + public BuildingStage getBuildStage() { + return BuildingStage.STANDALONE; + } + + private TileAutoWorkbench getTile(IBuilderContext context, int x, int y, int z) { + TileEntity tile = context.world().getTileEntity(x, y, z); + if (tile != null && tile instanceof TileAutoWorkbench) { + return (TileAutoWorkbench) tile; + } + return null; + } +} diff --git a/common/buildcraft/factory/schematics/SchematicTank.java b/common/buildcraft/factory/schematics/SchematicTileIgnoreState.java similarity index 94% rename from common/buildcraft/factory/schematics/SchematicTank.java rename to common/buildcraft/factory/schematics/SchematicTileIgnoreState.java index 2207aa7a..cf6ebcc0 100644 --- a/common/buildcraft/factory/schematics/SchematicTank.java +++ b/common/buildcraft/factory/schematics/SchematicTileIgnoreState.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.SchematicTile; -public class SchematicTank extends SchematicTile { +public class SchematicTileIgnoreState extends SchematicTile { @Override public void getRequirementsForPlacement(IBuilderContext context, LinkedList requirements) { diff --git a/common/buildcraft/silicon/TileAssemblyTable.java b/common/buildcraft/silicon/TileAssemblyTable.java index 8a4accaf..88ef4c4b 100644 --- a/common/buildcraft/silicon/TileAssemblyTable.java +++ b/common/buildcraft/silicon/TileAssemblyTable.java @@ -46,6 +46,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, public String currentRecipeId = ""; public IFlexibleRecipe currentRecipe; private HashSet plannedOutput = new HashSet(); + private boolean queuedNetworkUpdate = false; public List> getPotentialOutputs() { List> result = new LinkedList>(); @@ -61,6 +62,10 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, return result; } + private void queueNetworkUpdate() { + queuedNetworkUpdate = true; + } + @Override public boolean canUpdate() { return !FMLCommonHandler.instance().getEffectiveSide().isClient(); @@ -70,6 +75,11 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, public void updateEntity() { // WARNING: run only server-side, see canUpdate() super.updateEntity(); + if (queuedNetworkUpdate) { + sendNetworkUpdate(); + queuedNetworkUpdate = false; + } + if (currentRecipe == null) { return; } @@ -145,6 +155,8 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, for (int i = 0; i < size; i++) { plannedOutput.add(Utils.readUTF(stream)); } + + currentRecipe = AssemblyRecipeManager.INSTANCE.getRecipe(currentRecipeId); } @Override @@ -155,8 +167,6 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, for (String s: plannedOutput) { Utils.writeUTF(stream, s); } - - currentRecipe = AssemblyRecipeManager.INSTANCE.getRecipe(currentRecipeId); } @Override public void readFromNBT(NBTTagCompound nbt) { @@ -220,7 +230,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, } if (worldObj != null && !worldObj.isRemote) { - sendNetworkUpdate(); + queueNetworkUpdate(); } } @@ -246,6 +256,8 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, if (!isAssembling(currentRecipe) || !isPlanned(currentRecipe)) { setCurrentRecipe(recipe); } + + queueNetworkUpdate(); } } @@ -259,6 +271,8 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, if (!plannedOutput.isEmpty()) { setCurrentRecipe(AssemblyRecipeManager.INSTANCE.getRecipe(plannedOutput.iterator().next())); } + + queueNetworkUpdate(); } public void setNextCurrentRecipe() { @@ -319,8 +333,6 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, cancelPlanOutput(recipe); } } - - sendNetworkUpdate(); } } diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index e7fefd30..dd491c4f 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -432,9 +432,9 @@ public class BlockGenericPipe extends BlockBuildCraft { pipeRemoved.put(new BlockIndex(x, y, z), pipe); world.removeTileEntity(x, y, z); - - updateNeighbourSignalState(pipe); - + if (pipe != null) { + updateNeighbourSignalState(pipe); + } } @Override diff --git a/common/buildcraft/transport/ItemFacade.java b/common/buildcraft/transport/ItemFacade.java index 8ed0344a..14c42e37 100644 --- a/common/buildcraft/transport/ItemFacade.java +++ b/common/buildcraft/transport/ItemFacade.java @@ -171,7 +171,7 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean debug) { for (FacadeState state : getFacadeStates(stack)) { - if (!state.transparent && state.block != null) { + if (state != null && !state.transparent && state.block != null && Item.getItemFromBlock(state.block) != null) { Item.getItemFromBlock(state.block).addInformation(new ItemStack(state.block, 1, state.metadata), player, list, debug); } } diff --git a/common/buildcraft/transport/PipeTransportItems.java b/common/buildcraft/transport/PipeTransportItems.java index 9a7afa59..b3d97010 100644 --- a/common/buildcraft/transport/PipeTransportItems.java +++ b/common/buildcraft/transport/PipeTransportItems.java @@ -230,6 +230,9 @@ public class PipeTransportItems extends PipeTransport { if (entity instanceof IPipeTile) { Pipe pipe = (Pipe) ((IPipeTile) entity).getPipe(); + if (pipe == null || pipe.transport == null) { + return false; + } if (pipe == null || pipe.transport == null) { return false; diff --git a/common/buildcraft/transport/schematics/SchematicPipe.java b/common/buildcraft/transport/schematics/SchematicPipe.java index c7910ad0..b14663da 100644 --- a/common/buildcraft/transport/schematics/SchematicPipe.java +++ b/common/buildcraft/transport/schematics/SchematicPipe.java @@ -183,7 +183,7 @@ public class SchematicPipe extends SchematicTile { storedRequirements = new ItemStack[items.size() + 1]; items.toArray(storedRequirements); storedRequirements[storedRequirements.length - 1] = new ItemStack( - pipe.item); + pipe.item, 1, pipe.container.getItemMetadata()); } }