Implemented control in the architect, as not to read non-explicitely supported

blocks.
Implemented blacklist for mods and blocks in builder.
Close #1594.
This commit is contained in:
SpaceToad 2014-05-01 16:42:58 +02:00
parent f7d466c172
commit 1551d7c129
10 changed files with 61 additions and 8 deletions

View file

@ -159,6 +159,8 @@ public class BuildCraftBuilders extends BuildCraftMod {
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Builders");
// Register gui handler
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
@ -373,6 +375,8 @@ public class BuildCraftBuilders extends BuildCraftMod {
GameRegistry.registerTileEntity(TilePathMarker.class, "net.minecraft.src.builders.TilePathMarker");
GameRegistry.registerTileEntity(TileBlueprintLibrary.class, "net.minecraft.src.builders.TileBlueprintLibrary");
SchematicRegistry.readConfiguration(BuildCraftCore.mainConfiguration);
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}

View file

@ -38,6 +38,7 @@ import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IIconProvider;
@ -200,6 +201,7 @@ public class BuildCraftCore extends BuildCraftMod {
@Mod.EventHandler
public void loadConfiguration(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Core");
BCLog.initLog();

View file

@ -109,6 +109,8 @@ public class BuildCraftEnergy extends BuildCraftMod {
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Energy");
int oilDesertBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilDesert", DefaultProps.BIOME_OIL_DESERT).getInt(DefaultProps.BIOME_OIL_DESERT);
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN);
canOilBurn = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "burnOil", true, "Can oil burn?").getBoolean(true);

View file

@ -128,6 +128,8 @@ public class BuildCraftFactory extends BuildCraftMod {
@Mod.EventHandler
public void load(FMLInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Factory");
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// EntityRegistry.registerModEntity(EntityMechanicalArm.class, "bcMechanicalArm", EntityIds.MECHANICAL_ARM, instance, 50, 1, true);

View file

@ -8,6 +8,13 @@
*/
package buildcraft;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.transport.PipeWire;
@ -16,8 +23,17 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.silicon.*;
import buildcraft.silicon.BlockLaser;
import buildcraft.silicon.BlockLaserTable;
import buildcraft.silicon.GuiHandler;
import buildcraft.silicon.ItemLaserTable;
import buildcraft.silicon.ItemRedstoneChipset;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import buildcraft.silicon.SiliconProxy;
import buildcraft.silicon.TileAdvancedCraftingTable;
import buildcraft.silicon.TileAssemblyTable;
import buildcraft.silicon.TileIntegrationTable;
import buildcraft.silicon.TileLaser;
import buildcraft.silicon.network.PacketHandlerSilicon;
import buildcraft.silicon.recipes.AdvancedFacadeRecipe;
import buildcraft.silicon.recipes.GateExpansionRecipe;
@ -33,13 +49,6 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
public class BuildCraftSilicon extends BuildCraftMod {
@ -52,6 +61,8 @@ public class BuildCraftSilicon extends BuildCraftMod {
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Silicon");
BuildCraftCore.mainConfiguration.save();
laserBlock = new BlockLaser();

View file

@ -238,6 +238,8 @@ public class BuildCraftTransport extends BuildCraftMod {
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Transport");
try {
Property durability = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.durability", DefaultProps.PIPES_DURABILITY);
durability.comment = "How long a pipe will take to break";

View file

@ -36,6 +36,7 @@ public class GuiArchitect extends GuiBuildCraft {
private GuiButton optionReadMods;
private GuiButton optionReadBlocks;
private GuiButton optionExcavate;
private GuiButton optionExplicit;
public GuiArchitect(IInventory playerInventory, TileArchitect architect) {
super(new ContainerArchitect(playerInventory, architect), architect, TEXTURE);
@ -61,6 +62,9 @@ public class GuiArchitect extends GuiBuildCraft {
optionExcavate = new GuiButton(2, x + 5, y + 80, 77, 20, "");
buttonList.add(optionExcavate);
optionExplicit = new GuiButton(3, x + 5, y + 105, 77, 20, "");
buttonList.add(optionExplicit);
updateButtons();
}
@ -74,6 +78,8 @@ public class GuiArchitect extends GuiBuildCraft {
conf.readTiles = !conf.readTiles;
} else if (button == optionExcavate) {
conf.excavate = !conf.excavate;
} else if (button == optionExplicit) {
conf.explicitOnly = !conf.explicitOnly;
}
architect.rpcSetConfiguration(conf);
@ -101,6 +107,12 @@ public class GuiArchitect extends GuiBuildCraft {
} else {
optionExcavate.displayString = "Excavate: Off";
}
if (conf.explicitOnly) {
optionExplicit.displayString = "Mods: Support";
} else {
optionExplicit.displayString = "Mods: All";
}
}
@Override

View file

@ -88,6 +88,10 @@ public class Blueprint extends BlueprintBase {
slot.block = block;
slot.meta = anchorTile.getWorldObj().getBlockMetadata(x, y, z);
if (bptContext.readConfiguration.explicitOnly && !SchematicRegistry.isExplicitlySupported(block)) {
return;
}
if (!bptContext.readConfiguration.readTiles && anchorTile.getWorldObj().getTileEntity(x, y, z) != null) {
return;
}

View file

@ -22,16 +22,21 @@ public class BlueprintReadConfiguration {
@NetworkData
public boolean excavate = true;
@NetworkData
public boolean explicitOnly = false;
public void writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setBoolean("rotate", rotate);
nbttagcompound.setBoolean("readAllBlocks", readTiles);
nbttagcompound.setBoolean("excavate", excavate);
nbttagcompound.setBoolean("explicitOnly", explicitOnly);
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
rotate = nbttagcompound.getBoolean("rotate");
readTiles = nbttagcompound.getBoolean("readAllBlocks");
excavate = nbttagcompound.getBoolean("excavate");
explicitOnly = nbttagcompound.getBoolean("explicitOnly");
}
}

View file

@ -27,6 +27,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IInvSlot;
@ -82,6 +83,10 @@ public class BptBuilderBlueprint extends BptBuilderBase {
slot.block = Blocks.air;
}
if (!SchematicRegistry.isAllowedForBuilding(slot.block)) {
continue;
}
BuildingSlotBlock b = new BuildingSlotBlock();
b.schematic = slot;
b.x = xCoord;
@ -114,6 +119,10 @@ public class BptBuilderBlueprint extends BptBuilderBase {
continue;
}
if (!SchematicRegistry.isAllowedForBuilding(slot.block)) {
continue;
}
BuildingSlotBlock b = new BuildingSlotBlock();
b.schematic = slot;
b.x = xCoord;