本文整理汇总了Java中buildcraft.api.core.BuildCraftAPI类的典型用法代码示例。如果您正苦于以下问题:Java BuildCraftAPI类的具体用法?Java BuildCraftAPI怎么用?Java BuildCraftAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildCraftAPI类属于buildcraft.api.core包,在下文中一共展示了BuildCraftAPI类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeToWorld
import buildcraft.api.core.BuildCraftAPI; //导入依赖的package包/类
@Override
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
if (isConcrete) {
if (stacks.size() == 0 || !BuildCraftAPI.isSoftBlock(context.world(), x, y, z)) {
return;
} else {
ItemStack stack = stacks.getFirst();
// force the block to be air block, in case it's just a soft
// block which replacement is not straightforward
context.world().setBlock(x, y, z, Blocks.air, 0, 3);
stack.tryPlaceItemIntoWorld(
BuildCraftAPI.proxy.getBuildCraftPlayer((WorldServer) context.world()).get(),
context.world(), x, y, z, 1, 0.0f, 0.0f, 0.0f);
}
} else {
context.world().setBlock(x, y, z, Blocks.air, 0, 3);
}
}
示例2: placeInWorld
import buildcraft.api.core.BuildCraftAPI; //导入依赖的package包/类
@Override
public void placeInWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
if (isConcrete) {
if (stacks.size() == 0 || !BuildCraftAPI.isSoftBlock(context.world(), x, y, z)) {
return;
} else {
ItemStack stack = stacks.getFirst();
// force the block to be air block, in case it's just a soft
// block which replacement is not straightforward
context.world().setBlock(x, y, z, Blocks.air, 0, 3);
stack.tryPlaceItemIntoWorld(
BuildCraftAPI.proxy.getBuildCraftPlayer((WorldServer) context.world()).get(),
context.world(), x, y, z, 1, 0.0f, 0.0f, 0.0f);
}
} else {
context.world().setBlock(x, y, z, Blocks.air, 0, 3);
}
}
示例3: getSignature
import buildcraft.api.core.BuildCraftAPI; //导入依赖的package包/类
/**
* By default, block class name, block tile name and block name are used to define block signature. Overriding this subprogram may allow to replace some of
* these with stars, specify the mod that this block kind is coming from or add custom data to the signature.
*/
public BlockSignature getSignature(Block block) {
BlockSignature sig = new BlockSignature();
if (block.blockID > BuildCraftAPI.LAST_ORIGINAL_BLOCK) {
sig.blockClassName = block.getClass().getSimpleName();
if (block instanceof BlockContainer) {
// TODO: Try to see if we can get a world instance to call with instead of null
TileEntity tile = ((BlockContainer) block).createNewTileEntity(null);
if (tile != null) {
sig.tileClassName = tile.getClass().getSimpleName();
}
}
}
sig.blockName = block.getUnlocalizedName();
sig.replaceNullWithStar();
return sig;
}
示例4: isAlreadyBuilt
import buildcraft.api.core.BuildCraftAPI; //导入依赖的package包/类
@Override
public boolean isAlreadyBuilt(IBuilderContext context, int x, int y, int z) {
if (isConcrete) {
return !BuildCraftAPI.isSoftBlock(context.world(), x, y, z);
} else {
return BuildCraftAPI.isSoftBlock(context.world(), x, y, z);
}
}
示例5: getItemSignature
import buildcraft.api.core.BuildCraftAPI; //导入依赖的package包/类
public static ItemSignature getItemSignature(Item item) {
ItemSignature sig = new ItemSignature();
if (item.itemID >= Block.blocksList.length + BuildCraftAPI.LAST_ORIGINAL_ITEM) {
sig.itemClassName = item.getClass().getSimpleName();
}
sig.itemName = item.getUnlocalizedName(new ItemStack(item));
return sig;
}