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: 'maven' // for uploading to a maven repo
|
||||||
apply plugin: 'checkstyle'
|
apply plugin: 'checkstyle'
|
||||||
|
|
||||||
version = "6.1.8"
|
version = "6.2.0"
|
||||||
group= "com.mod-buildcraft"
|
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]
|
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;
|
package buildcraft;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
|
@ -41,7 +40,6 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import buildcraft.api.blueprints.BuilderAPI;
|
import buildcraft.api.blueprints.BuilderAPI;
|
||||||
import buildcraft.api.core.BCLog;
|
import buildcraft.api.core.BCLog;
|
||||||
import buildcraft.api.core.BlockIndex;
|
|
||||||
import buildcraft.api.core.JavaTools;
|
import buildcraft.api.core.JavaTools;
|
||||||
import buildcraft.api.core.StackKey;
|
import buildcraft.api.core.StackKey;
|
||||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||||
|
|
|
@ -598,10 +598,8 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
||||||
|
|
||||||
if (getWorldObj().getWorldInfo().getGameType() == GameType.CREATIVE) {
|
if (getWorldObj().getWorldInfo().getGameType() == GameType.CREATIVE) {
|
||||||
build();
|
build();
|
||||||
} else {
|
} else if (getBattery().getEnergyStored() > POWER_ACTIVATION) {
|
||||||
if (getBattery().getEnergyStored() > POWER_ACTIVATION) {
|
build();
|
||||||
build();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isBuilding && this.isBuildingBlueprint()) {
|
if (!isBuilding && this.isBuildingBlueprint()) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cofh.api.energy.IEnergyHandler;
|
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.api.core.ISerializable;
|
import buildcraft.api.core.ISerializable;
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
|
import buildcraft.api.blueprints.BuildingPermission;
|
||||||
import buildcraft.api.blueprints.IBuilderContext;
|
import buildcraft.api.blueprints.IBuilderContext;
|
||||||
import buildcraft.api.blueprints.MappingNotFoundException;
|
import buildcraft.api.blueprints.MappingNotFoundException;
|
||||||
import buildcraft.api.blueprints.MappingRegistry;
|
import buildcraft.api.blueprints.MappingRegistry;
|
||||||
|
@ -26,6 +27,7 @@ import buildcraft.api.blueprints.SchematicFactory;
|
||||||
import buildcraft.api.blueprints.SchematicMask;
|
import buildcraft.api.blueprints.SchematicMask;
|
||||||
import buildcraft.api.core.BCLog;
|
import buildcraft.api.core.BCLog;
|
||||||
import buildcraft.api.core.Position;
|
import buildcraft.api.core.Position;
|
||||||
|
import buildcraft.core.inventory.StackHelper;
|
||||||
|
|
||||||
public class BuildingSlotBlock extends BuildingSlot {
|
public class BuildingSlotBlock extends BuildingSlot {
|
||||||
|
|
||||||
|
@ -59,6 +61,38 @@ public class BuildingSlotBlock extends BuildingSlot {
|
||||||
try {
|
try {
|
||||||
getSchematic().placeInWorld(context, x, y, z, stackConsumed);
|
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
|
// Once the schematic has been written, we're going to issue
|
||||||
// calls
|
// calls
|
||||||
// to various functions, in particular updating the tile entity.
|
// to various functions, in particular updating the tile entity.
|
||||||
|
@ -71,24 +105,6 @@ public class BuildingSlotBlock extends BuildingSlot {
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
e.updateEntity();
|
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) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
context.world().setBlockToAir(x, y, z);
|
context.world().setBlockToAir(x, y, z);
|
||||||
|
|
|
@ -8,9 +8,7 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.core.builders;
|
package buildcraft.core.builders;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -20,7 +18,6 @@ import buildcraft.api.blueprints.MappingNotFoundException;
|
||||||
import buildcraft.api.blueprints.MappingRegistry;
|
import buildcraft.api.blueprints.MappingRegistry;
|
||||||
import buildcraft.api.blueprints.SchematicEntity;
|
import buildcraft.api.blueprints.SchematicEntity;
|
||||||
import buildcraft.api.blueprints.SchematicFactory;
|
import buildcraft.api.blueprints.SchematicFactory;
|
||||||
import buildcraft.api.core.BCLog;
|
|
||||||
import buildcraft.api.core.Position;
|
import buildcraft.api.core.Position;
|
||||||
|
|
||||||
public class BuildingSlotEntity extends BuildingSlot {
|
public class BuildingSlotEntity extends BuildingSlot {
|
||||||
|
|
|
@ -32,11 +32,9 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
|
||||||
IBuildingItemsProvider, ICommandReceiver {
|
IBuildingItemsProvider, ICommandReceiver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the maximum amount of energy required to build a full chest,
|
* The builder should not act as a gigantic energy buffer, thus we keep enough
|
||||||
* plus a safeguard. That's a nice way to evaluate maximum amount of energy
|
* build energy to build about 2 stacks' worth of blocks.
|
||||||
* that need to be in a builder.
|
|
||||||
*/
|
*/
|
||||||
private static final int FULL_CHEST_ENERGY = 9 * 3 * 64 * BuilderAPI.BUILD_ENERGY + 10000;
|
|
||||||
|
|
||||||
public LinkedList<LaserData> pathLasers = new LinkedList<LaserData> ();
|
public LinkedList<LaserData> pathLasers = new LinkedList<LaserData> ();
|
||||||
|
|
||||||
|
@ -47,7 +45,7 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
|
||||||
|
|
||||||
public TileAbstractBuilder() {
|
public TileAbstractBuilder() {
|
||||||
super();
|
super();
|
||||||
this.setBattery(new RFBattery(FULL_CHEST_ENERGY, 1000, 0));
|
this.setBattery(new RFBattery(2 * 64 * BuilderAPI.BUILD_ENERGY, 1000, 0));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void initialize () {
|
public void initialize () {
|
||||||
|
|
|
@ -39,14 +39,11 @@ import buildcraft.api.statements.StatementParameterItemStack;
|
||||||
import buildcraft.api.transport.IPipe;
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.api.transport.PipeWire;
|
import buildcraft.api.transport.PipeWire;
|
||||||
import buildcraft.core.GuiIds;
|
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.GateLogic;
|
||||||
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
||||||
import buildcraft.transport.gates.ItemGate;
|
import buildcraft.transport.gates.ItemGate;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.transport.gates.StatementSlot;
|
||||||
import buildcraft.transport.gui.ContainerGateInterface;
|
import buildcraft.transport.gui.ContainerGateInterface;
|
||||||
import buildcraft.transport.statements.ActionRedstoneFaderOutput;
|
|
||||||
import buildcraft.transport.statements.ActionValve;
|
import buildcraft.transport.statements.ActionValve;
|
||||||
|
|
||||||
public final class Gate implements IGate, IStatementContainer {
|
public final class Gate implements IGate, IStatementContainer {
|
||||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cofh.api.energy.IEnergyConnection;
|
import cofh.api.energy.IEnergyConnection;
|
||||||
import cofh.api.energy.IEnergyHandler;
|
|
||||||
import cofh.api.energy.IEnergyProvider;
|
import cofh.api.energy.IEnergyProvider;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraftforge.client.IItemRenderer;
|
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.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import buildcraft.api.statements.IActionInternal;
|
import buildcraft.api.statements.IActionInternal;
|
||||||
import buildcraft.api.statements.IStatementContainer;
|
|
||||||
import buildcraft.api.statements.IStatementParameter;
|
|
||||||
import buildcraft.core.statements.ActionRedstoneOutput;
|
import buildcraft.core.statements.ActionRedstoneOutput;
|
||||||
import buildcraft.core.statements.BCStatement;
|
|
||||||
import buildcraft.core.statements.StatementParameterRedstoneGateSideOnly;
|
|
||||||
import buildcraft.core.utils.StringUtils;
|
import buildcraft.core.utils.StringUtils;
|
||||||
import buildcraft.transport.Gate;
|
|
||||||
|
|
||||||
public class ActionRedstoneFaderOutput extends ActionRedstoneOutput implements IActionInternal {
|
public class ActionRedstoneFaderOutput extends ActionRedstoneOutput implements IActionInternal {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue