Last changes to the Builder API, renaming to enfore consistency and
improve maintainability. Close #1785
This commit is contained in:
parent
030c8aa93d
commit
34e0bf9637
39 changed files with 335 additions and 309 deletions
|
@ -17,27 +17,21 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import buildcraft.api.core.IInvSlot;
|
||||
|
||||
/**
|
||||
* This class allow to specify specific behavior for blocks stored in
|
||||
* blueprints:
|
||||
* A schematic is a piece of a blueprint. It allows to stock blocks or entities
|
||||
* to blueprints, and can have a state that moves from a blueprint referential
|
||||
* to a world referential. Although default schematic behavior will be OK for a
|
||||
* lot of objects, specific blocks and entities may be associated with a
|
||||
* dedicated schematic class, which will be instantiated automatically.
|
||||
*
|
||||
* - what items needs to be used to create that block - how the block has to be
|
||||
* built on the world - how to rotate the block - what extra data to store /
|
||||
* load in the blueprint
|
||||
* Schematic perform "id translation" in case the block ids between a blueprint
|
||||
* and the world installation are different. Mapping is done through the builder
|
||||
* context.
|
||||
*
|
||||
* Default implementations of this can be seen in the package
|
||||
* buildcraft.api.schematics. The class SchematicUtils provide some additional
|
||||
* utilities.
|
||||
* Detailed documentation on the schematic behavior can be found on
|
||||
* http://www.mod-buildcraft.com/wiki/doku.php?id=builder_support
|
||||
*
|
||||
* Blueprints perform "id translation" in case the block ids between a blueprint
|
||||
* and the world installation are different. Mapping is done through the
|
||||
* builder context.
|
||||
*
|
||||
* At blueprint load time, BuildCraft will check that each block id of the
|
||||
* blueprint corresponds to the block id in the installation. If not, it will
|
||||
* perform a search through the block list, and upon matching signature, it will
|
||||
* translate all blocks ids of the blueprint to the installation ones. If no
|
||||
* such block id is found, BuildCraft will assume that the block is not
|
||||
* installed and will not load the blueprint.
|
||||
* Example of schematics for minecraft blocks are available in the package
|
||||
* buildcraft.core.schematics.
|
||||
*/
|
||||
public abstract class Schematic {
|
||||
|
||||
|
@ -66,39 +60,19 @@ public abstract class Schematic {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if the block on the world correspond to the block stored in
|
||||
* the blueprint at the location given by the slot. By default, this
|
||||
* subprogram is permissive and doesn't take into account metadata.
|
||||
*/
|
||||
public boolean isAlreadyBuilt(IBuilderContext context, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the block should not be placed to the world. Requirements
|
||||
* will not be asked on such a block, and building will not be called. Post
|
||||
* processing will still be called on these blocks though.
|
||||
*/
|
||||
public boolean doNotBuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called each time an item matches a reqquirement, that is: (req id
|
||||
* == stack id) for damageable items (req id == stack id && req dmg == stack
|
||||
* dmg) for other items by default, it will increase damage of damageable
|
||||
* items by the amount of damage of the requirement, and remove the intended
|
||||
* amount of non damageable item.
|
||||
* This is called each time an item matches a requirement. By default, it
|
||||
* will increase damage of items that can be damaged by the amount of the
|
||||
* requirement, and remove the intended amount of items that can't be
|
||||
* damaged.
|
||||
*
|
||||
* Client may override this behavior for default items. Note that this
|
||||
* subprogram may be called twice with the same parameters, once with a copy
|
||||
* of requirements and stack to check if the entire requirements can be
|
||||
* fullfilled, and once with the real inventory. Implementer is responsible
|
||||
* for updating req (with the remaining requirements if any) and stack
|
||||
* (after usage)
|
||||
* Client may override this behavior. Note that this subprogram may be
|
||||
* called twice with the same parameters, once with a copy of requirements
|
||||
* and stack to check if the entire requirements can be fulfilled, and once
|
||||
* with the real inventory. Implementer is responsible for updating req
|
||||
* (with the remaining requirements if any) and slot (after usage).
|
||||
*
|
||||
* returns: what was used (similer to req, but created from stack, so that
|
||||
* any NBT based differences are drawn from the correct source)
|
||||
* returns what was used (similar to req, but created from slot, so that any
|
||||
* NBT based differences are drawn from the correct source)
|
||||
*/
|
||||
public ItemStack useItem(IBuilderContext context, ItemStack req, IInvSlot slot) {
|
||||
ItemStack stack = slot.getStackInSlot();
|
||||
|
@ -145,28 +119,43 @@ public abstract class Schematic {
|
|||
|
||||
/**
|
||||
* Applies translations to all positions in the schematic to center in the
|
||||
* blueprint referencial
|
||||
* blueprint referential
|
||||
*/
|
||||
public void translateToSchematic(Translation transform) {
|
||||
public void translateToBlueprint(Translation transform) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply translations to all positions in the schematic to center in the
|
||||
* builder referencial
|
||||
* builder referential
|
||||
*/
|
||||
public void translateToWorld(Translation transform) {
|
||||
|
||||
}
|
||||
|
||||
public void idsToSchematic(MappingRegistry registry) {
|
||||
/**
|
||||
* Translates blocks and item ids to the blueprint referential
|
||||
*/
|
||||
public void idsToBlueprint(MappingRegistry registry) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates blocks and item ids to the world referential
|
||||
*/
|
||||
public void idsToWorld(MappingRegistry registry) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a schematic for blueprint according to an objet placed on {x,
|
||||
* y, z} on the world. For blocks, block and meta fields will be initialized
|
||||
* automatically.
|
||||
*/
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Places the block in the world, at the location specified in the slot,
|
||||
* using the stack in parameters
|
||||
|
@ -176,68 +165,21 @@ public abstract class Schematic {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes a slot from the blueprint according to an objet placed on {x,
|
||||
* y, z} on the world. This typically means adding entries in slot.cpt. Note
|
||||
* that "id" and "meta" will be set automatically, corresponding to the
|
||||
* block id and meta.
|
||||
*
|
||||
* By default, if the block is a BlockContainer, tile information will be to
|
||||
* save / load the block.
|
||||
* Write specific requirements coming from the world to the blueprint.
|
||||
*/
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public void postProcessing(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requirements needed to build this block. When the
|
||||
* requirements are met, they will be removed all at once from the builder,
|
||||
* before calling buildBlock.
|
||||
* before calling writeToWorld.
|
||||
*/
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
|
||||
}
|
||||
|
||||
public LinkedList<ItemStack> getStacksToDisplay(
|
||||
LinkedList<ItemStack> stackConsumed) {
|
||||
|
||||
return stackConsumed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the stage where this schematic has to be built.
|
||||
*/
|
||||
public BuildingStage getBuildStage () {
|
||||
return BuildingStage.STANDALONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the building permission for blueprint containing this schematic.
|
||||
*/
|
||||
public BuildingPermission getBuildingPermission () {
|
||||
return BuildingPermission.ALL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of energy required to build this slot, depends on the
|
||||
* stacks selected for the build.
|
||||
|
@ -251,4 +193,84 @@ public abstract class Schematic {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the flying stacks to display in the builder animation.
|
||||
*/
|
||||
public LinkedList<ItemStack> getStacksToDisplay(
|
||||
LinkedList<ItemStack> stackConsumed) {
|
||||
|
||||
return stackConsumed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the stage where this schematic has to be built.
|
||||
*/
|
||||
public BuildingStage getBuildStage () {
|
||||
return BuildingStage.STANDALONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the block on the world correspond to the block stored in
|
||||
* the blueprint at the location given by the slot. By default, this
|
||||
* subprogram is permissive and doesn't take into account metadata.
|
||||
*
|
||||
* Post processing will be called on these blocks.
|
||||
*/
|
||||
public boolean isAlreadyBuilt(IBuilderContext context, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the block should not be placed to the world. Requirements
|
||||
* will not be asked on such a block, and building will not be called.
|
||||
*
|
||||
* Post processing will be called on these blocks.
|
||||
*/
|
||||
public boolean doNotBuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the schematic should not be used at all. This is computed
|
||||
* straight after readFromNBT can be used to deactivate schematics in which
|
||||
* an inconsistency is detected. It will be considered as a block of air
|
||||
* instead.
|
||||
*
|
||||
* Post processing will *not* be called on these blocks.
|
||||
*/
|
||||
public boolean doNotUse() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the maximium building permission for blueprint containing this
|
||||
* schematic.
|
||||
*/
|
||||
public BuildingPermission getBuildingPermission () {
|
||||
return BuildingPermission.ALL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public void postProcessing(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves this schematic to the blueprint NBT.
|
||||
*/
|
||||
public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads this schematic from the blueprint NBT.
|
||||
*/
|
||||
public void readFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class SchematicBlock extends SchematicBlockBase {
|
|||
public ItemStack [] storedRequirements = new ItemStack [0];
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
if (block != null) {
|
||||
if (storedRequirements.length != 0) {
|
||||
for (ItemStack s : storedRequirements) {
|
||||
|
@ -54,24 +54,16 @@ public class SchematicBlock extends SchematicBlockBase {
|
|||
|
||||
@Override
|
||||
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
|
||||
super.writeToWorld(context, x, y, z, stacks);
|
||||
|
||||
// Meta needs to be specified twice, depending on the block behavior
|
||||
context.world().setBlock(x, y, z, block, meta, 3);
|
||||
context.world().setBlockMetadataWithNotify(x, y, z, meta, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doNotBuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeRequirementsToSchematic(context, x, y, z);
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeRequirementsToBlueprint(context, x, y, z);
|
||||
|
||||
if (block != null) {
|
||||
ArrayList<ItemStack> req = block.getDrops(context.world(), x,
|
||||
|
|
|
@ -28,7 +28,13 @@ public class SchematicEntity extends Schematic {
|
|||
|
||||
public Class<? extends Entity> entity;
|
||||
|
||||
public NBTTagCompound cpt = new NBTTagCompound();
|
||||
/**
|
||||
* This tree contains additional data to be stored in the blueprint. By
|
||||
* default, it will be initialized from Schematic.readFromWord with the
|
||||
* standard readNBT function of the corresponding tile (if any) and will be
|
||||
* loaded from BptBlock.writeToWorld using the standard writeNBT function.
|
||||
*/
|
||||
public NBTTagCompound entityNBT = new NBTTagCompound();
|
||||
|
||||
/**
|
||||
* This field contains requirements for a given block when stored in the
|
||||
|
@ -38,70 +44,70 @@ public class SchematicEntity extends Schematic {
|
|||
public ItemStack[] storedRequirements = new ItemStack[0];
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
for (ItemStack s : storedRequirements) {
|
||||
requirements.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToWorld(IBuilderContext context) {
|
||||
Entity e = EntityList.createEntityFromNBT(cpt, context.world());
|
||||
Entity e = EntityList.createEntityFromNBT(entityNBT, context.world());
|
||||
context.world().spawnEntityInWorld(e);
|
||||
}
|
||||
|
||||
public void readFromWorld(IBuilderContext context, Entity entity) {
|
||||
entity.writeToNBTOptional(cpt);
|
||||
entity.writeToNBTOptional(entityNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateToSchematic(Translation transform) {
|
||||
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
|
||||
public void translateToBlueprint(Translation transform) {
|
||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
||||
Position pos = new Position(nbttaglist.func_150309_d(0),
|
||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||
pos = transform.translate(pos);
|
||||
|
||||
cpt.setTag("Pos",
|
||||
entityNBT.setTag("Pos",
|
||||
this.newDoubleNBTList(pos.x, pos.y, pos.z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateToWorld(Translation transform) {
|
||||
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
|
||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
||||
Position pos = new Position(nbttaglist.func_150309_d(0),
|
||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||
pos = transform.translate(pos);
|
||||
|
||||
cpt.setTag("Pos",
|
||||
entityNBT.setTag("Pos",
|
||||
this.newDoubleNBTList(pos.x, pos.y, pos.z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void idsToSchematic(MappingRegistry registry) {
|
||||
registry.scanAndTranslateStacksToRegistry(cpt);
|
||||
public void idsToBlueprint(MappingRegistry registry) {
|
||||
registry.scanAndTranslateStacksToRegistry(entityNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void idsToWorld(MappingRegistry registry) {
|
||||
try {
|
||||
registry.scanAndTranslateStacksToWorld(cpt);
|
||||
registry.scanAndTranslateStacksToWorld(entityNBT);
|
||||
} catch (MappingNotFoundException e) {
|
||||
cpt = new NBTTagCompound();
|
||||
entityNBT = new NBTTagCompound();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context) {
|
||||
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
|
||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
||||
Position pos = new Position(nbttaglist.func_150309_d(0),
|
||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||
pos = context.rotatePositionLeft(pos);
|
||||
cpt.setTag("Pos",
|
||||
entityNBT.setTag("Pos",
|
||||
this.newDoubleNBTList(pos.x, pos.y, pos.z));
|
||||
|
||||
nbttaglist = cpt.getTagList("Rotation", 5);
|
||||
nbttaglist = entityNBT.getTagList("Rotation", 5);
|
||||
float yaw = nbttaglist.func_150308_e(0);
|
||||
yaw += 90;
|
||||
cpt.setTag(
|
||||
entityNBT.setTag(
|
||||
"Rotation",
|
||||
this.newFloatNBTList(yaw,
|
||||
nbttaglist.func_150308_e(1)));
|
||||
|
@ -111,10 +117,10 @@ public class SchematicEntity extends Schematic {
|
|||
public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
super.writeToNBT(nbt, registry);
|
||||
|
||||
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
|
||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
||||
|
||||
nbt.setInteger("entityId", registry.getIdForEntity(entity));
|
||||
nbt.setTag("entity", cpt);
|
||||
nbt.setTag("entity", entityNBT);
|
||||
|
||||
NBTTagList rq = new NBTTagList();
|
||||
|
||||
|
@ -132,7 +138,7 @@ public class SchematicEntity extends Schematic {
|
|||
public void readFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
super.readFromNBT(nbt, registry);
|
||||
|
||||
cpt = nbt.getCompoundTag("entity");
|
||||
entityNBT = nbt.getCompoundTag("entity");
|
||||
|
||||
NBTTagList rq = nbt.getTagList("rq",
|
||||
Constants.NBT.TAG_COMPOUND);
|
||||
|
@ -191,7 +197,7 @@ public class SchematicEntity extends Schematic {
|
|||
}
|
||||
|
||||
public boolean isAlreadyBuilt(IBuilderContext context) {
|
||||
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
|
||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
||||
Position newPosition = new Position(nbttaglist.func_150309_d(0),
|
||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||
|
||||
|
|
|
@ -22,23 +22,23 @@ public class SchematicTile extends SchematicBlock {
|
|||
|
||||
/**
|
||||
* This tree contains additional data to be stored in the blueprint. By
|
||||
* default, it will be initialized from Schematic.readFromWord with
|
||||
* the standard readNBT function of the corresponding tile (if any) and will
|
||||
* be loaded from BptBlock.buildBlock using the standard writeNBT function.
|
||||
* default, it will be initialized from Schematic.readFromWord with the
|
||||
* standard readNBT function of the corresponding tile (if any) and will be
|
||||
* loaded from BptBlock.writeToWorld using the standard writeNBT function.
|
||||
*/
|
||||
public NBTTagCompound cpt = new NBTTagCompound();
|
||||
public NBTTagCompound tileNBT = new NBTTagCompound();
|
||||
|
||||
@Override
|
||||
public void idsToSchematic(MappingRegistry registry) {
|
||||
registry.scanAndTranslateStacksToRegistry(cpt);
|
||||
public void idsToBlueprint(MappingRegistry registry) {
|
||||
registry.scanAndTranslateStacksToRegistry(tileNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void idsToWorld(MappingRegistry registry) {
|
||||
try {
|
||||
registry.scanAndTranslateStacksToWorld(cpt);
|
||||
registry.scanAndTranslateStacksToWorld(tileNBT);
|
||||
} catch (MappingNotFoundException e) {
|
||||
cpt = new NBTTagCompound();
|
||||
tileNBT = new NBTTagCompound();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,32 +52,32 @@ public class SchematicTile extends SchematicBlock {
|
|||
if (block.hasTileEntity(meta)) {
|
||||
TileEntity tile = context.world().getTileEntity(x, y, z);
|
||||
|
||||
cpt.setInteger("x", x);
|
||||
cpt.setInteger("y", y);
|
||||
cpt.setInteger("z", z);
|
||||
tileNBT.setInteger("x", x);
|
||||
tileNBT.setInteger("y", y);
|
||||
tileNBT.setInteger("z", z);
|
||||
|
||||
if (tile != null) {
|
||||
tile.readFromNBT(cpt);
|
||||
tile.readFromNBT(tileNBT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeToSchematic(context, x, y, z);
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeToBlueprint(context, x, y, z);
|
||||
|
||||
if (block.hasTileEntity(meta)) {
|
||||
TileEntity tile = context.world().getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null) {
|
||||
tile.writeToNBT(cpt);
|
||||
tile.writeToNBT(tileNBT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeRequirementsToSchematic(context, x, y, z);
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeRequirementsToBlueprint(context, x, y, z);
|
||||
|
||||
if (block.hasTileEntity(meta)) {
|
||||
TileEntity tile = context.world().getTileEntity(x, y, z);
|
||||
|
@ -103,13 +103,13 @@ public class SchematicTile extends SchematicBlock {
|
|||
public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
super.writeToNBT(nbt, registry);
|
||||
|
||||
nbt.setTag("blockCpt", cpt);
|
||||
nbt.setTag("blockCpt", tileNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||
super.readFromNBT(nbt, registry);
|
||||
|
||||
cpt = nbt.getCompoundTag("blockCpt");
|
||||
tileNBT = nbt.getCompoundTag("blockCpt");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,14 +19,14 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicBed extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
if ((meta & 8) == 0) {
|
||||
requirements.add(new ItemStack(Items.bed));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicCactus extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Blocks.cactus));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@ public class SchematicCustomStack extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(customStack.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicDirt extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Blocks.dirt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -28,14 +28,14 @@ public class SchematicDoor extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
if ((meta & 8) == 0) {
|
||||
requirements.add(stack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,8 @@ public class SchematicDoor extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeToSchematic(context, x, y, z);
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeToBlueprint(context, x, y, z);
|
||||
|
||||
if ((meta & 8) == 0) {
|
||||
upperMeta = context.world().getBlockMetadata(x, y + 1, z);
|
||||
|
|
|
@ -23,13 +23,13 @@ public class SchematicEnderChest extends SchematicRotateMeta {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Blocks.obsidian, 8));
|
||||
requirements.add(new ItemStack(Items.ender_eye, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicFarmland extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Blocks.dirt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicFire extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack (Items.flint_and_steel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,14 +26,14 @@ public class SchematicFluid extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
if (meta == 0) {
|
||||
requirements.add(bucketStack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicGravel extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Blocks.gravel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -29,40 +29,40 @@ public class SchematicHanging extends SchematicEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void translateToSchematic(Translation transform) {
|
||||
super.translateToSchematic(transform);
|
||||
public void translateToBlueprint(Translation transform) {
|
||||
super.translateToBlueprint(transform);
|
||||
|
||||
Position pos = new Position (cpt.getInteger("TileX"), cpt.getInteger("TileY"), cpt.getInteger("TileZ"));
|
||||
Position pos = new Position (entityNBT.getInteger("TileX"), entityNBT.getInteger("TileY"), entityNBT.getInteger("TileZ"));
|
||||
pos = transform.translate(pos);
|
||||
cpt.setInteger("TileX", (int) pos.x);
|
||||
cpt.setInteger("TileY", (int) pos.y);
|
||||
cpt.setInteger("TileZ", (int) pos.z);
|
||||
entityNBT.setInteger("TileX", (int) pos.x);
|
||||
entityNBT.setInteger("TileY", (int) pos.y);
|
||||
entityNBT.setInteger("TileZ", (int) pos.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateToWorld(Translation transform) {
|
||||
super.translateToWorld(transform);
|
||||
|
||||
Position pos = new Position (cpt.getInteger("TileX"), cpt.getInteger("TileY"), cpt.getInteger("TileZ"));
|
||||
Position pos = new Position (entityNBT.getInteger("TileX"), entityNBT.getInteger("TileY"), entityNBT.getInteger("TileZ"));
|
||||
pos = transform.translate(pos);
|
||||
cpt.setInteger("TileX", (int) pos.x);
|
||||
cpt.setInteger("TileY", (int) pos.y);
|
||||
cpt.setInteger("TileZ", (int) pos.z);
|
||||
entityNBT.setInteger("TileX", (int) pos.x);
|
||||
entityNBT.setInteger("TileY", (int) pos.y);
|
||||
entityNBT.setInteger("TileZ", (int) pos.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context) {
|
||||
super.rotateLeft(context);
|
||||
|
||||
Position pos = new Position (cpt.getInteger("TileX"), cpt.getInteger("TileY"), cpt.getInteger("TileZ"));
|
||||
Position pos = new Position (entityNBT.getInteger("TileX"), entityNBT.getInteger("TileY"), entityNBT.getInteger("TileZ"));
|
||||
pos = context.rotatePositionLeft(pos);
|
||||
cpt.setInteger("TileX", (int) pos.x);
|
||||
cpt.setInteger("TileY", (int) pos.y);
|
||||
cpt.setInteger("TileZ", (int) pos.z);
|
||||
entityNBT.setInteger("TileX", (int) pos.x);
|
||||
entityNBT.setInteger("TileY", (int) pos.y);
|
||||
entityNBT.setInteger("TileZ", (int) pos.z);
|
||||
|
||||
int direction = cpt.getByte("Direction");
|
||||
int direction = entityNBT.getByte("Direction");
|
||||
direction = direction < 3 ? direction + 1 : 0;
|
||||
cpt.setInteger("Direction", direction);
|
||||
entityNBT.setInteger("Direction", direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +70,7 @@ public class SchematicHanging extends SchematicEntity {
|
|||
super.readFromWorld(context, entity);
|
||||
|
||||
if (baseItem == Items.item_frame) {
|
||||
NBTTagCompound tag = cpt.getCompoundTag("Item");
|
||||
NBTTagCompound tag = entityNBT.getCompoundTag("Item");
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag);
|
||||
|
||||
if (stack != null) {
|
||||
|
@ -89,9 +89,9 @@ public class SchematicHanging extends SchematicEntity {
|
|||
|
||||
@Override
|
||||
public boolean isAlreadyBuilt(IBuilderContext context) {
|
||||
Position newPosition = new Position (cpt.getInteger("TileX"), cpt.getInteger("TileY"), cpt.getInteger("TileZ"));
|
||||
Position newPosition = new Position (entityNBT.getInteger("TileX"), entityNBT.getInteger("TileY"), entityNBT.getInteger("TileZ"));
|
||||
|
||||
int dir = cpt.getInteger("Direction");
|
||||
int dir = entityNBT.getInteger("Direction");
|
||||
|
||||
for (Object o : context.world().loadedEntityList) {
|
||||
Entity e = (Entity) o;
|
||||
|
|
|
@ -18,7 +18,7 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicIgnore extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class SchematicIgnore extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class SchematicIgnore extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicIgnoreMeta extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(block, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,15 +28,15 @@ public class SchematicMinecart extends SchematicEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void translateToSchematic(Translation transform) {
|
||||
super.translateToSchematic(transform);
|
||||
public void translateToBlueprint(Translation transform) {
|
||||
super.translateToBlueprint(transform);
|
||||
|
||||
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
|
||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
||||
Position pos = new Position(nbttaglist.func_150309_d(0),
|
||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||
pos.x -= 0.5;
|
||||
pos.z -= 0.5;
|
||||
cpt.setTag("Pos", this.newDoubleNBTList(new double[] {pos.x, pos.y, pos.z}));
|
||||
entityNBT.setTag("Pos", this.newDoubleNBTList(new double[] {pos.x, pos.y, pos.z}));
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,12 +44,12 @@ public class SchematicMinecart extends SchematicEntity {
|
|||
public void translateToWorld(Translation transform) {
|
||||
super.translateToWorld(transform);
|
||||
|
||||
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
|
||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
||||
Position pos = new Position(nbttaglist.func_150309_d(0),
|
||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||
pos.x += 0.5;
|
||||
pos.z += 0.5;
|
||||
cpt.setTag("Pos", this.newDoubleNBTList(new double[] {pos.x, pos.y, pos.z}));
|
||||
entityNBT.setTag("Pos", this.newDoubleNBTList(new double[] {pos.x, pos.y, pos.z}));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +62,7 @@ public class SchematicMinecart extends SchematicEntity {
|
|||
|
||||
@Override
|
||||
public boolean isAlreadyBuilt(IBuilderContext context) {
|
||||
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
|
||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
||||
Position newPosition = new Position(nbttaglist.func_150309_d(0),
|
||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicPortal extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicPumpkin extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(block, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@ public class SchematicRedstoneDiode extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(baseItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicRedstoneLamp extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Blocks.redstone_lamp, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@ public class SchematicRedstoneWire extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(customStack.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ public class SchematicSeeds extends SchematicBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(seeds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ public class SchematicSign extends SchematicTile {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Items.sign));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
// cancel requirements reading
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ public class SchematicSkull extends SchematicTile {
|
|||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context) {
|
||||
int rot = cpt.getByte("Rot");
|
||||
int rot = tileNBT.getByte("Rot");
|
||||
|
||||
rot = (rot + 4) % 16;
|
||||
|
||||
cpt.setByte("Rot", (byte) rot);
|
||||
tileNBT.setByte("Rot", (byte) rot);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicStairs extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(block, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
public class SchematicStone extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Blocks.stone));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class Blueprint extends BlueprintBase {
|
|||
super.translateToBlueprint(transform);
|
||||
|
||||
for (SchematicEntity e : entities) {
|
||||
e.translateToSchematic(transform);
|
||||
e.translateToBlueprint(transform);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,8 @@ public class Blueprint extends BlueprintBase {
|
|||
}
|
||||
|
||||
try {
|
||||
slot.writeToSchematic(context, x, y, z);
|
||||
slot.writeRequirementsToSchematic(context, x, y, z);
|
||||
slot.writeToBlueprint(context, x, y, z);
|
||||
slot.writeRequirementsToBlueprint(context, x, y, z);
|
||||
contents[posX][posY][posZ] = slot;
|
||||
} catch (Throwable t) {
|
||||
// Defensive code against errors in implementers
|
||||
|
@ -163,7 +163,7 @@ public class Blueprint extends BlueprintBase {
|
|||
NBTTagCompound cpt = new NBTTagCompound();
|
||||
|
||||
if (contents [x][y][z] != null) {
|
||||
contents[x][y][z].idsToSchematic(mapping);
|
||||
contents[x][y][z].idsToBlueprint(mapping);
|
||||
contents[x][y][z].writeToNBT(cpt, mapping);
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ public class Blueprint extends BlueprintBase {
|
|||
|
||||
for (SchematicEntity s : entities) {
|
||||
NBTTagCompound subNBT = new NBTTagCompound();
|
||||
s.idsToSchematic(mapping);
|
||||
s.idsToBlueprint(mapping);
|
||||
s.writeToNBT(subNBT, mapping);
|
||||
entitiesNBT.appendTag(subNBT);
|
||||
}
|
||||
|
@ -218,6 +218,8 @@ public class Blueprint extends BlueprintBase {
|
|||
if (block != null) {
|
||||
contents[x][y][z] = SchematicRegistry.newSchematicBlock(block);
|
||||
contents[x][y][z].readFromNBT(cpt, mapping);
|
||||
|
||||
if (!contents[x][y][z].doNotUse()) {
|
||||
contents[x][y][z].idsToWorld(mapping);
|
||||
|
||||
switch (contents[x][y][z].getBuildingPermission()) {
|
||||
|
@ -236,6 +238,10 @@ public class Blueprint extends BlueprintBase {
|
|||
contents[x][y][z] = null;
|
||||
isComplete = false;
|
||||
}
|
||||
} else {
|
||||
contents[x][y][z] = null;
|
||||
isComplete = false;
|
||||
}
|
||||
} else {
|
||||
contents[x][y][z] = null;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class BlueprintBase {
|
|||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
if (contents [x][y][z] != null) {
|
||||
contents[x][y][z].translateToSchematic(transform);
|
||||
contents[x][y][z].translateToBlueprint(transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
try {
|
||||
LinkedList<ItemStack> req = new LinkedList<ItemStack>();
|
||||
|
||||
slot.writeRequirementsToBuilder(context, req);
|
||||
slot.writeRequirementsToWorld(context, req);
|
||||
|
||||
for (ItemStack stk : req) {
|
||||
if (stk != null) {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class BuildingSlotBlock extends BuildingSlot {
|
|||
} else {
|
||||
LinkedList<ItemStack> req = new LinkedList<ItemStack>();
|
||||
|
||||
getSchematic().writeRequirementsToBuilder(context, req);
|
||||
getSchematic().writeRequirementsToWorld(context, req);
|
||||
|
||||
return req;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class BuildingSlotEntity extends BuildingSlot {
|
|||
|
||||
@Override
|
||||
public Position getDestination () {
|
||||
NBTTagList nbttaglist = schematic.cpt.getTagList("Pos", 6);
|
||||
NBTTagList nbttaglist = schematic.entityNBT.getTagList("Pos", 6);
|
||||
Position pos = new Position(nbttaglist.func_150309_d(0),
|
||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||
|
||||
|
|
|
@ -21,25 +21,25 @@ public class SchematicEngine extends SchematicTile {
|
|||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context) {
|
||||
int o = cpt.getInteger("orientation");
|
||||
int o = tileNBT.getInteger("orientation");
|
||||
|
||||
o = ForgeDirection.values()[o].getRotation(ForgeDirection.UP).ordinal();
|
||||
|
||||
cpt.setInteger("orientation", o);
|
||||
tileNBT.setInteger("orientation", o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeToSchematic(context, x, y, z);
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeToBlueprint(context, x, y, z);
|
||||
|
||||
TileEngine engine = (TileEngine) context.world().getTileEntity(x, y, z);
|
||||
|
||||
cpt.setInteger("orientation", engine.orientation.ordinal());
|
||||
cpt.removeTag("progress");
|
||||
cpt.removeTag("energy");
|
||||
cpt.removeTag("heat");
|
||||
cpt.removeTag("tankFuel");
|
||||
cpt.removeTag("tankCoolant");
|
||||
tileNBT.setInteger("orientation", engine.orientation.ordinal());
|
||||
tileNBT.removeTag("progress");
|
||||
tileNBT.removeTag("energy");
|
||||
tileNBT.removeTag("heat");
|
||||
tileNBT.removeTag("tankFuel");
|
||||
tileNBT.removeTag("tankCoolant");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,7 @@ public class SchematicEngine extends SchematicTile {
|
|||
|
||||
TileEngine engine = (TileEngine) context.world().getTileEntity(x, y, z);
|
||||
|
||||
engine.orientation = ForgeDirection.getOrientation(cpt.getInteger("orientation"));
|
||||
engine.orientation = ForgeDirection.getOrientation(tileNBT.getInteger("orientation"));
|
||||
engine.sendNetworkUpdate();
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class SchematicEngine extends SchematicTile {
|
|||
TileEngine engine = (TileEngine) context.world().getTileEntity(x, y, z);
|
||||
|
||||
if (engine != null) {
|
||||
engine.orientation = ForgeDirection.getOrientation(cpt.getInteger("orientation"));
|
||||
engine.orientation = ForgeDirection.getOrientation(tileNBT.getInteger("orientation"));
|
||||
engine.sendNetworkUpdate();
|
||||
context.world().markBlockForUpdate(x, y, z);
|
||||
context.world().notifyBlocksOfNeighborChange(x, y, z, block);
|
||||
|
|
|
@ -25,7 +25,7 @@ public class SchematicRefinery extends SchematicTile {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
TileRefinery refinery = (TileRefinery) context.world().getTileEntity(x, y, z);
|
||||
|
||||
// slot.cpt.setInteger("filter0", refinery.getFilter(0));
|
||||
|
@ -38,16 +38,16 @@ public class SchematicRefinery extends SchematicTile {
|
|||
|
||||
TileRefinery refinery = (TileRefinery) context.world().getTileEntity(x, y, z);
|
||||
|
||||
int filter0 = cpt.getInteger("filter0");
|
||||
int filter1 = cpt.getInteger("filter1");
|
||||
int filter0 = tileNBT.getInteger("filter0");
|
||||
int filter1 = tileNBT.getInteger("filter1");
|
||||
int filterMeta0 = 0;
|
||||
int filterMeta1 = 0;
|
||||
|
||||
if (cpt.hasKey("filterMeta0")) {
|
||||
filterMeta0 = cpt.getInteger("filterMeta0");
|
||||
if (tileNBT.hasKey("filterMeta0")) {
|
||||
filterMeta0 = tileNBT.getInteger("filterMeta0");
|
||||
}
|
||||
if (cpt.hasKey("filterMeta1")) {
|
||||
filterMeta1 = cpt.getInteger("filterMeta1");
|
||||
if (tileNBT.hasKey("filterMeta1")) {
|
||||
filterMeta1 = tileNBT.getInteger("filterMeta1");
|
||||
}
|
||||
|
||||
// refinery.setFilter(0, filter0, filterMeta0);
|
||||
|
|
|
@ -18,17 +18,17 @@ import buildcraft.api.blueprints.SchematicTile;
|
|||
public class SchematicTank extends SchematicTile {
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(block));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ import buildcraft.api.blueprints.SchematicTile;
|
|||
public class SchematicLaserTableBase extends SchematicTile {
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeToSchematic(context, x, y, z);
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
super.writeToBlueprint(context, x, y, z);
|
||||
|
||||
cpt.removeTag("energy");
|
||||
tileNBT.removeTag("energy");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BptItemPipeFilters extends BptPipeExtension {
|
|||
public void rotateLeft(SchematicTile slot, IBuilderContext context) {
|
||||
SimpleInventory inv = new SimpleInventory(54, "Filters", 1);
|
||||
SimpleInventory newInv = new SimpleInventory(54, "Filters", 1);
|
||||
inv.readFromNBT(slot.cpt);
|
||||
inv.readFromNBT(slot.tileNBT);
|
||||
|
||||
for (int dir = 0; dir <= 5; ++dir) {
|
||||
ForgeDirection r = ForgeDirection.values()[dir].getRotation(ForgeDirection.UP);
|
||||
|
@ -36,6 +36,6 @@ public class BptItemPipeFilters extends BptPipeExtension {
|
|||
}
|
||||
}
|
||||
|
||||
newInv.writeToNBT(slot.cpt);
|
||||
newInv.writeToNBT(slot.tileNBT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class SchematicPipe extends SchematicTile {
|
|||
Pipe pipe = BlockGenericPipe.getPipe(context.world(), x, y, z);
|
||||
|
||||
if (BlockGenericPipe.isValid(pipe)) {
|
||||
return pipe.item == Item.getItemById(cpt.getInteger("pipeId"));
|
||||
return pipe.item == Item.getItemById(tileNBT.getInteger("pipeId"));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -49,17 +49,17 @@ public class SchematicPipe extends SchematicTile {
|
|||
public void rotateLeft(IBuilderContext context) {
|
||||
SideProperties props = new SideProperties ();
|
||||
|
||||
props.readFromNBT(cpt);
|
||||
props.readFromNBT(tileNBT);
|
||||
props.rotateLeft();
|
||||
props.writeToNBT(cpt);
|
||||
props.writeToNBT(tileNBT);
|
||||
|
||||
Item pipeItem = Item.getItemById(cpt.getInteger("pipeId"));
|
||||
Item pipeItem = Item.getItemById(tileNBT.getInteger("pipeId"));
|
||||
|
||||
if (BptPipeExtension.contains(pipeItem)) {
|
||||
BptPipeExtension.get(pipeItem).rotateLeft(this, context);
|
||||
}
|
||||
|
||||
NBTTagCompound gateNBT = cpt.getCompoundTag("Gate");
|
||||
NBTTagCompound gateNBT = tileNBT.getCompoundTag("Gate");
|
||||
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if (gateNBT.hasKey("trigger[" + i + "]")) {
|
||||
|
@ -78,44 +78,44 @@ public class SchematicPipe extends SchematicTile {
|
|||
|
||||
@Override
|
||||
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
|
||||
cpt.setInteger("x", x);
|
||||
cpt.setInteger("y", y);
|
||||
cpt.setInteger("z", z);
|
||||
tileNBT.setInteger("x", x);
|
||||
tileNBT.setInteger("y", y);
|
||||
tileNBT.setInteger("z", z);
|
||||
|
||||
context.world().setBlock(x, y, z, block, meta, 3);
|
||||
|
||||
TileEntity tile = context.world().getTileEntity(x, y, z);
|
||||
tile.readFromNBT(cpt);
|
||||
tile.readFromNBT(tileNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
TileEntity tile = context.world().getTileEntity(x, y, z);
|
||||
Pipe pipe = BlockGenericPipe.getPipe(context.world(), x, y, z);
|
||||
|
||||
if (BlockGenericPipe.isValid(pipe)) {
|
||||
tile.writeToNBT(cpt);
|
||||
tile.writeToNBT(tileNBT);
|
||||
|
||||
// remove all pipe contents
|
||||
|
||||
cpt.removeTag("travelingEntities");
|
||||
tileNBT.removeTag("travelingEntities");
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.values()) {
|
||||
cpt.removeTag("tank[" + direction.ordinal() + "]");
|
||||
cpt.removeTag("transferState[" + direction.ordinal() + "]");
|
||||
tileNBT.removeTag("tank[" + direction.ordinal() + "]");
|
||||
tileNBT.removeTag("transferState[" + direction.ordinal() + "]");
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
cpt.removeTag("powerQuery[" + i + "]");
|
||||
cpt.removeTag("nextPowerQuery[" + i + "]");
|
||||
cpt.removeTag("internalPower[" + i + "]");
|
||||
cpt.removeTag("internalNextPower[" + i + "]");
|
||||
tileNBT.removeTag("powerQuery[" + i + "]");
|
||||
tileNBT.removeTag("nextPowerQuery[" + i + "]");
|
||||
tileNBT.removeTag("internalPower[" + i + "]");
|
||||
tileNBT.removeTag("internalNextPower[" + i + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToSchematic(IBuilderContext context, int x, int y, int z) {
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
|
||||
TileEntity tile = context.world().getTileEntity(x, y, z);
|
||||
Pipe pipe = BlockGenericPipe.getPipe(context.world(), x, y, z);
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class SchematicPipe extends SchematicTile {
|
|||
|
||||
@Override
|
||||
public void postProcessing(IBuilderContext context, int x, int y, int z) {
|
||||
Item pipeItem = Item.getItemById(cpt.getInteger("pipeId"));
|
||||
Item pipeItem = Item.getItemById(tileNBT.getInteger("pipeId"));
|
||||
|
||||
if (BptPipeExtension.contains(pipeItem)) {
|
||||
BptPipeExtension.get(pipeItem).postProcessing(this, context);
|
||||
|
@ -143,13 +143,13 @@ public class SchematicPipe extends SchematicTile {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void idsToSchematic(MappingRegistry registry) {
|
||||
super.idsToSchematic(registry);
|
||||
public void idsToBlueprint(MappingRegistry registry) {
|
||||
super.idsToBlueprint(registry);
|
||||
|
||||
if (cpt.hasKey("pipeId")) {
|
||||
Item item = Item.getItemById(cpt.getInteger("pipeId"));
|
||||
if (tileNBT.hasKey("pipeId")) {
|
||||
Item item = Item.getItemById(tileNBT.getInteger("pipeId"));
|
||||
|
||||
cpt.setInteger("pipeId", registry.getIdForItem(item));
|
||||
tileNBT.setInteger("pipeId", registry.getIdForItem(item));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,13 +157,13 @@ public class SchematicPipe extends SchematicTile {
|
|||
public void idsToWorld(MappingRegistry registry) {
|
||||
super.idsToWorld(registry);
|
||||
|
||||
if (cpt.hasKey("pipeId")) {
|
||||
if (tileNBT.hasKey("pipeId")) {
|
||||
try {
|
||||
Item item = registry.getItemForId(cpt.getInteger("pipeId"));
|
||||
Item item = registry.getItemForId(tileNBT.getInteger("pipeId"));
|
||||
|
||||
cpt.setInteger("pipeId", Item.getIdFromItem(item));
|
||||
tileNBT.setInteger("pipeId", Item.getIdFromItem(item));
|
||||
} catch (MappingNotFoundException e) {
|
||||
cpt.removeTag("pipeId");
|
||||
tileNBT.removeTag("pipeId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,10 +183,10 @@ public class SchematicPipe extends SchematicTile {
|
|||
// translation badly broken. We need to flush out information that
|
||||
// would be otherwise corrupted - that is the inventory (with the
|
||||
// old formalism "items") and gate parameters.
|
||||
cpt.removeTag("items");
|
||||
tileNBT.removeTag("items");
|
||||
|
||||
if (cpt.hasKey("Gate")) {
|
||||
NBTTagCompound gateNBT = cpt.getCompoundTag("Gate");
|
||||
if (tileNBT.hasKey("Gate")) {
|
||||
NBTTagCompound gateNBT = tileNBT.getCompoundTag("Gate");
|
||||
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if (gateNBT.hasKey("triggerParameters[" + i + "]")) {
|
||||
|
|
Loading…
Reference in a new issue