當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。