Pump.java 文件源码

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

项目:StarQuestCode 作者:
public Stage run() {
    int size = tube.size();
    if (size == maxLength)
        return stop();

    BlockLocation target = anchor.getRelative(forward, size + 1);

    if (!target.isEmptyForCollision())
        return stop();

    // Try to take a drain block from the furnace.
    FurnaceInventory inventory = ((Furnace) anchor.getRelative(backward).getBlock().getState()).getInventory();
    ItemStack item = inventory.getSmelting();
    if (item != null && item.getType() == tubeMaterial) {
        byte data = (byte) item.getDurability();
        // Before taking, we have to simulate whether we can actually
        // place the block.
        if (!EventSimulator.blockPlace(target, tubeMaterial.getId(), (byte) 0, target.getRelative(backward, size), player))
            return stop();

        int newAmount = item.getAmount() - 1;
        if (newAmount < 1) {
            inventory.setSmelting(null);
        } else {
            item.setAmount(newAmount);
            inventory.setSmelting(item);
        }
        target.setTypeIdAndData(tubeMaterial.getId(), data, true);
        tube.add(target);
        return this;
    }
    return stop();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号