Java 类net.minecraft.block.BlockFurnace 实例源码

项目:pnc-repressurized    文件:HeatBehaviourFurnace.java   
@Override
public void update() {
    TileEntityFurnace furnace = getTileEntity();
    if (getHeatExchanger().getTemperature() > 373) {
        int furnaceBurnTime = furnace.getField(0);
        int furnaceCookTime = furnace.getField(2);
        if (furnaceBurnTime < 190 && !furnace.getStackInSlot(0).isEmpty()) {
            if (furnaceBurnTime == 0) BlockFurnace.setState(true, furnace.getWorld(), furnace.getPos());
            furnace.setField(1, 200); // currentItemBurnTime
            furnace.setField(0, furnaceBurnTime + 10); // furnaceBurnTime
            getHeatExchanger().addHeat(-1);
        }
        if (furnaceCookTime > 0) {
            // Easy performance saver, the Furnace won't be ticked unnecessary when there's nothing to
            // cook (or when just started cooking).
            int progress = Math.max(0, ((int) getHeatExchanger().getTemperature() - 343) / 30);
            progress = Math.min(5, progress);
            for (int i = 0; i < progress; i++) {
                furnace.update();
            }
        }
    }
}
项目:morefurnaces    文件:ItemUpgrade.java   
private boolean upgradeVanillaFurnace(World world, BlockPos pos, TileEntityFurnace furnace, FurnaceType to)
{
    byte facing = (byte) world.getBlockState(pos).getValue(BlockFurnace.FACING).ordinal();
    TileEntityIronFurnace newFurnace = FurnaceType.makeEntity(to.ordinal());

    if (newFurnace != null)
    {
        int[][] fromSlotIds = new int[][] {new int[] {0}, new int[] {1}, new int[] {2}};

        copyInventory(furnace, fromSlotIds, newFurnace);

        world.setBlockState(pos, MoreFurnaces.blockFurnaces.getDefaultState().withProperty(BlockMoreFurnaces.VARIANT, to));
        world.setTileEntity(pos, newFurnace);

        newFurnace.copyStateFrom(furnace, facing);

        return true;
    } else
    {
        return false;
    }
}
项目:mves    文件:FurnaceCapabilityProvider.java   
private boolean ignite() {
  ItemStack stackInSlot = furnace.getStackInSlot(fuel_slot);
  int burnTime = TileEntityFurnace.getItemBurnTime(stackInSlot);
  if (burnTime > 0) {
    furnace.setField(currentItemBurnTime_field, burnTime);
    furnace.setField(furnaceBurnTime_field, burnTime - 1);
    stackInSlot.stackSize--;
    if (stackInSlot.stackSize <= 0) {
      stackInSlot = stackInSlot.getItem().getContainerItem(stackInSlot);
    }
    furnace.setInventorySlotContents(fuel_slot, stackInSlot);
    BlockFurnace.setState(furnace.isBurning(), furnace.getWorld(), furnace.getPos());
    furnace.markDirty();
    return true;
  }
  return false;
}
项目:SolarFlux    文件:SimpleEnergyDispenserModule.java   
protected void sendEnergyToFurnace(TileEntityFurnace pFurnace) {
    final int FURNACE_COOKING_TICKS = 200;
    final int FURNACE_COOKING_ENERGY = FURNACE_COOKING_TICKS * ModConfiguration.getFurnaceUpgradeHeatingConsumption();

    if (mFurnaceEnergyBuffer < FURNACE_COOKING_ENERGY) {
        mFurnaceEnergyBuffer += getTileEntity().getEnergyStorage().extractEnergy(FURNACE_COOKING_ENERGY - mFurnaceEnergyBuffer, false);
    }

    // Is there anything to smell?
    if (pFurnace.getStackInSlot(0) != null && pFurnace.furnaceBurnTime < FURNACE_COOKING_TICKS) {
        int burnTicksAvailable = mFurnaceEnergyBuffer / ModConfiguration.getFurnaceUpgradeHeatingConsumption();
        if (burnTicksAvailable >= FURNACE_COOKING_TICKS) {
            if (pFurnace.furnaceBurnTime == 0) {
                // Add 1 as first tick is not counted in the burning process.
                pFurnace.furnaceBurnTime += 1;
                BlockFurnace.updateFurnaceBlockState(pFurnace.furnaceBurnTime > 0, pFurnace.getWorldObj(), pFurnace.xCoord, pFurnace.yCoord, pFurnace.zCoord);
            }
            pFurnace.furnaceBurnTime += FURNACE_COOKING_TICKS;
            mFurnaceEnergyBuffer -= FURNACE_COOKING_TICKS * ModConfiguration.getFurnaceUpgradeHeatingConsumption();
        }
    }
}
项目:PneumaticCraft    文件:HeatBehaviourFurnace.java   
@Override
public void update(){
    TileEntityFurnace furnace = getTileEntity();
    if(getHeatExchanger().getTemperature() > 373) {
        if(furnace.furnaceBurnTime < 190 && furnace.getStackInSlot(0) != null) {
            if(furnace.furnaceBurnTime == 0) BlockFurnace.updateFurnaceBlockState(true, furnace.getWorldObj(), furnace.xCoord, furnace.yCoord, furnace.zCoord);
            furnace.currentItemBurnTime = 200;
            furnace.furnaceBurnTime += 10;
            getHeatExchanger().addHeat(-1);
        }
        if(furnace.furnaceCookTime > 0) {//Easy performance saver, the Furnace won't be ticked unnecessary when there's nothing to cook (or when just started cooking).
            int progress = Math.max(0, ((int)getHeatExchanger().getTemperature() - 343) / 30);
            progress = Math.min(5, progress);
            for(int i = 0; i < progress; i++) {
                furnace.updateEntity();
            }
        }
    }
}
项目:minecraft-roguelike    文件:Furnace.java   
public static void generate(IWorldEditor editor, ItemStack fuel, boolean lit, Cardinal dir, Coord pos){

        if(!RogueConfig.getBoolean(RogueConfig.FURNITURE)) return;

        MetaBlock furnace;

        if(lit){
            furnace = new MetaBlock(Blocks.LIT_FURNACE);
        } else {
            furnace = new MetaBlock(Blocks.FURNACE);
        }

        furnace.withProperty(BlockFurnace.FACING, Cardinal.facing(Cardinal.reverse(dir)));

        furnace.set(editor, pos);

        if(fuel == null) return;

        TileEntity te = editor.getTileEntity(pos);
        if(te == null) return;
        if(!(te instanceof TileEntityFurnace)) return;
        TileEntityFurnace teFurnace = (TileEntityFurnace)te;
        teFurnace.setInventorySlotContents(FUEL_SLOT, fuel);
    }
项目:TRHS_Club_Mod_2016    文件:RotationHelper.java   
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.field_150444_as || 
            block == Blocks.field_150472_an || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
项目:MC-Prefab    文件:HouseConfiguration.java   
private static void PlaceAndFillCraftingMachines(EntityPlayer player, World world, BlockPos cornerPosition, EnumFacing facing, boolean addCraftingTable, boolean addFurnace)
{
    BlockPos itemPosition = cornerPosition.offset(facing.rotateY()).offset(facing).down();

    if (addCraftingTable)
    {
        BuildingMethods.ReplaceBlock(world, itemPosition, Blocks.CRAFTING_TABLE);
    }

    // Trigger the workbench achievement.
    // TODO: Figure out how to trigger this advancement.
    //player.addStat(AchievementList.BUILD_WORK_BENCH);

    // Place a furnace next to the crafting table and fill it with 20 coal.
    if (addFurnace)
    {
        itemPosition = itemPosition.offset(facing.rotateY());
        BuildingMethods.ReplaceBlock(world, itemPosition, Blocks.FURNACE.getDefaultState().withProperty(BlockFurnace.FACING, facing));

        TileEntity tileEntity = world.getTileEntity(itemPosition);

        if (tileEntity instanceof TileEntityFurnace)
        {
            TileEntityFurnace furnaceTile = (TileEntityFurnace) tileEntity;
            furnaceTile.setInventorySlotContents(1, new ItemStack(Items.COAL, 20));
        }
    }
}
项目:MC-Prefab    文件:StructureModerateHouse.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos,
        EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    if (foundBlock instanceof BlockFurnace)
    {
        if (this.furnacePosition == null)
        {
            this.furnacePosition = new ArrayList<BlockPos>();
        }

        this.furnacePosition.add(block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing));
    }
    else if (foundBlock instanceof BlockChest && !((ModerateHouseConfiguration)configuration).addChests)
    {
        return true;
    }
    else if (foundBlock instanceof BlockChest && this.chestPosition == null)
    {
        this.chestPosition = block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockTrapDoor)
    {
        // The trap door will still be added, but the mine shaft may not be
        // built.
        this.trapDoorPosition = block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }

    return false;
}
项目:Factorization    文件:DefaultHeatConverter.java   
@Override
public void giveHeat() {
    final boolean needStart = !isStarted();
    final int topBurnTime = 200;
    if (furnace.furnaceBurnTime < topBurnTime) {
        furnace.furnaceBurnTime += 1;
        if (needStart) {
            BlockFurnace.setState(furnace.furnaceBurnTime > 0, furnace.getWorld(), furnace.getPos());
        }
    } else {
        furnace.cookTime += 1;
        furnace.cookTime = Math.min(furnace.cookTime, 200 - 1);
    }
}
项目:CauldronGit    文件:RotationHelper.java   
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.wall_sign || 
            block == Blocks.standing_sign || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
项目:ClockworkPhase2    文件:BlockCelestialCompassSB.java   
public BlockCelestialCompassSB(Material blockMaterial, String unlocalizedName)
{
    super(blockMaterial, unlocalizedName);
    this.setCreativeTab(null);
    this.setBlockUnbreakable();
    this.setResistance(1000000F);
    this.setLightLevel(1.0F);
    this.setDefaultState(this.blockState.getBaseState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH));
}
项目:ClockworkPhase2    文件:BlockCelestialCompassSB.java   
@Override
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }

    return this.getDefaultState().withProperty(BlockFurnace.FACING, enumfacing);
}
项目:MinecraftAR    文件:RenderEventHandler.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void worldDidLastRender(RenderWorldLastEvent e) {
    OverlayRenderHelper renderer = new OverlayRenderHelper(e);
    renderer.testQuad(9.0f, 55.0f, 9.0f, false);
    ArrayList<Class<? extends Block>> renderedOn = new ArrayList<>();
    renderedOn.add(BlockFurnace.class);
    renderer.staticOverlays(renderedOn);
}
项目:Cauldron    文件:RotationHelper.java   
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.wall_sign || 
            block == Blocks.standing_sign || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
项目:Cauldron    文件:RotationHelper.java   
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.wall_sign || 
            block == Blocks.standing_sign || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
项目:Cauldron    文件:RotationHelper.java   
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.wall_sign || 
            block == Blocks.standing_sign || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
项目:IceAndShadow2    文件:NyxEventHandlerCold.java   
@SubscribeEvent
public void onPlayerTriesToUseFurnace(PlayerInteractEvent e) {
    if (e.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
        return;
    if (e.entityPlayer.dimension == IaSFlags.dim_nyx_id && !e.entityPlayer.capabilities.isCreativeMode) {
        final Block bl = e.world.getBlock(e.x, e.y, e.z);
        if (bl instanceof BlockFurnace || e.world.getTileEntity(e.x, e.y, e.x) instanceof TileEntityFurnace) {
            e.setCanceled(true);
            IaSPlayerHelper.messagePlayer(e.entityPlayer,
                    "It's too cold to light that furnace here. Find another way to smelt.");
        }
    }
}
项目:DecompiledMinecraft    文件:EntityMinecartFurnace.java   
public IBlockState getDefaultDisplayTile()
{
    return (this.isMinecartPowered() ? Blocks.lit_furnace : Blocks.furnace).getDefaultState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH);
}
项目:DecompiledMinecraft    文件:TileEntityFurnace.java   
/**
 * Like the old updateEntity(), except more generic.
 */
public void update()
{
    boolean flag = this.isBurning();
    boolean flag1 = false;

    if (this.isBurning())
    {
        --this.furnaceBurnTime;
    }

    if (!this.worldObj.isRemote)
    {
        if (this.isBurning() || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null)
        {
            if (!this.isBurning() && this.canSmelt())
            {
                this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);

                if (this.isBurning())
                {
                    flag1 = true;

                    if (this.furnaceItemStacks[1] != null)
                    {
                        --this.furnaceItemStacks[1].stackSize;

                        if (this.furnaceItemStacks[1].stackSize == 0)
                        {
                            Item item = this.furnaceItemStacks[1].getItem().getContainerItem();
                            this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null;
                        }
                    }
                }
            }

            if (this.isBurning() && this.canSmelt())
            {
                ++this.cookTime;

                if (this.cookTime == this.totalCookTime)
                {
                    this.cookTime = 0;
                    this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]);
                    this.smeltItem();
                    flag1 = true;
                }
            }
            else
            {
                this.cookTime = 0;
            }
        }
        else if (!this.isBurning() && this.cookTime > 0)
        {
            this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime);
        }

        if (flag != this.isBurning())
        {
            flag1 = true;
            BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos);
        }
    }

    if (flag1)
    {
        this.markDirty();
    }
}
项目:DecompiledMinecraft    文件:EntityMinecartFurnace.java   
public IBlockState getDefaultDisplayTile()
{
    return (this.isMinecartPowered() ? Blocks.lit_furnace : Blocks.furnace).getDefaultState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH);
}
项目:DecompiledMinecraft    文件:TileEntityFurnace.java   
/**
 * Like the old updateEntity(), except more generic.
 */
public void update()
{
    boolean flag = this.isBurning();
    boolean flag1 = false;

    if (this.isBurning())
    {
        --this.furnaceBurnTime;
    }

    if (!this.worldObj.isRemote)
    {
        if (this.isBurning() || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null)
        {
            if (!this.isBurning() && this.canSmelt())
            {
                this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);

                if (this.isBurning())
                {
                    flag1 = true;

                    if (this.furnaceItemStacks[1] != null)
                    {
                        --this.furnaceItemStacks[1].stackSize;

                        if (this.furnaceItemStacks[1].stackSize == 0)
                        {
                            Item item = this.furnaceItemStacks[1].getItem().getContainerItem();
                            this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null;
                        }
                    }
                }
            }

            if (this.isBurning() && this.canSmelt())
            {
                ++this.cookTime;

                if (this.cookTime == this.totalCookTime)
                {
                    this.cookTime = 0;
                    this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]);
                    this.smeltItem();
                    flag1 = true;
                }
            }
            else
            {
                this.cookTime = 0;
            }
        }
        else if (!this.isBurning() && this.cookTime > 0)
        {
            this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime);
        }

        if (flag != this.isBurning())
        {
            flag1 = true;
            BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos);
        }
    }

    if (flag1)
    {
        this.markDirty();
    }
}
项目:BaseClient    文件:EntityMinecartFurnace.java   
public IBlockState getDefaultDisplayTile()
{
    return (this.isMinecartPowered() ? Blocks.lit_furnace : Blocks.furnace).getDefaultState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH);
}
项目:BaseClient    文件:TileEntityFurnace.java   
/**
 * Like the old updateEntity(), except more generic.
 */
public void update()
{
    boolean flag = this.isBurning();
    boolean flag1 = false;

    if (this.isBurning())
    {
        --this.furnaceBurnTime;
    }

    if (!this.worldObj.isRemote)
    {
        if (this.isBurning() || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null)
        {
            if (!this.isBurning() && this.canSmelt())
            {
                this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);

                if (this.isBurning())
                {
                    flag1 = true;

                    if (this.furnaceItemStacks[1] != null)
                    {
                        --this.furnaceItemStacks[1].stackSize;

                        if (this.furnaceItemStacks[1].stackSize == 0)
                        {
                            Item item = this.furnaceItemStacks[1].getItem().getContainerItem();
                            this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null;
                        }
                    }
                }
            }

            if (this.isBurning() && this.canSmelt())
            {
                ++this.cookTime;

                if (this.cookTime == this.totalCookTime)
                {
                    this.cookTime = 0;
                    this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]);
                    this.smeltItem();
                    flag1 = true;
                }
            }
            else
            {
                this.cookTime = 0;
            }
        }
        else if (!this.isBurning() && this.cookTime > 0)
        {
            this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime);
        }

        if (flag != this.isBurning())
        {
            flag1 = true;
            BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos);
        }
    }

    if (flag1)
    {
        this.markDirty();
    }
}
项目:BaseClient    文件:EntityMinecartFurnace.java   
public IBlockState getDefaultDisplayTile()
{
    return (this.isMinecartPowered() ? Blocks.lit_furnace : Blocks.furnace).getDefaultState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH);
}
项目:BaseClient    文件:TileEntityFurnace.java   
/**
 * Like the old updateEntity(), except more generic.
 */
public void update()
{
    boolean flag = this.isBurning();
    boolean flag1 = false;

    if (this.isBurning())
    {
        --this.furnaceBurnTime;
    }

    if (!this.worldObj.isRemote)
    {
        if (this.isBurning() || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null)
        {
            if (!this.isBurning() && this.canSmelt())
            {
                this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);

                if (this.isBurning())
                {
                    flag1 = true;

                    if (this.furnaceItemStacks[1] != null)
                    {
                        --this.furnaceItemStacks[1].stackSize;

                        if (this.furnaceItemStacks[1].stackSize == 0)
                        {
                            Item item = this.furnaceItemStacks[1].getItem().getContainerItem();
                            this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null;
                        }
                    }
                }
            }

            if (this.isBurning() && this.canSmelt())
            {
                ++this.cookTime;

                if (this.cookTime == this.totalCookTime)
                {
                    this.cookTime = 0;
                    this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]);
                    this.smeltItem();
                    flag1 = true;
                }
            }
            else
            {
                this.cookTime = 0;
            }
        }
        else if (!this.isBurning() && this.cookTime > 0)
        {
            this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime);
        }

        if (flag != this.isBurning())
        {
            flag1 = true;
            BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos);
        }
    }

    if (flag1)
    {
        this.markDirty();
    }
}
项目:Backmemed    文件:EntityMinecartFurnace.java   
public IBlockState getDefaultDisplayTile()
{
    return (this.isMinecartPowered() ? Blocks.LIT_FURNACE : Blocks.FURNACE).getDefaultState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH);
}
项目:Backmemed    文件:TileEntityFurnace.java   
/**
 * Like the old updateEntity(), except more generic.
 */
public void update()
{
    boolean flag = this.isBurning();
    boolean flag1 = false;

    if (this.isBurning())
    {
        --this.furnaceBurnTime;
    }

    if (!this.world.isRemote)
    {
        ItemStack itemstack = (ItemStack)this.furnaceItemStacks.get(1);

        if (this.isBurning() || !itemstack.func_190926_b() && !((ItemStack)this.furnaceItemStacks.get(0)).func_190926_b())
        {
            if (!this.isBurning() && this.canSmelt())
            {
                this.furnaceBurnTime = getItemBurnTime(itemstack);
                this.currentItemBurnTime = this.furnaceBurnTime;

                if (this.isBurning())
                {
                    flag1 = true;

                    if (!itemstack.func_190926_b())
                    {
                        Item item = itemstack.getItem();
                        itemstack.func_190918_g(1);

                        if (itemstack.func_190926_b())
                        {
                            Item item1 = item.getContainerItem();
                            this.furnaceItemStacks.set(1, item1 == null ? ItemStack.field_190927_a : new ItemStack(item1));
                        }
                    }
                }
            }

            if (this.isBurning() && this.canSmelt())
            {
                ++this.cookTime;

                if (this.cookTime == this.totalCookTime)
                {
                    this.cookTime = 0;
                    this.totalCookTime = this.getCookTime((ItemStack)this.furnaceItemStacks.get(0));
                    this.smeltItem();
                    flag1 = true;
                }
            }
            else
            {
                this.cookTime = 0;
            }
        }
        else if (!this.isBurning() && this.cookTime > 0)
        {
            this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.totalCookTime);
        }

        if (flag != this.isBurning())
        {
            flag1 = true;
            BlockFurnace.setState(this.isBurning(), this.world, this.pos);
        }
    }

    if (flag1)
    {
        this.markDirty();
    }
}
项目:CustomWorldGen    文件:EntityMinecartFurnace.java   
public IBlockState getDefaultDisplayTile()
{
    return (this.isMinecartPowered() ? Blocks.LIT_FURNACE : Blocks.FURNACE).getDefaultState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH);
}
项目:CustomWorldGen    文件:TileEntityFurnace.java   
/**
 * Like the old updateEntity(), except more generic.
 */
public void update()
{
    boolean flag = this.isBurning();
    boolean flag1 = false;

    if (this.isBurning())
    {
        --this.furnaceBurnTime;
    }

    if (!this.worldObj.isRemote)
    {
        if (this.isBurning() || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null)
        {
            if (!this.isBurning() && this.canSmelt())
            {
                this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
                this.currentItemBurnTime = this.furnaceBurnTime;

                if (this.isBurning())
                {
                    flag1 = true;

                    if (this.furnaceItemStacks[1] != null)
                    {
                        --this.furnaceItemStacks[1].stackSize;

                        if (this.furnaceItemStacks[1].stackSize == 0)
                        {
                            this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]);
                        }
                    }
                }
            }

            if (this.isBurning() && this.canSmelt())
            {
                ++this.cookTime;

                if (this.cookTime == this.totalCookTime)
                {
                    this.cookTime = 0;
                    this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]);
                    this.smeltItem();
                    flag1 = true;
                }
            }
            else
            {
                this.cookTime = 0;
            }
        }
        else if (!this.isBurning() && this.cookTime > 0)
        {
            this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime);
        }

        if (flag != this.isBurning())
        {
            flag1 = true;
            BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos);
        }
    }

    if (flag1)
    {
        this.markDirty();
    }
}
项目:mves    文件:FurnaceCapabilityProvider.java   
@Override
public int offerEnergy(IEnergyOffer offer) {
  if (!isSmelting()) {
    return 0;
  }
  int energyPerTick = Config.furnacePowerPerTickConsumed.getInt();
  int offerMax = offer.getLimit();
  if (energyPerTick > offerMax) {
    return 0;
  }
  boolean wasBurning = furnace.isBurning();
  int remainingFuel = furnace.getField(furnaceBurnTime_field);
  int cookTime = furnace.getField(cookTime_field);
  int totalCookTime = furnace.getField(totalCookTime_field);
  int neededCookTime = totalCookTime - cookTime;
  int maxTicks = neededCookTime - remainingFuel + 1;
  if (maxTicks <= 0) {
    return 0;
  }
  int maxEnergy = maxTicks * energyPerTick;
  while (maxEnergy > offerMax) {
    maxEnergy -= energyPerTick;
    if (maxEnergy <= 0) {
      return 0;
    }
  }

  int used = 0;
  Iterator<IEnergyStack> iterator = offer.getStacks().iterator();
  while (used < maxEnergy && iterator.hasNext()) {
    IEnergyStack next = iterator.next();
    while (used < maxEnergy && next != null && next.getStackSize() >= energyPerTick) {
      int extractEnergy = next.extractEnergy(energyPerTick);
      used += extractEnergy;
    }
  }

  int addtlTicks = used / energyPerTick;
  if (addtlTicks > 0) {
    if (remainingFuel + addtlTicks <= 3) {
      addtlTicks = 4;
    }
    furnace.setField(furnaceBurnTime_field, remainingFuel + addtlTicks);
    if (!wasBurning) {
      BlockFurnace.setState(furnace.isBurning(), furnace.getWorld(), furnace.getPos());
    }
    furnace.markDirty();
  }

  return used;
}
项目:MC-Prefab    文件:StructureAlternateStart.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos,
        EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    HouseConfiguration houseConfig = (HouseConfiguration) configuration;

    if ((!houseConfig.addBed && foundBlock instanceof BlockBed) || (!houseConfig.addChest && foundBlock instanceof BlockChest)
            || (!houseConfig.addTorches && foundBlock instanceof BlockTorch)
            || (!houseConfig.addCraftingTable && (foundBlock instanceof BlockWorkbench || foundBlock instanceof BlockFurnace)))
    {
        // Don't place the block, returning true means that this has been
        // "handled"
        return true;
    }

    if (foundBlock instanceof BlockFurnace)
    {
        this.furnacePosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockTrapDoor && houseConfig.addMineShaft)
    {
        // The trap door will still be added, but the mine shaft may not be
        // built.
        this.trapDoorPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockChest && this.chestPosition == null)
    {
        this.chestPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockStandingSign)
    {
        this.signPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }

    if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS.getRegistryName().getResourcePath()))
    {
        blockState = blockState.withProperty(BlockStainedGlass.COLOR, houseConfig.glassColor);
        block.setBlockState(blockState);
        this.priorityOneBlocks.add(block);

        return true;
    }
    else if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourcePath()))
    {
        block.setBlockState(foundBlock.getStateFromMeta(houseConfig.glassColor.getMetadata()));
        this.priorityOneBlocks.add(block);
        return true;
    }

    return false;
}
项目:Structures    文件:RotationHelper.java   
private static BlockType getBlockType(Block block) {

    if(block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame
        || block instanceof BlockCocoa) {
      return BlockType.BED;
    }
    if(block instanceof BlockRail) {
      return BlockType.RAIL;
    }
    if(block instanceof BlockRailPowered || block instanceof BlockRailDetector) {
      return BlockType.RAIL_POWERED;
    }
    if(block instanceof BlockStairs) {
      return BlockType.STAIR;
    }
    if(block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder
        || block == Blocks.wall_sign) {
      return BlockType.CHEST;
    }
    if(block == Blocks.standing_sign) {
      return BlockType.SIGNPOST;
    }
    if(block instanceof BlockDoor) {
      return BlockType.DOOR;
    }
    if(block instanceof BlockButton) {
      return BlockType.BUTTON;
    }
    if(block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) {
      return BlockType.REDSTONE_REPEATER;
    }
    if(block instanceof BlockTrapDoor) {
      return BlockType.TRAPDOOR;
    }
    if(block instanceof BlockHugeMushroom) {
      return BlockType.MUSHROOM_CAP;
    }
    if(block instanceof BlockVine) {
      return BlockType.VINE;
    }
    if(block instanceof BlockSkull) {
      return BlockType.SKULL;
    }
    if(block instanceof BlockAnvil) {
      return BlockType.ANVIL;
    }
    if(block instanceof BlockLog) {
      return BlockType.LOG;
    }
    if(block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) {
      return BlockType.DISPENSER;
    }
    if(block instanceof BlockTorch) {
      return BlockType.TORCH;
    }
    if(block instanceof BlockLever) {
      return BlockType.LEVER;
    }
    if(block instanceof BlockTripWireHook) {
      return BlockType.TRIP_WIRE_HOOK;
    }

    return null;
  }
项目:Cyclic    文件:EntityGoldFurnaceMinecart.java   
public IBlockState getDefaultDisplayTile() {
  return (this.isMinecartPowered() ? Blocks.LIT_FURNACE : Blocks.FURNACE).getDefaultState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH);
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottom.java   
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    BlockPos originalPos = pos;
    IBlockState originalState = state;

    if(checkAndBreakRing(worldIn, pos, state))
        return;

    int iterations = 0;
    while(iterations < 15)
    {
        if(state == null || !(state.getBlock().equals(ModBlocks.armillaryRingFrameBottom) || state.getBlock().equals(ModBlocks.armillaryRingFrameBottomCorner)))
        {
            return;
        }
        else if(state.getBlock().equals(ModBlocks.armillaryRingFrameBottomCorner))
        {
            if(state.getBlock().getActualState(state, worldIn, pos).getValue(BlockArmillaryRingFrameBottomCorner.BOTTOM_BLOCK))
            {
                pos = pos.offset(state.getValue(BlockFurnace.FACING).getOpposite());
                state = worldIn.getBlockState(pos);
            }
            else
            {
                pos = pos.down();
                state = worldIn.getBlockState(pos);
            }

        }
        else if(state.getBlock().equals(ModBlocks.armillaryRingFrameBottom))
        {
            pos = pos.offset(state.getValue(BlockDirectional.FACING).getOpposite());
            state = worldIn.getBlockState(pos);
        }

        if(checkAndBreakRing(worldIn, pos, state))
            break;

        ++iterations;
    }

    super.breakBlock(worldIn, originalPos, originalState);
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottomCorner.java   
public BlockArmillaryRingFrameBottomCorner(Material blockMaterial, String name) {
    super(blockMaterial, name);
    this.setLightLevel(1.0F);
    this.setCreativeTab(null);
    this.setDefaultState(this.blockState.getBaseState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH).withProperty(BOTTOM_BLOCK, false));
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottomCorner.java   
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    BlockPos originalPos = pos;
    IBlockState originalState = state;

    int iterations = 0;
    while(iterations < 15)
    {
        if(state == null || !(state.getBlock().equals(ModBlocks.armillaryRingFrameBottom) || state.getBlock().equals(ModBlocks.armillaryRingFrameBottomCorner)))
        {
            return;
        }
        else if(state.getBlock().equals(ModBlocks.armillaryRingFrameBottomCorner))
        {
            if(state.getBlock().getActualState(state, worldIn, pos).getValue(BlockArmillaryRingFrameBottomCorner.BOTTOM_BLOCK))
            {
                pos = pos.offset(state.getValue(BlockFurnace.FACING).getOpposite());
                state = worldIn.getBlockState(pos);
            }
            else
            {
                pos = pos.down();
                state = worldIn.getBlockState(pos);
            }

        }
        else if(state.getBlock().equals(ModBlocks.armillaryRingFrameBottom))
        {
            pos = pos.offset(state.getValue(BlockDirectional.FACING).getOpposite());
            state = worldIn.getBlockState(pos);
        }

        if(checkAndBreakRing(worldIn, pos, state))
            break;

        ++iterations;
    }

    super.breakBlock(worldIn, originalPos, originalState);
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottomCorner.java   
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    super.onBlockPlacedBy(world, pos, state, placer, stack);
    world.setBlockState(pos, state.withProperty(BlockFurnace.FACING, placer.getHorizontalFacing()), 2);
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottomCorner.java   
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing enumfacing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(BlockFurnace.FACING, enumfacing);
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottomCorner.java   
@Override
public int getMetaFromState(IBlockState state) {
    return state.getValue(BlockFurnace.FACING).getHorizontalIndex();
}