fix a fair amount of bugs
This commit is contained in:
parent
927b0f099d
commit
5ce9ab97f2
11 changed files with 103 additions and 57 deletions
|
@ -1,14 +1,17 @@
|
||||||
Additions:
|
|
||||||
|
|
||||||
* "/buildcraft op" and "/buildcraft deop", used to op/deop the BuildCraft "fake player" (asie)
|
|
||||||
|
|
||||||
Improvements:
|
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)
|
* Quarry now rebuilds its own frame if it is removed (asie)
|
||||||
|
|
||||||
Bugs fixed:
|
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)
|
* [#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)
|
* 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)
|
||||||
|
|
|
@ -159,8 +159,10 @@ public class BuildCraftEnergy extends BuildCraftMod {
|
||||||
|
|
||||||
BuildCraftCore.mainConfiguration.save();
|
BuildCraftCore.mainConfiguration.save();
|
||||||
|
|
||||||
|
BiomeGenBase[] biomeGenArray = BiomeGenBase.getBiomeGenArray();
|
||||||
|
|
||||||
if (oilDesertBiomeId > 0) {
|
if (oilDesertBiomeId > 0) {
|
||||||
if (BiomeGenBase.getBiomeGenArray()[oilDesertBiomeId] != null) {
|
if (biomeGenArray.length >= oilDesertBiomeId || biomeGenArray[oilDesertBiomeId] != null) {
|
||||||
oilDesertBiomeId = findUnusedBiomeID("oilDesert");
|
oilDesertBiomeId = findUnusedBiomeID("oilDesert");
|
||||||
// save changes to config file
|
// save changes to config file
|
||||||
BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilDesert", oilDesertBiomeId).set(oilDesertBiomeId);
|
BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilDesert", oilDesertBiomeId).set(oilDesertBiomeId);
|
||||||
|
@ -170,7 +172,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oilOceanBiomeId > 0) {
|
if (oilOceanBiomeId > 0) {
|
||||||
if (BiomeGenBase.getBiomeGenArray()[oilOceanBiomeId] != null) {
|
if (biomeGenArray.length >= oilOceanBiomeId || biomeGenArray[oilOceanBiomeId] != null) {
|
||||||
oilOceanBiomeId = findUnusedBiomeID("oilOcean");
|
oilOceanBiomeId = findUnusedBiomeID("oilOcean");
|
||||||
// save changes to config file
|
// save changes to config file
|
||||||
BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilOcean", oilOceanBiomeId).set(oilOceanBiomeId);
|
BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilOcean", oilOceanBiomeId).set(oilOceanBiomeId);
|
||||||
|
@ -433,7 +435,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public BiomeIdLimitException(String biome) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,11 @@
|
||||||
package buildcraft.builders;
|
package buildcraft.builders;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentSkipListSet;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -27,12 +30,13 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.api.core.BlockIndex;
|
||||||
import buildcraft.core.CoreConstants;
|
import buildcraft.core.CoreConstants;
|
||||||
import buildcraft.core.internal.IFramePipeConnection;
|
import buildcraft.core.internal.IFramePipeConnection;
|
||||||
import buildcraft.core.lib.utils.Utils;
|
import buildcraft.core.lib.utils.Utils;
|
||||||
|
|
||||||
public class BlockFrame extends Block implements IFramePipeConnection {
|
public class BlockFrame extends Block implements IFramePipeConnection {
|
||||||
|
private static final ThreadLocal<Boolean> isRemovingFrames = new ThreadLocal<Boolean>();
|
||||||
|
|
||||||
public BlockFrame() {
|
public BlockFrame() {
|
||||||
super(Material.glass);
|
super(Material.glass);
|
||||||
|
@ -45,16 +49,33 @@ public class BlockFrame extends Block implements IFramePipeConnection {
|
||||||
return;
|
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) {
|
public void removeNeighboringFrames(World world, int x, int y, int z) {
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
isRemovingFrames.set(true);
|
||||||
Block nBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
|
||||||
if (nBlock == this) {
|
Set<BlockIndex> frameCoords = new ConcurrentSkipListSet<BlockIndex>();
|
||||||
world.setBlockToAir(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
frameCoords.add(new BlockIndex(x, y, z));
|
||||||
|
|
||||||
|
while (frameCoords.size() > 0) {
|
||||||
|
Iterator<BlockIndex> 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
|
@Override
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class BlockMarker extends BlockBuildCraft {
|
||||||
|
|
||||||
private void dropTorchIfCantStay(World world, int x, int y, int z) {
|
private void dropTorchIfCantStay(World world, int x, int y, int z) {
|
||||||
int meta = world.getBlockMetadata(x, y, 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);
|
dropBlockAsItem(world, x, y, z, 0, 0);
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraftforge.common.DimensionManager;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.core.network.PacketIds;
|
import buildcraft.core.network.PacketIds;
|
||||||
|
|
||||||
|
// TODO: Rename to PacketGuiUpdate
|
||||||
public class PacketGuiReturn extends Packet {
|
public class PacketGuiReturn extends Packet {
|
||||||
private EntityPlayer sender;
|
private EntityPlayer sender;
|
||||||
private IGuiReturnHandler obj;
|
private IGuiReturnHandler obj;
|
||||||
|
|
|
@ -48,6 +48,10 @@ public final class ResourceUtils {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getObjectPrefix(String objectName) {
|
public static String getObjectPrefix(String objectName) {
|
||||||
|
if (objectName == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
int splitLocation = objectName.indexOf(":");
|
int splitLocation = objectName.indexOf(":");
|
||||||
return objectName.substring(0, splitLocation).replaceAll("[^a-zA-Z0-9\\s]", "") + objectName.substring(splitLocation);
|
return objectName.substring(0, splitLocation).replaceAll("[^a-zA-Z0-9\\s]", "") + objectName.substring(splitLocation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,17 +33,19 @@ public class RenderLEDTile extends TileEntitySpecialRenderer {
|
||||||
public static void registerBlockIcons(IIconRegister register) {
|
public static void registerBlockIcons(IIconRegister register) {
|
||||||
for (Block b : iconMap.keySet().toArray(new Block[iconMap.keySet().size()])) {
|
for (Block b : iconMap.keySet().toArray(new Block[iconMap.keySet().size()])) {
|
||||||
String base = ResourceUtils.getObjectPrefix(Block.blockRegistry.getNameForObject(b));
|
String base = ResourceUtils.getObjectPrefix(Block.blockRegistry.getNameForObject(b));
|
||||||
List<IIcon> icons = new ArrayList<IIcon>();
|
if (base != null) {
|
||||||
if (b instanceof ICustomLEDBlock) {
|
List<IIcon> icons = new ArrayList<IIcon>();
|
||||||
for (String s : ((ICustomLEDBlock) b).getLEDSuffixes()) {
|
if (b instanceof ICustomLEDBlock) {
|
||||||
icons.add(register.registerIcon(base + "/" + s));
|
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()]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,10 @@ public class StackRequest {
|
||||||
|
|
||||||
public IRequestProvider getRequester(World world) {
|
public IRequestProvider getRequester(World world) {
|
||||||
if (requester == null) {
|
if (requester == null) {
|
||||||
requester = getStation(world).getRequestProvider();
|
DockingStation dockingStation = getStation(world);
|
||||||
|
if (dockingStation != null) {
|
||||||
|
requester = dockingStation.getRequestProvider();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return requester;
|
return requester;
|
||||||
}
|
}
|
||||||
|
@ -85,24 +88,30 @@ public class StackRequest {
|
||||||
stack.writeToNBT(stackNBT);
|
stack.writeToNBT(stackNBT);
|
||||||
nbt.setTag("stack", stackNBT);
|
nbt.setTag("stack", stackNBT);
|
||||||
|
|
||||||
NBTTagCompound stationIndexNBT = new NBTTagCompound();
|
if (station != null) {
|
||||||
station.index().writeTo(stationIndexNBT);
|
NBTTagCompound stationIndexNBT = new NBTTagCompound();
|
||||||
nbt.setTag("stationIndex", stationIndexNBT);
|
station.index().writeTo(stationIndexNBT);
|
||||||
nbt.setByte("stationSide", (byte) station.side().ordinal());
|
nbt.setTag("stationIndex", stationIndexNBT);
|
||||||
|
nbt.setByte("stationSide", (byte) station.side().ordinal());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StackRequest loadFromNBT(NBTTagCompound nbt) {
|
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"));
|
BlockIndex stationIndex = new BlockIndex(nbt.getCompoundTag("stationIndex"));
|
||||||
ForgeDirection stationSide = ForgeDirection.values()[nbt.getByte("stationSide")];
|
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) {
|
public ResourceId getResourceId(World world) {
|
||||||
return new ResourceIdRequest(getStation(world), slot);
|
return getStation(world) != null ? new ResourceIdRequest(getStation(world), slot) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,12 @@ public class AIRobotDeliverRequested extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
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
|
@Override
|
||||||
|
|
|
@ -142,18 +142,22 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
|
||||||
private void generatePlannedOutputIcons() {
|
private void generatePlannedOutputIcons() {
|
||||||
for (String s : plannedOutput) {
|
for (String s : plannedOutput) {
|
||||||
IFlexibleRecipe<ItemStack> recipe = AssemblyRecipeManager.INSTANCE.getRecipe(s);
|
IFlexibleRecipe<ItemStack> recipe = AssemblyRecipeManager.INSTANCE.getRecipe(s);
|
||||||
CraftingResult<ItemStack> result = recipe.craft(this, true);
|
if (recipe != null) {
|
||||||
if (result != null && result.usedItems != null && result.usedItems.size() > 0) {
|
CraftingResult<ItemStack> result = recipe.craft(this, true);
|
||||||
plannedOutputIcons.put(s, result);
|
if (result != null && result.usedItems != null && result.usedItems.size() > 0) {
|
||||||
} else if (recipe instanceof IFlexibleRecipeViewable) {
|
|
||||||
// !! HACK !! TODO !! HACK !!
|
|
||||||
Object out = ((IFlexibleRecipeViewable) recipe).getOutput();
|
|
||||||
if (out instanceof ItemStack) {
|
|
||||||
result = new CraftingResult<ItemStack>();
|
|
||||||
result.crafted = (ItemStack) out;
|
|
||||||
result.recipe = recipe;
|
|
||||||
plannedOutputIcons.put(s, result);
|
plannedOutputIcons.put(s, result);
|
||||||
|
} else if (recipe instanceof IFlexibleRecipeViewable) {
|
||||||
|
// !! HACK !! TODO !! HACK !!
|
||||||
|
Object out = ((IFlexibleRecipeViewable) recipe).getOutput();
|
||||||
|
if (out instanceof ItemStack) {
|
||||||
|
result = new CraftingResult<ItemStack>();
|
||||||
|
result.crafted = (ItemStack) out;
|
||||||
|
result.recipe = recipe;
|
||||||
|
plannedOutputIcons.put(s, result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
plannedOutput.remove(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
@Override
|
||||||
public void handleButtonClick(IButtonClickEventTrigger sender, int buttonId) {
|
public void handleButtonClick(IButtonClickEventTrigger sender, int buttonId) {
|
||||||
switch (buttonId) {
|
switch (buttonId) {
|
||||||
|
@ -117,6 +107,11 @@ public class GuiEmeraldPipe extends GuiBuildCraft implements IButtonClickEventLi
|
||||||
pipe.getSettings().setFilterMode(FilterMode.ROUND_ROBIN);
|
pipe.getSettings().setFilterMode(FilterMode.ROUND_ROBIN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pipe.getWorld().isRemote) {
|
||||||
|
PacketGuiReturn pkt = new PacketGuiReturn(pipe.getContainer());
|
||||||
|
pkt.sendPacket();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue