improved block destroy animation, and implemented filler pattern

This commit is contained in:
SpaceToad 2014-04-05 16:10:39 +02:00
parent 2431d82225
commit 757bea50dc
6 changed files with 78 additions and 2 deletions

View file

@ -27,6 +27,7 @@ fillerpattern.pyramid=Pyramid
fillerpattern.stairs=Stairs
fillerpattern.box=Box
fillerpattern.cylinder=Cylinder
fillerpattern.frame=Frame
fluid.oil=Oil
fluid.fuel=Fuel

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

View file

@ -54,6 +54,7 @@ import buildcraft.builders.filler.pattern.PatternClear;
import buildcraft.builders.filler.pattern.PatternCylinder;
import buildcraft.builders.filler.pattern.PatternFill;
import buildcraft.builders.filler.pattern.PatternFlatten;
import buildcraft.builders.filler.pattern.PatternFrame;
import buildcraft.builders.filler.pattern.PatternHorizon;
import buildcraft.builders.filler.pattern.PatternPyramid;
import buildcraft.builders.filler.pattern.PatternStairs;
@ -364,6 +365,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
FillerManager.registry.addPattern(new PatternPyramid());
FillerManager.registry.addPattern(new PatternStairs());
FillerManager.registry.addPattern(new PatternCylinder());
FillerManager.registry.addPattern(new PatternFrame());
} catch (Error error) {
BCLog.logErrorAPI("Buildcraft", error, IFillerPattern.class);
throw error;

View file

@ -11,6 +11,7 @@ package buildcraft.builders;
import java.util.Date;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.IBuilderContext;
@ -174,6 +175,17 @@ public class BuildingItem implements IBuilder {
private void build() {
if (slotToBuild != null) {
Block block = context.world().getBlock((int) destination.x, (int)destination.y, (int)destination.z);
int meta = context.world().getBlockMetadata((int) destination.x, (int)destination.y, (int)destination.z);
context.world().playAuxSFXAtEntity(
null,
2001,
(int) destination.x,
(int) destination.y,
(int) destination.z,
Block.getIdFromBlock(block) + (meta << 12));
slotToBuild.writeToWorld(context);
}
}

View file

@ -0,0 +1,55 @@
/**
* 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.filler.pattern;
import buildcraft.api.blueprints.SchematicMask;
import buildcraft.core.Box;
import buildcraft.core.blueprints.Template;
public class PatternFrame extends FillerPattern {
public PatternFrame() {
super("frame");
}
@Override
public Template getBlueprint(Box box) {
Template template = new Template (box.sizeX(), box.sizeY(), box.sizeZ());
int xMin = 0;
int yMin = 0;
int zMin = 0;
int xMax = box.sizeX() - 1;
int yMax = box.sizeY() - 1;
int zMax = box.sizeZ() - 1;
for (int it = 0; it < 2; it++) {
for (int i = 0; i < template.sizeX; ++i) {
template.contents [i][it * (box.sizeY() - 1)][0] = new SchematicMask (true);
template.contents [i][it * (box.sizeY() - 1)][template.sizeZ - 1] = new SchematicMask (true);
}
for (int k = 0; k < template.sizeZ; ++k) {
template.contents [0][it * (box.sizeY() - 1)][k] = new SchematicMask (true);
template.contents [template.sizeX - 1][it * (box.sizeY() - 1)][k] = new SchematicMask (true);
}
}
for (int h = 1; h < box.sizeY(); ++h) {
template.contents [0][h][0] = new SchematicMask (true);
template.contents [0][h][template.sizeZ - 1] = new SchematicMask (true);
template.contents [template.sizeX - 1][h][0] = new SchematicMask (true);
template.contents [template.sizeX - 1][h][template.sizeZ - 1] = new SchematicMask (true);
}
return template;
}
}

View file

@ -449,8 +449,14 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
}
}
// FIXME: fix sound here
//worldObj.playAuxSFXAtEntity(null, 2001, i, j, k, blockId + (worldObj.getBlockMetadata(i, j, k) << 12));
worldObj.playAuxSFXAtEntity(
null,
2001,
i,
j,
k,
Block.getIdFromBlock(block)
+ (worldObj.getBlockMetadata(i, j, k) << 12));
worldObj.setBlockToAir(i, j, k);
}