diff --git a/buildcraft_resources/changelog/7.1.6 b/buildcraft_resources/changelog/7.1.6 index 9acf5a52..b270b99c 100644 --- a/buildcraft_resources/changelog/7.1.6 +++ b/buildcraft_resources/changelog/7.1.6 @@ -1,14 +1,17 @@ -Additions: - -* "/buildcraft op" and "/buildcraft deop", used to op/deop the BuildCraft "fake player" (asie) - Improvements: -* New quarry frame model! (asie) +* "/buildcraft op" and "/buildcraft deop" commands, letting you easily op/deop the BuildCraft "fake player" (asie) +* New Quarry frame model (asie) * Quarry now rebuilds its own frame if it is removed (asie) Bugs fixed: +* [#3033] Emerald Transport Pipes only changing setting after closing GUI (asie) * [#2998] Quarries not respecting a certain form of player-specific protection (asie) +* Biome config crashing instead of finding a new ID on setting ID past 256 (asie) +* Crash in TileAssemblyTable upon removing a mod whose Assembly Table recipes were being used (asie) * Creative Engines only outputting 1/5th the advertised RF/t (asie) -* Frame icon not rendering on Quarry Frame building (asie) +* Frame icon not rendering on Quarry frame building (asie) +* NullPointerException on invalid StackRequest saving (asie) +* Rare StackOverflowException on breaking Markers (asie) +* StackOverflowException when breaking large Quarry frames (asie) diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index 7efb0ab8..fbc426d9 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -159,8 +159,10 @@ public class BuildCraftEnergy extends BuildCraftMod { BuildCraftCore.mainConfiguration.save(); + BiomeGenBase[] biomeGenArray = BiomeGenBase.getBiomeGenArray(); + if (oilDesertBiomeId > 0) { - if (BiomeGenBase.getBiomeGenArray()[oilDesertBiomeId] != null) { + if (biomeGenArray.length >= oilDesertBiomeId || biomeGenArray[oilDesertBiomeId] != null) { oilDesertBiomeId = findUnusedBiomeID("oilDesert"); // save changes to config file BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilDesert", oilDesertBiomeId).set(oilDesertBiomeId); @@ -170,7 +172,7 @@ public class BuildCraftEnergy extends BuildCraftMod { } if (oilOceanBiomeId > 0) { - if (BiomeGenBase.getBiomeGenArray()[oilOceanBiomeId] != null) { + if (biomeGenArray.length >= oilOceanBiomeId || biomeGenArray[oilOceanBiomeId] != null) { oilOceanBiomeId = findUnusedBiomeID("oilOcean"); // save changes to config file BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilOcean", oilOceanBiomeId).set(oilOceanBiomeId); @@ -433,7 +435,7 @@ public class BuildCraftEnergy extends BuildCraftMod { private static final long serialVersionUID = 1L; public BiomeIdLimitException(String biome) { - super(String.format("You have run out of free Biome ID spaces for %s", biome)); + super(String.format("You have run out of free Biome ID spaces for %s - free more Biome IDs or disable the biome by setting the ID to 0!", biome)); } } diff --git a/common/buildcraft/builders/BlockFrame.java b/common/buildcraft/builders/BlockFrame.java index 977e83dc..7134ce1a 100644 --- a/common/buildcraft/builders/BlockFrame.java +++ b/common/buildcraft/builders/BlockFrame.java @@ -9,8 +9,11 @@ package buildcraft.builders; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Random; +import java.util.Set; +import java.util.concurrent.ConcurrentSkipListSet; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -27,12 +30,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import buildcraft.BuildCraftCore; +import buildcraft.api.core.BlockIndex; import buildcraft.core.CoreConstants; import buildcraft.core.internal.IFramePipeConnection; import buildcraft.core.lib.utils.Utils; public class BlockFrame extends Block implements IFramePipeConnection { + private static final ThreadLocal isRemovingFrames = new ThreadLocal(); public BlockFrame() { super(Material.glass); @@ -45,16 +49,33 @@ public class BlockFrame extends Block implements IFramePipeConnection { return; } - removeNeighboringFrames(world, x, y, z); + if (isRemovingFrames.get() == null) { + removeNeighboringFrames(world, x, y, z); + } } public void removeNeighboringFrames(World world, int x, int y, int z) { - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - Block nBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ); - if (nBlock == this) { - world.setBlockToAir(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ); + isRemovingFrames.set(true); + + Set frameCoords = new ConcurrentSkipListSet(); + frameCoords.add(new BlockIndex(x, y, z)); + + while (frameCoords.size() > 0) { + Iterator frameCoordIterator = frameCoords.iterator(); + while (frameCoordIterator.hasNext()) { + BlockIndex i = frameCoordIterator.next(); + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + Block nBlock = world.getBlock(i.x + dir.offsetX, i.y + dir.offsetY, i.z + dir.offsetZ); + if (nBlock == this) { + world.setBlockToAir(i.x + dir.offsetX, i.y + dir.offsetY, i.z + dir.offsetZ); + frameCoords.add(new BlockIndex(i.x + dir.offsetX, i.y + dir.offsetY, i.z + dir.offsetZ)); + } + } + frameCoordIterator.remove(); } } + + isRemovingFrames.remove(); } @Override diff --git a/common/buildcraft/core/BlockMarker.java b/common/buildcraft/core/BlockMarker.java index f94b6015..a2e6df67 100644 --- a/common/buildcraft/core/BlockMarker.java +++ b/common/buildcraft/core/BlockMarker.java @@ -149,7 +149,7 @@ public class BlockMarker extends BlockBuildCraft { private void dropTorchIfCantStay(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - if (!canPlaceBlockOnSide(world, x, y, z, meta)) { + if (!canPlaceBlockOnSide(world, x, y, z, meta) && world.getBlock(x, y, z) == this) { dropBlockAsItem(world, x, y, z, 0, 0); world.setBlockToAir(x, y, z); } diff --git a/common/buildcraft/core/lib/network/PacketGuiReturn.java b/common/buildcraft/core/lib/network/PacketGuiReturn.java index 14e30ab1..931b34d4 100644 --- a/common/buildcraft/core/lib/network/PacketGuiReturn.java +++ b/common/buildcraft/core/lib/network/PacketGuiReturn.java @@ -20,6 +20,7 @@ import net.minecraftforge.common.DimensionManager; import buildcraft.BuildCraftCore; import buildcraft.core.network.PacketIds; +// TODO: Rename to PacketGuiUpdate public class PacketGuiReturn extends Packet { private EntityPlayer sender; private IGuiReturnHandler obj; diff --git a/common/buildcraft/core/lib/utils/ResourceUtils.java b/common/buildcraft/core/lib/utils/ResourceUtils.java index f1853f79..d462050e 100644 --- a/common/buildcraft/core/lib/utils/ResourceUtils.java +++ b/common/buildcraft/core/lib/utils/ResourceUtils.java @@ -48,6 +48,10 @@ public final class ResourceUtils { * @return */ public static String getObjectPrefix(String objectName) { + if (objectName == null) { + return null; + } + int splitLocation = objectName.indexOf(":"); return objectName.substring(0, splitLocation).replaceAll("[^a-zA-Z0-9\\s]", "") + objectName.substring(splitLocation); } diff --git a/common/buildcraft/core/render/RenderLEDTile.java b/common/buildcraft/core/render/RenderLEDTile.java index 2b1a7746..03c1e8f8 100644 --- a/common/buildcraft/core/render/RenderLEDTile.java +++ b/common/buildcraft/core/render/RenderLEDTile.java @@ -33,17 +33,19 @@ public class RenderLEDTile extends TileEntitySpecialRenderer { public static void registerBlockIcons(IIconRegister register) { for (Block b : iconMap.keySet().toArray(new Block[iconMap.keySet().size()])) { String base = ResourceUtils.getObjectPrefix(Block.blockRegistry.getNameForObject(b)); - List icons = new ArrayList(); - if (b instanceof ICustomLEDBlock) { - for (String s : ((ICustomLEDBlock) b).getLEDSuffixes()) { - icons.add(register.registerIcon(base + "/" + s)); + if (base != null) { + List icons = new ArrayList(); + if (b instanceof ICustomLEDBlock) { + for (String s : ((ICustomLEDBlock) b).getLEDSuffixes()) { + icons.add(register.registerIcon(base + "/" + s)); + } + } else { + icons.add(register.registerIcon(base + "/led_red")); + icons.add(register.registerIcon(base + "/led_green")); } - } else { - icons.add(register.registerIcon(base + "/led_red")); - icons.add(register.registerIcon(base + "/led_green")); - } - iconMap.put(b, icons.toArray(new IIcon[icons.size()])); + iconMap.put(b, icons.toArray(new IIcon[icons.size()])); + } } } diff --git a/common/buildcraft/robotics/StackRequest.java b/common/buildcraft/robotics/StackRequest.java index 87828d69..06ed41fa 100755 --- a/common/buildcraft/robotics/StackRequest.java +++ b/common/buildcraft/robotics/StackRequest.java @@ -51,7 +51,10 @@ public class StackRequest { public IRequestProvider getRequester(World world) { if (requester == null) { - requester = getStation(world).getRequestProvider(); + DockingStation dockingStation = getStation(world); + if (dockingStation != null) { + requester = dockingStation.getRequestProvider(); + } } return requester; } @@ -85,24 +88,30 @@ public class StackRequest { stack.writeToNBT(stackNBT); nbt.setTag("stack", stackNBT); - NBTTagCompound stationIndexNBT = new NBTTagCompound(); - station.index().writeTo(stationIndexNBT); - nbt.setTag("stationIndex", stationIndexNBT); - nbt.setByte("stationSide", (byte) station.side().ordinal()); + if (station != null) { + NBTTagCompound stationIndexNBT = new NBTTagCompound(); + station.index().writeTo(stationIndexNBT); + nbt.setTag("stationIndex", stationIndexNBT); + nbt.setByte("stationSide", (byte) station.side().ordinal()); + } } public static StackRequest loadFromNBT(NBTTagCompound nbt) { - int slot = nbt.getInteger("slot"); + if (nbt.hasKey("stationIndex")) { + int slot = nbt.getInteger("slot"); - ItemStack stack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stack")); + ItemStack stack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stack")); - BlockIndex stationIndex = new BlockIndex(nbt.getCompoundTag("stationIndex")); - ForgeDirection stationSide = ForgeDirection.values()[nbt.getByte("stationSide")]; + BlockIndex stationIndex = new BlockIndex(nbt.getCompoundTag("stationIndex")); + ForgeDirection stationSide = ForgeDirection.values()[nbt.getByte("stationSide")]; - return new StackRequest(slot, stack, stationIndex, stationSide); + return new StackRequest(slot, stack, stationIndex, stationSide); + } else { + return null; + } } public ResourceId getResourceId(World world) { - return new ResourceIdRequest(getStation(world), slot); + return getStation(world) != null ? new ResourceIdRequest(getStation(world), slot) : null; } } diff --git a/common/buildcraft/robotics/ai/AIRobotDeliverRequested.java b/common/buildcraft/robotics/ai/AIRobotDeliverRequested.java index 835329ec..cd2a8c5f 100755 --- a/common/buildcraft/robotics/ai/AIRobotDeliverRequested.java +++ b/common/buildcraft/robotics/ai/AIRobotDeliverRequested.java @@ -36,7 +36,12 @@ public class AIRobotDeliverRequested extends AIRobot { @Override public void start() { - startDelegateAI(new AIRobotGotoStation(robot, requested.getStation(robot.worldObj))); + if (requested != null) { + startDelegateAI(new AIRobotGotoStation(robot, requested.getStation(robot.worldObj))); + } else { + setSuccess(false); + terminate(); + } } @Override diff --git a/common/buildcraft/silicon/TileAssemblyTable.java b/common/buildcraft/silicon/TileAssemblyTable.java index 97a56577..1d0a3976 100644 --- a/common/buildcraft/silicon/TileAssemblyTable.java +++ b/common/buildcraft/silicon/TileAssemblyTable.java @@ -142,18 +142,22 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory, private void generatePlannedOutputIcons() { for (String s : plannedOutput) { IFlexibleRecipe recipe = AssemblyRecipeManager.INSTANCE.getRecipe(s); - CraftingResult result = recipe.craft(this, true); - if (result != null && result.usedItems != null && result.usedItems.size() > 0) { - plannedOutputIcons.put(s, result); - } else if (recipe instanceof IFlexibleRecipeViewable) { - // !! HACK !! TODO !! HACK !! - Object out = ((IFlexibleRecipeViewable) recipe).getOutput(); - if (out instanceof ItemStack) { - result = new CraftingResult(); - result.crafted = (ItemStack) out; - result.recipe = recipe; + if (recipe != null) { + CraftingResult result = recipe.craft(this, true); + if (result != null && result.usedItems != null && result.usedItems.size() > 0) { plannedOutputIcons.put(s, result); + } else if (recipe instanceof IFlexibleRecipeViewable) { + // !! HACK !! TODO !! HACK !! + Object out = ((IFlexibleRecipeViewable) recipe).getOutput(); + if (out instanceof ItemStack) { + result = new CraftingResult(); + result.crafted = (ItemStack) out; + result.recipe = recipe; + plannedOutputIcons.put(s, result); + } } + } else { + plannedOutput.remove(s); } } diff --git a/common/buildcraft/transport/gui/GuiEmeraldPipe.java b/common/buildcraft/transport/gui/GuiEmeraldPipe.java index dc9eb26f..9cc250e3 100644 --- a/common/buildcraft/transport/gui/GuiEmeraldPipe.java +++ b/common/buildcraft/transport/gui/GuiEmeraldPipe.java @@ -82,16 +82,6 @@ public class GuiEmeraldPipe extends GuiBuildCraft implements IButtonClickEventLi } } - @Override - public void onGuiClosed() { - if (pipe.getWorld().isRemote) { - PacketGuiReturn pkt = new PacketGuiReturn(pipe.getContainer()); - pkt.sendPacket(); - } - - super.onGuiClosed(); - } - @Override public void handleButtonClick(IButtonClickEventTrigger sender, int buttonId) { switch (buttonId) { @@ -117,6 +107,11 @@ public class GuiEmeraldPipe extends GuiBuildCraft implements IButtonClickEventLi pipe.getSettings().setFilterMode(FilterMode.ROUND_ROBIN); break; } + + if (pipe.getWorld().isRemote) { + PacketGuiReturn pkt = new PacketGuiReturn(pipe.getContainer()); + pkt.sendPacket(); + } } @Override