FactoryProperties.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:Contraptions 作者:
/**
 * Creates a Factory Contraptions
 *
 * @param location Location to attempt creation
 * @return Created Contraption if successful
 */
@Override
public Response createContraption(BlockLocation location) {
    Anchor anchor = structureGadget.exists(location);
    if (anchor == null) {
        return new Response(false, "Incorrect structure for factory");
    }
    Inventory inventory = ((InventoryHolder) location.getBlock().getState()).getInventory();
    if (matchGadget.matches(inventory) && matchGadget.consume(inventory)) {
        Factory newFactory = new Factory(this, anchor);
        contraptionManager.registerContraption(newFactory);
        SoundType.CREATION.play(newFactory.getLocation());
        return new Response(true, "Created a " + newFactory.getName() + " factory!", newFactory);
    }
    return new Response(false, "Incorrect items for a Factory");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号