fix bugs, reduce quarry/builder/filler buffer
This commit is contained in:
parent
2243221ae7
commit
7045964097
11 changed files with 40 additions and 44 deletions
|
@ -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.1.8"
|
||||
version = "6.2.0"
|
||||
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]
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
package buildcraft;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
|
@ -41,7 +40,6 @@ import net.minecraftforge.fluids.FluidRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.core.JavaTools;
|
||||
import buildcraft.api.core.StackKey;
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
|
|
|
@ -598,10 +598,8 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
|||
|
||||
if (getWorldObj().getWorldInfo().getGameType() == GameType.CREATIVE) {
|
||||
build();
|
||||
} else {
|
||||
if (getBattery().getEnergyStored() > POWER_ACTIVATION) {
|
||||
build();
|
||||
}
|
||||
} else if (getBattery().getEnergyStored() > POWER_ACTIVATION) {
|
||||
build();
|
||||
}
|
||||
|
||||
if (!isBuilding && this.isBuildingBlueprint()) {
|
||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.core.ISerializable;
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import buildcraft.api.blueprints.BuildingPermission;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.MappingNotFoundException;
|
||||
import buildcraft.api.blueprints.MappingRegistry;
|
||||
|
@ -26,6 +27,7 @@ import buildcraft.api.blueprints.SchematicFactory;
|
|||
import buildcraft.api.blueprints.SchematicMask;
|
||||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
|
||||
public class BuildingSlotBlock extends BuildingSlot {
|
||||
|
||||
|
@ -59,6 +61,38 @@ public class BuildingSlotBlock extends BuildingSlot {
|
|||
try {
|
||||
getSchematic().placeInWorld(context, x, y, z, stackConsumed);
|
||||
|
||||
// This is slightly hackish, but it's a very important way to verify
|
||||
// the stored requirements.
|
||||
|
||||
if (!context.world().isAirBlock(x, y, z) &&
|
||||
getSchematic().getBuildingPermission() == BuildingPermission.ALL &&
|
||||
getSchematic() instanceof SchematicBlock) {
|
||||
SchematicBlock sb = (SchematicBlock) getSchematic();
|
||||
// Copy the old array of stored requirements.
|
||||
ItemStack[] oldRequirementsArray = sb.storedRequirements;
|
||||
List<ItemStack> oldRequirements = Arrays.asList(oldRequirementsArray);
|
||||
sb.storedRequirements = new ItemStack[0];
|
||||
sb.storeRequirements(context, x, y, z);
|
||||
for (ItemStack s : sb.storedRequirements) {
|
||||
boolean contains = false;
|
||||
for (ItemStack ss : oldRequirements) {
|
||||
if (StackHelper.isMatchingItem(s, ss)) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contains) {
|
||||
BCLog.logger.warn("Blueprint has MISMATCHING REQUIREMENTS! Potential corrupted/hacked blueprint! Removed mismatched block.");
|
||||
BCLog.logger.warn("Location: " + x + ", " + y + ", " + z + " - ItemStack: " + s.toString());
|
||||
context.world().removeTileEntity(x, y, z);
|
||||
context.world().setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Restore the stored requirements.
|
||||
sb.storedRequirements = oldRequirementsArray;
|
||||
}
|
||||
|
||||
// Once the schematic has been written, we're going to issue
|
||||
// calls
|
||||
// to various functions, in particular updating the tile entity.
|
||||
|
@ -71,24 +105,6 @@ public class BuildingSlotBlock extends BuildingSlot {
|
|||
if (e != null) {
|
||||
e.updateEntity();
|
||||
}
|
||||
|
||||
// This is slightly hackish, but it's a very important way to verify
|
||||
// the stored requirements.
|
||||
|
||||
if (getSchematic() instanceof SchematicBlock) {
|
||||
SchematicBlock sb = (SchematicBlock) getSchematic();
|
||||
// Copy the old array of stored requirements.
|
||||
List<ItemStack> oldRequirements = Arrays.asList(sb.storedRequirements);
|
||||
sb.storedRequirements = new ItemStack[0];
|
||||
sb.storeRequirements(context, x, y, z);
|
||||
for (ItemStack s : sb.storedRequirements) {
|
||||
if (!oldRequirements.contains(s)) {
|
||||
BCLog.logger.warn("Blueprint has MISMATCHING REQUIREMENTS! Potential corrupted/hacked blueprint! Removed mismatched block.");
|
||||
context.world().setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
context.world().setBlockToAir(x, y, z);
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
*/
|
||||
package buildcraft.core.builders;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -20,7 +18,6 @@ import buildcraft.api.blueprints.MappingNotFoundException;
|
|||
import buildcraft.api.blueprints.MappingRegistry;
|
||||
import buildcraft.api.blueprints.SchematicEntity;
|
||||
import buildcraft.api.blueprints.SchematicFactory;
|
||||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.api.core.Position;
|
||||
|
||||
public class BuildingSlotEntity extends BuildingSlot {
|
||||
|
|
|
@ -32,11 +32,9 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
|
|||
IBuildingItemsProvider, ICommandReceiver {
|
||||
|
||||
/**
|
||||
* Computes the maximum amount of energy required to build a full chest,
|
||||
* plus a safeguard. That's a nice way to evaluate maximum amount of energy
|
||||
* that need to be in a builder.
|
||||
* The builder should not act as a gigantic energy buffer, thus we keep enough
|
||||
* build energy to build about 2 stacks' worth of blocks.
|
||||
*/
|
||||
private static final int FULL_CHEST_ENERGY = 9 * 3 * 64 * BuilderAPI.BUILD_ENERGY + 10000;
|
||||
|
||||
public LinkedList<LaserData> pathLasers = new LinkedList<LaserData> ();
|
||||
|
||||
|
@ -47,7 +45,7 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
|
|||
|
||||
public TileAbstractBuilder() {
|
||||
super();
|
||||
this.setBattery(new RFBattery(FULL_CHEST_ENERGY, 1000, 0));
|
||||
this.setBattery(new RFBattery(2 * 64 * BuilderAPI.BUILD_ENERGY, 1000, 0));
|
||||
}
|
||||
@Override
|
||||
public void initialize () {
|
||||
|
|
|
@ -39,14 +39,11 @@ import buildcraft.api.statements.StatementParameterItemStack;
|
|||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.GuiIds;
|
||||
import buildcraft.core.statements.ActionRedstoneOutput;
|
||||
import buildcraft.core.statements.StatementParameterRedstoneGateSideOnly;
|
||||
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
||||
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
||||
import buildcraft.transport.gates.ItemGate;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
import buildcraft.transport.gui.ContainerGateInterface;
|
||||
import buildcraft.transport.statements.ActionRedstoneFaderOutput;
|
||||
import buildcraft.transport.statements.ActionValve;
|
||||
|
||||
public final class Gate implements IGate, IStatementContainer {
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import buildcraft.BuildCraftCore;
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
|
|
@ -13,13 +13,8 @@ import net.minecraft.util.IIcon;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import buildcraft.api.statements.IActionInternal;
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.core.statements.ActionRedstoneOutput;
|
||||
import buildcraft.core.statements.BCStatement;
|
||||
import buildcraft.core.statements.StatementParameterRedstoneGateSideOnly;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.Gate;
|
||||
|
||||
public class ActionRedstoneFaderOutput extends ActionRedstoneOutput implements IActionInternal {
|
||||
|
||||
|
|
Loading…
Reference in a new issue