TileEntityCrank.java 文件源码

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

项目:Machines-and-Stuff 作者:
@Override
public void update() {
    boolean sendUpdate = false;
    if(generationTimer < 0) {
        generationTimerDefault = -1;
        generationTimer = -1;
        if(!world.isRemote)
            sendUpdate = true;
    }
    if(container.getStoredPower() > 0)
        if(pushEnergy()) {
            sendUpdate = true;
        }
    if(generationTimerDefault > 0 && this.container.getStoredPower() < this.container.getCapacity()) {
        generationTimer--;
        this.container.givePower(5, false);
        if(!world.isRemote)
            sendUpdate = true;
    }

    if(!world.isRemote) {
        if(sendUpdate) {
            this.markDirty();
            PacketHandler.INSTANCE.sendToAllAround(new MessageCrank(this), new NetworkRegistry.TargetPoint(this.world.provider.getDimension(), (double) this.getPos().getX(), (double) this.getPos().getY(), (double) this.getPos().getZ(), 128d));
            this.world.notifyNeighborsOfStateChange(getPos(), getBlockType(), true);
        }
    }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号