Moved vanilla schematics in a non-API class
(this will allows fixes on minor versions). Implemented portal support, for #1508.
This commit is contained in:
parent
a1a114feb0
commit
3aeb961a31
26 changed files with 83 additions and 62 deletions
|
@ -21,23 +21,6 @@ import buildcraft.api.blueprints.SchematicRegistry;
|
|||
import buildcraft.api.filler.FillerManager;
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
import buildcraft.api.gates.ActionManager;
|
||||
import buildcraft.api.schematics.SchematicBed;
|
||||
import buildcraft.api.schematics.SchematicCustomStack;
|
||||
import buildcraft.api.schematics.SchematicDirt;
|
||||
import buildcraft.api.schematics.SchematicDoor;
|
||||
import buildcraft.api.schematics.SchematicFluid;
|
||||
import buildcraft.api.schematics.SchematicIgnore;
|
||||
import buildcraft.api.schematics.SchematicIgnoreMeta;
|
||||
import buildcraft.api.schematics.SchematicInventory;
|
||||
import buildcraft.api.schematics.SchematicLever;
|
||||
import buildcraft.api.schematics.SchematicPiston;
|
||||
import buildcraft.api.schematics.SchematicPumpkin;
|
||||
import buildcraft.api.schematics.SchematicRedstoneRepeater;
|
||||
import buildcraft.api.schematics.SchematicRotateInventory;
|
||||
import buildcraft.api.schematics.SchematicRotateMeta;
|
||||
import buildcraft.api.schematics.SchematicSign;
|
||||
import buildcraft.api.schematics.SchematicStairs;
|
||||
import buildcraft.api.schematics.SchematicWallSide;
|
||||
import buildcraft.builders.BlockArchitect;
|
||||
import buildcraft.builders.BlockBlueprintLibrary;
|
||||
import buildcraft.builders.BlockBuilder;
|
||||
|
@ -66,6 +49,24 @@ import buildcraft.builders.filler.pattern.PatternFlatten;
|
|||
import buildcraft.builders.filler.pattern.PatternHorizon;
|
||||
import buildcraft.builders.filler.pattern.PatternPyramid;
|
||||
import buildcraft.builders.filler.pattern.PatternStairs;
|
||||
import buildcraft.builders.schematics.SchematicBed;
|
||||
import buildcraft.builders.schematics.SchematicCustomStack;
|
||||
import buildcraft.builders.schematics.SchematicDirt;
|
||||
import buildcraft.builders.schematics.SchematicDoor;
|
||||
import buildcraft.builders.schematics.SchematicFluid;
|
||||
import buildcraft.builders.schematics.SchematicIgnore;
|
||||
import buildcraft.builders.schematics.SchematicIgnoreMeta;
|
||||
import buildcraft.builders.schematics.SchematicInventory;
|
||||
import buildcraft.builders.schematics.SchematicLever;
|
||||
import buildcraft.builders.schematics.SchematicPiston;
|
||||
import buildcraft.builders.schematics.SchematicPortal;
|
||||
import buildcraft.builders.schematics.SchematicPumpkin;
|
||||
import buildcraft.builders.schematics.SchematicRedstoneRepeater;
|
||||
import buildcraft.builders.schematics.SchematicRotateInventory;
|
||||
import buildcraft.builders.schematics.SchematicRotateMeta;
|
||||
import buildcraft.builders.schematics.SchematicSign;
|
||||
import buildcraft.builders.schematics.SchematicStairs;
|
||||
import buildcraft.builders.schematics.SchematicWallSide;
|
||||
import buildcraft.builders.triggers.ActionFiller;
|
||||
import buildcraft.builders.triggers.BuildersActionProvider;
|
||||
import buildcraft.builders.urbanism.BlockUrbanist;
|
||||
|
@ -197,7 +198,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
|
||||
SchematicRegistry.registerSchematicClass(Blocks.lit_pumpkin, SchematicPumpkin.class);
|
||||
|
||||
|
||||
SchematicRegistry.registerSchematicClass(Blocks.oak_stairs, SchematicStairs.class);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.stone_stairs, SchematicStairs.class);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.brick_stairs, SchematicStairs.class);
|
||||
|
@ -219,6 +219,8 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
SchematicRegistry.registerSchematicClass(Blocks.wall_sign, SchematicSign.class, true);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.standing_sign, SchematicSign.class, false);
|
||||
|
||||
SchematicRegistry.registerSchematicClass(Blocks.portal, SchematicPortal.class);
|
||||
|
||||
// BUILDCRAFT BLOCKS
|
||||
|
||||
SchematicRegistry.registerSchematicClass(architectBlock, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
|
||||
|
|
|
@ -17,9 +17,9 @@ import net.minecraft.init.Items;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.SchematicRegistry;
|
||||
import buildcraft.api.recipes.BuildcraftRecipes;
|
||||
import buildcraft.api.schematics.SchematicInventory;
|
||||
import buildcraft.api.schematics.SchematicRotateMeta;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.builders.schematics.SchematicInventory;
|
||||
import buildcraft.builders.schematics.SchematicRotateMeta;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.Version;
|
||||
|
|
|
@ -170,7 +170,7 @@ public class Schematic {
|
|||
* blocks. This may be useful to adjust variable depending on surrounding
|
||||
* blocks that may not be there already at initial building.
|
||||
*/
|
||||
public void postProcessing(IBuilderContext context) {
|
||||
public void postProcessing(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -181,5 +181,4 @@ public class Schematic {
|
|||
public void readFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -172,16 +172,6 @@ public class SchematicBlock extends Schematic {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on a block when the blueprint has finished to place all the
|
||||
* blocks. This may be useful to adjust variable depending on surrounding
|
||||
* blocks that may not be there already at initial building.
|
||||
*/
|
||||
@Override
|
||||
public void postProcessing(IBuilderContext context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
nbt.setInteger("blockId", registry.getIdForBlock(block));
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
@API(apiVersion="1.0",owner="BuildCraftAPI|blueprints",provides="BuildCraftAPI|bptblocks")
|
||||
package buildcraft.api.schematics;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -679,6 +679,9 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IM
|
|||
slot.schematic.writeToWorld(bluePrintBuilder.context, slot.x,
|
||||
slot.y, slot.z);
|
||||
}
|
||||
} else {
|
||||
bluePrintBuilder.postProcessing(worldObj);
|
||||
bluePrintBuilder = null;
|
||||
}
|
||||
|
||||
if (bluePrintBuilder instanceof BptBuilderBlueprint) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
|
33
common/buildcraft/builders/schematics/SchematicPortal.java
Executable file
33
common/buildcraft/builders/schematics/SchematicPortal.java
Executable file
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
|
||||
public class SchematicPortal extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToWorld(IBuilderContext context, int x, int y, int z) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessing(IBuilderContext context, int x, int y, int z) {
|
||||
context.world().setBlock(x, y, z, Blocks.portal);
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.schematics;
|
||||
package buildcraft.builders.schematics;
|
||||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
|
@ -33,8 +33,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
LinkedList<SchematicToBuild> clearList = new LinkedList<SchematicToBuild>();
|
||||
LinkedList<SchematicToBuild> primaryList = new LinkedList<SchematicToBuild>();
|
||||
LinkedList<SchematicToBuild> secondaryList = new LinkedList<SchematicToBuild>();
|
||||
|
||||
LinkedList<SchematicToBuild> postProcessingList = new LinkedList<SchematicToBuild>();
|
||||
LinkedList<SchematicToBuild> postProcessing = new LinkedList<SchematicToBuild>();
|
||||
|
||||
public LinkedList <ItemStack> neededItems = new LinkedList <ItemStack> ();
|
||||
|
||||
|
@ -96,10 +95,6 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
} else {
|
||||
secondaryList.add(b);
|
||||
}
|
||||
|
||||
if (slot.block != null) {
|
||||
postProcessingList.add(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +128,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
checkDone();
|
||||
|
||||
if (slot != null) {
|
||||
postProcessing.add(slot);
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
@ -142,6 +138,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
checkDone();
|
||||
|
||||
if (slot != null) {
|
||||
postProcessing.add(slot);
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +148,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
return null;
|
||||
}
|
||||
|
||||
public SchematicToBuild internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<SchematicToBuild> list) {
|
||||
private SchematicToBuild internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<SchematicToBuild> list) {
|
||||
LinkedList<SchematicToBuild> failSlots = new LinkedList<SchematicToBuild>();
|
||||
|
||||
SchematicToBuild result = null;
|
||||
|
@ -442,9 +439,9 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
|
||||
@Override
|
||||
public void postProcessing(World world) {
|
||||
for (SchematicToBuild s : postProcessingList) {
|
||||
for (SchematicToBuild s : postProcessing) {
|
||||
try {
|
||||
s.schematic.postProcessing(context);
|
||||
s.schematic.postProcessing(context, s.x, s.y, s.z);
|
||||
} catch (Throwable t) {
|
||||
// Defensive code against errors in implementers
|
||||
t.printStackTrace();
|
||||
|
|
|
@ -85,7 +85,7 @@ public class SchematicPipe extends SchematicTile {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void postProcessing(IBuilderContext context) {
|
||||
public void postProcessing(IBuilderContext context, int x, int y, int z) {
|
||||
Item pipeItem = context.getMappingRegistry().getItemForId(cpt.getInteger("pipeId"));
|
||||
|
||||
if (BptPipeExtension.contains(pipeItem)) {
|
||||
|
|
Loading…
Reference in a new issue