remove modsSupported, redundant Architect Table options, etc... strive for a proper builder supporting system
This commit is contained in:
parent
e68b197e7e
commit
95f13ba439
11 changed files with 11 additions and 85 deletions
|
@ -31,14 +31,11 @@ public final class SchematicRegistry {
|
|||
public static int BREAK_ENERGY = 100;
|
||||
public static final int BUILD_ENERGY = 200;
|
||||
|
||||
private static final HashSet<Block> explicitSchematicBlocks = new HashSet<Block>();
|
||||
|
||||
private static final HashMap<Block, SchematicConstructor> schematicBlocks =
|
||||
new HashMap<Block, SchematicConstructor>();
|
||||
|
||||
private static final HashMap<Class<? extends Entity>, SchematicConstructor> schematicEntities = new HashMap<Class<? extends Entity>, SchematicConstructor>();
|
||||
|
||||
private static final HashSet<String> modsSupporting = new HashSet<String>();
|
||||
private static final HashSet<String> modsForbidden = new HashSet<String>();
|
||||
private static final HashSet<String> blocksForbidden = new HashSet<String>();
|
||||
|
||||
|
@ -97,11 +94,6 @@ public final class SchematicRegistry {
|
|||
}
|
||||
|
||||
public static void registerSchematicBlock(Block block, Class<? extends Schematic> clazz, Object... params) {
|
||||
explicitSchematicBlocks.add(block);
|
||||
internalRegisterSchematicBlock(block, clazz, params);
|
||||
}
|
||||
|
||||
private static void internalRegisterSchematicBlock(Block block, Class<? extends Schematic> clazz, Object... params) {
|
||||
if (schematicBlocks.containsKey(block)) {
|
||||
throw new RuntimeException("Block " + Block.blockRegistry.getNameForObject(block) + " is already associated with a schematic.");
|
||||
}
|
||||
|
@ -123,16 +115,7 @@ public final class SchematicRegistry {
|
|||
}
|
||||
|
||||
if (!schematicBlocks.containsKey(block)) {
|
||||
if (block instanceof ITileEntityProvider) {
|
||||
internalRegisterSchematicBlock(block, SchematicTile.class);
|
||||
} else {
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
if (fluid != null) {
|
||||
internalRegisterSchematicBlock(block, SchematicFluid.class, new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME));
|
||||
} else {
|
||||
internalRegisterSchematicBlock(block, SchematicBlock.class);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -176,17 +159,13 @@ public final class SchematicRegistry {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void declareBlueprintSupport(String modid) {
|
||||
modsSupporting.add(modid);
|
||||
}
|
||||
|
||||
public static boolean isExplicitlySupported(Block block) {
|
||||
return explicitSchematicBlocks.contains(block) || modsSupporting.contains(Block.blockRegistry.getNameForObject(block).split(":", 2)[0]);
|
||||
public static boolean isSupported(Block block) {
|
||||
return schematicBlocks.containsKey(block);
|
||||
}
|
||||
|
||||
public static boolean isAllowedForBuilding(Block block) {
|
||||
String name = Block.blockRegistry.getNameForObject(block);
|
||||
return !blocksForbidden.contains(name) && !modsForbidden.contains(name.split(":", 2)[0]);
|
||||
return isSupported(block) && !blocksForbidden.contains(name) && !modsForbidden.contains(name.split(":", 2)[0]);
|
||||
}
|
||||
|
||||
public static void readConfiguration(Configuration conf) {
|
||||
|
@ -211,8 +190,4 @@ public final class SchematicRegistry {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
modsSupporting.add("minecraft");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,8 +236,6 @@ 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());
|
||||
|
||||
|
|
|
@ -241,8 +241,6 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
|
||||
@Mod.EventHandler
|
||||
public void loadConfiguration(FMLPreInitializationEvent evt) {
|
||||
SchematicRegistry.declareBlueprintSupport("BuildCraft|Core");
|
||||
|
||||
BCLog.initLog();
|
||||
|
||||
BuildcraftRecipeRegistry.assemblyTable = AssemblyRecipeManager.INSTANCE;
|
||||
|
|
|
@ -122,8 +122,6 @@ 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);
|
||||
|
|
|
@ -134,8 +134,6 @@ 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);
|
||||
|
|
|
@ -124,8 +124,6 @@ public class BuildCraftSilicon extends BuildCraftMod {
|
|||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
SchematicRegistry.declareBlueprintSupport("BuildCraft|Silicon");
|
||||
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
|
||||
laserBlock = new BlockLaser();
|
||||
|
|
|
@ -272,8 +272,6 @@ 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";
|
||||
|
|
|
@ -37,10 +37,7 @@ public class GuiArchitect extends GuiBuildCraft {
|
|||
private TileArchitect architect;
|
||||
|
||||
private GuiButton optionRotate;
|
||||
private GuiButton optionReadMods;
|
||||
private GuiButton optionReadBlocks;
|
||||
private GuiButton optionExcavate;
|
||||
private GuiButton optionExplicit;
|
||||
|
||||
private GuiTextField textField;
|
||||
|
||||
|
@ -61,15 +58,9 @@ public class GuiArchitect extends GuiBuildCraft {
|
|||
optionRotate = new GuiButton(0, guiLeft + 5, guiTop + 30, 77, 20, "");
|
||||
buttonList.add(optionRotate);
|
||||
|
||||
optionReadBlocks = new GuiButton(1, guiLeft + 5, guiTop + 55, 77, 20, "");
|
||||
buttonList.add(optionReadBlocks);
|
||||
|
||||
optionExcavate = new GuiButton(2, guiLeft + 5, guiTop + 80, 77, 20, "");
|
||||
optionExcavate = new GuiButton(1, guiLeft + 5, guiTop + 55, 77, 20, "");
|
||||
buttonList.add(optionExcavate);
|
||||
|
||||
optionExplicit = new GuiButton(3, guiLeft + 5, guiTop + 105, 77, 20, "");
|
||||
buttonList.add(optionExplicit);
|
||||
|
||||
textField = new GuiTextField(this.fontRendererObj, TEXT_X, TEXT_Y, TEXT_WIDTH, TEXT_HEIGHT);
|
||||
textField.setMaxStringLength(BuildCraftBuilders.MAX_BLUEPRINTS_NAME_SIZE);
|
||||
textField.setText(architect.name);
|
||||
|
@ -89,12 +80,8 @@ public class GuiArchitect extends GuiBuildCraft {
|
|||
|
||||
if (button == optionRotate) {
|
||||
conf.rotate = !conf.rotate;
|
||||
} else if (button == optionReadBlocks) {
|
||||
conf.readTiles = !conf.readTiles;
|
||||
} else if (button == optionExcavate) {
|
||||
conf.excavate = !conf.excavate;
|
||||
} else if (button == optionExplicit) {
|
||||
conf.explicitOnly = !conf.explicitOnly;
|
||||
}
|
||||
|
||||
architect.rpcSetConfiguration(conf);
|
||||
|
@ -111,23 +98,11 @@ public class GuiArchitect extends GuiBuildCraft {
|
|||
optionRotate.displayString = StringUtils.localize("tile.architect.norotate");
|
||||
}
|
||||
|
||||
if (conf.readTiles) {
|
||||
optionReadBlocks.displayString = StringUtils.localize("tile.architect.allblocks");
|
||||
} else {
|
||||
optionReadBlocks.displayString = StringUtils.localize("tile.architect.simpleblocks");
|
||||
}
|
||||
|
||||
if (conf.excavate) {
|
||||
optionExcavate.displayString = StringUtils.localize("tile.architect.excavate");
|
||||
} else {
|
||||
optionExcavate.displayString = StringUtils.localize("tile.architect.noexcavate");
|
||||
}
|
||||
|
||||
if (conf.explicitOnly) {
|
||||
optionExplicit.displayString = StringUtils.localize("tile.architect.supportmods");
|
||||
} else {
|
||||
optionExplicit.displayString = StringUtils.localize("tile.architect.allmods");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -98,11 +98,7 @@ 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) {
|
||||
if (!SchematicRegistry.isSupported(block)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,27 +16,17 @@ public class BlueprintReadConfiguration {
|
|||
@NetworkData
|
||||
public boolean rotate = true;
|
||||
|
||||
@NetworkData
|
||||
public boolean readTiles = true;
|
||||
|
||||
@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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -131,10 +131,12 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnerg
|
|||
stack.stackSize++;
|
||||
getWorld().setBlockToAir((int) p.x, (int) p.y, (int) p.z);
|
||||
}
|
||||
|
||||
BuildCraftTransport.pipeItemsStripes.onItemUse(new ItemStack(
|
||||
BuildCraftTransport.pipeItemsStripes), player, getWorld(), (int) p.x,
|
||||
BuildCraftTransport.pipeItemsStripes, 1, this.container.glassColor), player, getWorld(), (int) p.x,
|
||||
(int) p.y, (int) p.z, 1, 0, 0, 0
|
||||
);
|
||||
this.container.glassColor = stack.getItemDamage() - 1;
|
||||
|
||||
if (stack.stackSize > 0) {
|
||||
TileEntity targetTile = getWorld().getTileEntity((int) p.x, (int) p.y, (int) p.z);
|
||||
|
|
Loading…
Reference in a new issue