Package net.glowstone.block.state

Source Code of net.glowstone.block.state.GlowBrewingStand

package net.glowstone.block.state;

import net.glowstone.block.GlowBlock;
import net.glowstone.block.GlowBlockState;
import net.glowstone.block.entity.TEBrewingStand;
import org.bukkit.block.BrewingStand;
import org.bukkit.inventory.BrewerInventory;

public class GlowBrewingStand extends GlowBlockState implements BrewingStand {

    private int brewTime = 0;

    public GlowBrewingStand(GlowBlock block) {
        super(block);
        brewTime = getTileEntity().getBrewTime();
    }

    public GlowBrewingStand(GlowBlock block, int brewTime) {
        super(block);
        this.brewTime = brewTime;
    }

    private TEBrewingStand getTileEntity() {
        return (TEBrewingStand) getBlock().getTileEntity();
    }

    @Override
    public int getBrewingTime() {
        return brewTime;
    }

    @Override
    public void setBrewingTime(int brewTime) {
        this.brewTime = brewTime;
    }

    @Override
    public BrewerInventory getInventory() {
        return (BrewerInventory) getTileEntity().getInventory();
    }

    @Override
    public boolean update(boolean force, boolean applyPhysics) {
        boolean result = super.update(force, applyPhysics);
        if (result) {
            TEBrewingStand stand = getTileEntity();
            stand.setBrewTime(brewTime);
            stand.updateInRange();
        }
        return result;
    }
}
TOP

Related Classes of net.glowstone.block.state.GlowBrewingStand

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.