本文整理匯總了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
}
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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);
}
}
}
}
}
示例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;
}