fixed loading of destroying builders blocks, fix #1623

This commit is contained in:
SpaceToad 2014-04-26 17:52:09 +02:00
parent 5a8000707d
commit 69c8d75371
2 changed files with 17 additions and 6 deletions

View file

@ -8,6 +8,8 @@
*/
package buildcraft.api.blueprints;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
public class SchematicFactoryBlock extends SchematicFactory <SchematicBlock> {
@ -15,15 +17,24 @@ public class SchematicFactoryBlock extends SchematicFactory <SchematicBlock> {
@Override
protected SchematicBlock loadSchematicFromWorldNBT (NBTTagCompound nbt, MappingRegistry registry) {
int blockId = nbt.getInteger("blockId");
SchematicBlock s = SchematicRegistry.newSchematicBlock(registry.getBlockForId(blockId));
Block b = registry.getBlockForId(blockId);
if (s != null) {
s.readFromNBT(nbt, registry);
if (b == Blocks.air) {
SchematicBlock s = new SchematicBlock();
s.meta = 0;
s.block = Blocks.air;
return s;
} else {
return null;
SchematicBlock s = SchematicRegistry.newSchematicBlock(b);
if (s != null) {
s.readFromNBT(nbt, registry);
return s;
}
}
return s;
return null;
}
@Override

View file

@ -228,7 +228,7 @@ public class BuildingItem implements IBuilder {
destination.writeToNBT(destinationNBT);
nbt.setTag ("destination", destinationNBT);
nbt.setDouble("lifeTime", lifetime);
nbt.setDouble("lifetime", lifetime);
NBTTagList items = new NBTTagList();