当前位置: 首页>>代码示例>>Java>>正文


Java TileEntityFurnace.getItemBurnTime方法代码示例

本文整理汇总了Java中net.minecraft.tileentity.TileEntityFurnace.getItemBurnTime方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntityFurnace.getItemBurnTime方法的具体用法?Java TileEntityFurnace.getItemBurnTime怎么用?Java TileEntityFurnace.getItemBurnTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.tileentity.TileEntityFurnace的用法示例。


在下文中一共展示了TileEntityFurnace.getItemBurnTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findMatchingFuel

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
public static MachineFuel findMatchingFuel(ResourceLocation list, NonNullList<ItemStack> input)
{
    if (list.toString().equals("minecraft:vanilla"))
    {
        if (input.size() == 1 && !input.get(0).isEmpty())
        {
            ItemStack stack = input.get(0);
            int burnTime = TileEntityFurnace.getItemBurnTime(stack);
            if (burnTime > 0)
                return new VanillaFurnaceFuel(stack, burnTime);
        }

        return MachineFuel.EMPTY;
    }

    return findMatchingFuel(getInstance(list).fuels, input);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:18,代码来源:MachineManager.java

示例2: isPartOfFuel

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
public static boolean isPartOfFuel(ResourceLocation list, ItemStack stack)
{
    if (stack.isEmpty())
        return false;

    if (list.toString().equals("minecraft:vanilla"))
    {
        return TileEntityFurnace.getItemBurnTime(stack) > 0;
    }

    for (MachineFuel fuel : getInstance(list).fuels)
    {
        if (fuel.getFuelInput().stream()
                .anyMatch(input -> ItemHelper.stackMatchesRecipeInput(stack, input, false)))
            return true;
    }

    return false;
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:20,代码来源:MachineManager.java

示例3: initialize

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
public static void initialize() {
    NonNullList<ItemStack> stacks = NonNullList.create();
    for (Item i : ForgeRegistries.ITEMS) {
        CreativeTabs tab = i.getCreativeTab();
        if(tab != null) {
            i.getSubItems(tab, stacks);
        }
    }
    List<ItemStack> out = new LinkedList<>();
    for (ItemStack stack : stacks) {
        int burn = TileEntityFurnace.getItemBurnTime(stack); //Respects vanilla values.
        if(burn > 0) {
            out.add(stack);
        }
    }
    knownFuelStacks = ImmutableList.copyOf(out);
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:18,代码来源:FuelItemHelper.java

示例4: handleEntityCollision

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
@Override
public boolean handleEntityCollision(World worldIn, BlockPos pos,
		IBlockState state, Entity entityIn) {
	if(entity.ticksExisted()%FUEL_EAT_TICKS==0 && !worldIn.isRemote){
		if(entityIn instanceof EntityItem){
			ItemStack stack = ((EntityItem)entityIn).getItem();
			//find the furnace burn time. if not hardcoded in vanilla furnace, it will check Forge's registered fuelHandlers
			int burnTime = TileEntityFurnace.getItemBurnTime(stack);
			if(burnTime!=0){
				this.addFuel(burnTime*stack.getCount());
				worldIn.playSound(null,entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1, 1);
				worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, entityIn.posX, entityIn.posY, entityIn.posZ, 0, 0, 0);
				entityIn.setDead();
				IBlockState bstate = worldIn.getBlockState(getPos());
				worldIn.notifyBlockUpdate(getPos(), bstate, bstate, 3);
			}
		}
	}
	return true;
}
 
开发者ID:Xilef11,项目名称:runesofwizardry-classics,代码行数:21,代码来源:FueledRuneEntity.java

示例5: ignite

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
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;
}
 
开发者ID:HenryLoenwind,项目名称:mves,代码行数:18,代码来源:FurnaceCapabilityProvider.java

示例6: isItemValidForSlot

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemStack)
{
    if (slotID == 0)
    {
        return TileEntityFurnace.getItemBurnTime(itemStack) > 0;
    }
    else if (slotID >= 2)
    {
    	if (this.producingStack != null)
    	{
            ItemStack stackInSlot = this.getStackInSlot(slotID);
            return stackInSlot != null && stackInSlot.isItemEqual(itemStack);
    	}
    	return TileEntityIngotCompressor.isItemCompressorInput(itemStack);
    }

    return false;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:20,代码来源:TileEntityIngotCompressor.java

示例7: getItemEnergyValue

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
public static int getItemEnergyValue(ItemStack fuel)
{
    if (!ItemStackTools.isValid(fuel)) {
      return 0;
    }
    int amt = GameRegistry.getFuelValue(fuel);
    if(amt == 0)amt = TileEntityFurnace.getItemBurnTime(fuel);
    //{ 10000, 400000, 2000000, 10000000}
    /*TE
     * (COAL)1600
     * (VALUE)1600*10*3/2 = 24000
     * (LEADSTONE)24000/10000=2.4
     * (HARD)24000/400000=0.06
     * (REDSTONE)24000/2000000=0.012
     * (RESONENT)24000/10000000=0.0024
     * */
    /*CU
     * (NEW)24000/5=4800
     * (BLUE)4800/10000=0.48 (+ADV) = 0.96
     * (RED)4800/400000=0.012 (+ADV) = 0.024
     * (GREEN)4800/2000000=0.0024 (+ADV) = 0.0048
     * (DARK)4800/10000000=0.00048 (+ADV) = 0.00096
     */
    
    return amt;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:27,代码来源:TileEntityEngineFurnace.java

示例8: tryDistill

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
public void tryDistill() {
	if (this.amIBottom()) {
		if (this.getFluidAmount() > 0 && this.getFluid().isFluidEqual(new FluidStack(ModBlocks.fluidOil, 0))) {
			// WE have oil.
			if (remainBurnTime > 0) {
				// we have fuel

				distill();
			} else {

				// consume more fuel
				// only if it has mash to process
				// use the furnace's default burn times
				remainBurnTime = TileEntityFurnace.getItemBurnTime(this.getStackInSlot(0));
				if (remainBurnTime > 0) {
					// found fuel reduce item stack (AKA consume /brun the item)
					decrStackSize(0, 1);
				}

			}
		}
	}
}
 
开发者ID:TechStack,项目名称:TechStack-s-HeavyMachineryMod,代码行数:24,代码来源:TileEntityFractionalDistillation.java

示例9: update

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
@Override
public void update() {
	if (!world.isRemote) {
		// LogHelper.info("TE update entity called");

		if (remainBurnTime > 0) {
			remainBurnTime--;

			transferFuel();
		} else {

			// consume more fuel
			// only if it has mash to process
			if (fuelStorage > 0) {
				// use the furnace's default burn times
				remainBurnTime = TileEntityFurnace.getItemBurnTime(this.getStackInSlot(0));
				if (remainBurnTime > 0) {
					// found fuel reduce item stack (AKA consume /brun the item)
					decrStackSize(0, 1);
				}
			}
		}
	}
}
 
开发者ID:TechStack,项目名称:TechStack-s-HeavyMachineryMod,代码行数:25,代码来源:TileEntityDistiller.java

示例10: onItemTooltipEvent

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onItemTooltipEvent(ItemTooltipEvent event) {
  if (Keyboard.isCreated()
      && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
    // https://www.reddit.com/r/minecraftsuggestions/comments/3brh7v/when_hovering_over_a_food_it_shows_how_many_food/
    ItemStack itemStack = event.getItemStack();
    if (itemStack == null || itemStack.getItem() == null) {
      return;
    }
    if (foodDetails && itemStack.getItem() instanceof ItemFood) {
      ItemFood food = (ItemFood) itemStack.getItem();
      int hunger = food.getHealAmount(itemStack);
      float satur = food.getSaturationModifier(itemStack);
      if (hunger > 0 || satur > 0) {
        event.getToolTip().add(hunger + " (" + satur + ")");
      }
    }
    if (fuelDetails) {
      int burnTime = TileEntityFurnace.getItemBurnTime(itemStack);
      if (burnTime > 0) {
        event.getToolTip().add(UtilChat.lang("tooltip.burntime") + burnTime);
      }
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:27,代码来源:TextInfoModule.java

示例11: isItemValidForSlot

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
@Override
public boolean isItemValidForSlot( int slot, ItemStack item )
{
	if ( item == null )
	{
		return true;
	}
	
	if ( slot == FUEL_SLOT )
	{
		return ( TileEntityFurnace.getItemBurnTime( item ) > 0 );
	}
	else if ( slot == BLOCK_SLOT )
	{
		return ( item.getItem() == Item.getItemFromBlock( ComponentEquipment.blocks.ingot ) && item.getItemDamage() == IngotItem.PERSISTIUM );
	}
	else if ( slot == TOOL_SLOT )
	{
		return ( item.getItem() instanceof EquipmentItem );
	}

	return true;
}
 
开发者ID:spacechase0,项目名称:ComponentEquipment,代码行数:24,代码来源:PersistiumInfuserTileEntity.java

示例12: update

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
@Override
public void update()
{
    if (burnTime <= 0)
    {
        if (machineCore.isMachineOn() && power < MAX_POWER)
        {
            burnTime = TileEntityFurnace.getItemBurnTime(getInventory().getStackInSlot(0));
        }
    }
    else
    {
        burnTime--;
        if (power < MAX_POWER)
        {
            power += POWER_PER_TICK;
        }
    }
}
 
开发者ID:BuiltBrokenModding,项目名称:BasicIndustry,代码行数:20,代码来源:PowerModuleBurner.java

示例13: preProcessItem

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
/**
 * Determines if a tile entity is burning
 * Handles the consumption of fuel
 * 
 * @return If the tile entity is now burning
 */
protected boolean preProcessItem()
{
    boolean changed = false;
    ItemStack fuelItemStack = getStackInSlot(getFuelSlot());
    this.currentItemBurnTime = this.burnTime = TileEntityFurnace.getItemBurnTime(fuelItemStack);

    if (this.burnTime > 0)
    {
        if (fuelItemStack != null)
        {
            --fuelItemStack.stackSize;

            if (fuelItemStack.stackSize == 0)
            {
                setInventorySlotContents(getFuelSlot(), fuelItemStack.getItem().getContainerItem(fuelItemStack));
            }
            changed = true;
        }
    }
    return changed;
}
 
开发者ID:TeamMetallurgy,项目名称:MetallurgyCore,代码行数:28,代码来源:TileEntityMetallurgy.java

示例14: updateEntity

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
public void updateEntity() {
	pushEnergy();
	if (getStackInSlot(0) == null) {
		setPercentage(0);
	}
	if (getStackInSlot(0) != null) {
		if (TileEntityFurnace.getItemBurnTime(getStackInSlot(0)) > 0) {
			int energy = TileEntityFurnace.getItemBurnTime(getStackInSlot(0));
			if (getPercentage() == TileEntityFurnace.getItemBurnTime(getStackInSlot(0))) {
				setPercentage(0);
				decrStackSize(0, 1);
				// receiveEnergy(ForgeDirection.DOWN,
				// TileEntityFurnace.getItemBurnTime(getStackInSlot(0)),
				// false);
				storage.receiveEnergy(energy, false);
				// storage.receiveEnergy(TileEntityFurnace.getItemBurnTime(getStackInSlot(0))
				// * (worldObj.rand.nextInt(6) + 1), false);
			} else {
				if (getStackInSlot(0) != null) {
					addPercentage(1);
				}

			}
		}
	}
}
 
开发者ID:jaredlll08,项目名称:Fluxed-Trinkets,代码行数:27,代码来源:TileEntityHeatGenerator.java

示例15: consumeFuel

import net.minecraft.tileentity.TileEntityFurnace; //导入方法依赖的package包/类
public boolean consumeFuel(int f)
{
	if (burnTime >= f)
	{
		burnTime -= f;
		return true;
	}
	
	for (int i = 0; i < getSizeInventory(); i++)
	{
		ItemStack is = decrStackSize(i, 1);
		if (is != null && is.stackSize > 0)
		{
			burnTime += TileEntityFurnace.getItemBurnTime(is);
			return consumeFuel(f);
		}
	}
	return false;
}
 
开发者ID:Ckathode,项目名称:archimedes-ships,代码行数:20,代码来源:TileEntityEngine.java


注:本文中的net.minecraft.tileentity.TileEntityFurnace.getItemBurnTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。