當前位置: 首頁>>代碼示例>>Java>>正文


Java FluidContainerRegistry.getFluidForFilledItem方法代碼示例

本文整理匯總了Java中net.minecraftforge.fluids.FluidContainerRegistry.getFluidForFilledItem方法的典型用法代碼示例。如果您正苦於以下問題:Java FluidContainerRegistry.getFluidForFilledItem方法的具體用法?Java FluidContainerRegistry.getFluidForFilledItem怎麽用?Java FluidContainerRegistry.getFluidForFilledItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.fluids.FluidContainerRegistry的用法示例。


在下文中一共展示了FluidContainerRegistry.getFluidForFilledItem方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drain

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Nullable
@Override
public FluidStack drain(FluidStack resource, boolean doDrain)
{
    if (container.stackSize != 1 || resource == null)
    {
        return null;
    }

    FluidStack contained = FluidContainerRegistry.getFluidForFilledItem(container);
    if (contained != null && contained.isFluidEqual(resource))
    {
        return drain(resource.amount, doDrain);
    }

    return null;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:FluidContainerRegistryWrapper.java

示例2: getFuelBurn

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public double getFuelBurn(final ItemStack item) {
    if (item != null) {
        if (item.getItem() == Items.ender_pearl) {
            return 750.0;
        }
        if (item.getItem() == Items.ender_eye) {
            return 3000.0;
        }
        if (item.getItem() == Item.getItemFromBlock((Block)ExtraUtils.enderLily)) {
            return 12000.0;
        }
        final FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(item);
        if (fluid != null && "ender".equals(fluid.getFluid().getName())) {
            return fluid.amount * 6;
        }
    }
    return 0.0;
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:20,代碼來源:TileEntityGeneratorEnder.java

示例3: onBlockActivated

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
public boolean onBlockActivated(final World worldObj, final int x, final int y, final int z, final EntityPlayer player, final int side, final float dx, final float dy, final float dz) {
    if (worldObj.isRemote) {
        return true;
    }
    final TileEntity tile = worldObj.getTileEntity(x, y, z);
    if (player.getCurrentEquippedItem() != null && tile instanceof IFluidHandler) {
        final ItemStack item = player.getCurrentEquippedItem();
        final FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(item);
        if (fluid != null && ((IFluidHandler)tile).fill(ForgeDirection.getOrientation(side), fluid, false) == fluid.amount) {
            ((IFluidHandler)tile).fill(ForgeDirection.getOrientation(side), fluid, true);
            if (!player.capabilities.isCreativeMode) {
                player.setCurrentItemOrArmor(0, item.getItem().getContainerItem(item));
            }
            return true;
        }
    }
    player.openGui((Object)ExtraUtilsMod.instance, 0, worldObj, x, y, z);
    return true;
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:20,代碼來源:BlockGenerator.java

示例4: getOveride

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
public List<String> getOveride(final ItemStack par1ItemStack, final int par2, final int par3) {
    int j1 = 0;
    while (j1 < this.inventorySlots.inventorySlots.size()) {
        final Slot slot = (Slot) this.inventorySlots.inventorySlots.get(j1);
        if (slot instanceof SlotGhostItemContainer && slot.getHasStack()) {
            if (!this.func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, par2, par3) || !slot.func_111238_b()) {
                return null;
            }
            final ItemStack filter = this.player.inventory.getStackInSlot(this.currentFilter);
            if (filter != null && filter.hasTagCompound() && filter.getTagCompound().hasKey("isLiquid_" + slot.slotNumber)) {
                final FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(slot.getStack());
                final List t = new ArrayList();
                t.add(XUHelper.getFluidName(liquid));
                return (List<String>)t;
            }
            return null;
        }
        else {
            ++j1;
        }
    }
    return null;
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:24,代碼來源:GuiFilter.java

示例5: fillTankWithContainer

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
public static boolean fillTankWithContainer(IFluidHandler tank, EntityPlayer player)
{
    ItemStack stack = player.getCurrentEquippedItem();
    FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack);

    if(liquid == null)
        return false;

    if(tank.fill(ForgeDirection.UNKNOWN, liquid, false) != liquid.amount && !player.capabilities.isCreativeMode)
        return false;
    
    tank.fill(ForgeDirection.UNKNOWN, liquid, true);
    
    if(!player.capabilities.isCreativeMode)
        InventoryUtils.consumeItem(player.inventory, player.inventory.currentItem);

    player.inventoryContainer.detectAndSendChanges();
    return true;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:20,代碼來源:FluidUtils.java

示例6: isMachineItemValidForSlot

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
protected boolean isMachineItemValidForSlot(int i, @Nullable ItemStack item) {
  if (i == 0 && item != null) {
    FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(item);
    if (fluid != null) {
      return isValidFluid(fluid);
    }
    if (item.getItem() == Items.water_bucket) {
      return true;
    }
    if (item.getItem() == Items.lava_bucket) {
      return true;
    }
    if (item.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) item.getItem()).getFluid(item) != null) {
      return isValidFluid(((IFluidContainerItem) item.getItem()).getFluid(item));
    }
    return false;
  }
  return false;
}
 
開發者ID:HenryLoenwind,項目名稱:EnderIOAddons,代碼行數:21,代碼來源:TileNiard.java

示例7: placeBlock

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public void placeBlock(World world, int x, int y, int z, ForgeDirection direction, EntityPlayer player,
                       ItemStack placing, IToggleController controller) // TODO: Add storage item index as parameter?
{
    if (FluidContainerRegistry.isFilledContainer(placing))
    {
        FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(placing);
        Fluid fluid = fluidStack.getFluid();
        if (fluidStack.getFluid().canBePlacedInWorld())
        {
            Block fluidBlock = fluid.getBlock();
            world.setBlock(x, y, z, fluidBlock);
            world.notifyBlockChange(x, y, z, fluidBlock);
            fluidBlock.onBlockAdded(world, x, y, z);
            ItemStack drainedContainer = FluidContainerRegistry.drainFluidContainer(placing);
            placing.stackSize--;
            controller.getStorageHandler().addItemStackToStorage(drainedContainer);
        }
    } else if (placing.getItem() instanceof ItemBucket)
    {
        ItemBucket item = (ItemBucket) placing.getItem();
        item.tryPlaceContainedLiquid(world, x, y, z);
    }
}
 
開發者ID:MrSpring,項目名稱:ToggleBlocks,代碼行數:25,代碼來源:BucketToggleAction.java

示例8: renderItem

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

	// ====================== Render item texture ======================
	FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(item);
	int color = fluidStack.getFluid().getColor();

	IIcon fluidIcon = item.getIconIndex();
	IIcon bucketIcon = Items.bucket.getIconIndex(new ItemStack(Items.bucket));
	if(type == ItemRenderType.INVENTORY) {
		GL11.glEnable(GL11.GL_ALPHA_TEST);
		RenderItem.getInstance().renderIcon(0, 0, bucketIcon, 16, 16);

		GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));

		RenderItem.getInstance().renderIcon(0, 0, fluidIcon, 16, 16);
		GL11.glColor3f(1f, 1f, 1f);
	}
	else {
		
		ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)bucketIcon).getMinU(), ((IIcon)bucketIcon).getMinV(), ((IIcon)bucketIcon).getMaxU(), ((IIcon)bucketIcon).getMaxV(), ((IIcon)bucketIcon).getIconWidth(), ((IIcon)bucketIcon).getIconHeight(), 0.1f);
		GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));
		ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)fluidIcon).getMinU(), ((IIcon)fluidIcon).getMinV(), ((IIcon)fluidIcon).getMaxU(), ((IIcon)fluidIcon).getMaxV(), ((IIcon)fluidIcon).getIconWidth(), ((IIcon)fluidIcon).getIconHeight(), 0.1f);
		GL11.glColor3f(1f, 1f, 1f);
	}
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:27,代碼來源:RendererBucket.java

示例9: isItemFuel

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
protected boolean isItemFuel(ItemStack itemstack) {

    FluidStack containedFluid = null;
    if(itemstack.getItem() instanceof IFluidContainerItem) {
        containedFluid = ((IFluidContainerItem)itemstack.getItem()).getFluid(itemstack);
    }
    if(containedFluid == null) {
        containedFluid = FluidContainerRegistry.getFluidForFilledItem(itemstack);
    }
    if(containedFluid != null) {
        if(containedFluid.getFluid() == fuel) {
            return true;
        }
        return FluidUtil.testFuel(FluidRegistry.getFluidName(containedFluid));
    }

    return false;
}
 
開發者ID:katzenpapst,項目名稱:amunra,代碼行數:20,代碼來源:TileEntityMothershipEngineJet.java

示例10: isItemValidForSlot

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack) {
    if(itemstack == null) return false;

    switch(slotID) {
    case 0:
        FluidStack containedFluid = FluidContainerRegistry.getFluidForFilledItem(itemstack);
        if(containedFluid != null && containedFluid.getFluid() == fuel) {
            return true;
        }
        break;
    case 1:
        return ItemElectricBase.isElectricItem(itemstack.getItem());
    }
    return false;

    // return (slotID == 0 && itemstack != null && itemstack.getItem() == GCItems.fuelCanister);
}
 
開發者ID:katzenpapst,項目名稱:amunra,代碼行數:19,代碼來源:TileEntityMothershipEngineIon.java

示例11: getResultFluid

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public FluidStack getResultFluid(ItemStack inIS, FluidStack inFS, int sealedTime)
{
	if(recipeOutFluid != null)
	{
		FluidStack fs = recipeOutFluid.copy();
		FluidStack itemLiquid = FluidContainerRegistry.getFluidForFilledItem(inIS);
		if(!removesLiquid)
		{
			fs.amount = inFS.amount+itemLiquid.amount;
		}
		else
		{
			fs.amount = ( fs.amount * inFS.amount ) / recipeFluid.amount;
		}
		return fs;
	}
	return null;
}
 
開發者ID:vidaj,項目名稱:TFCWaterCompatibility,代碼行數:20,代碼來源:BarrelLiquidToLiquidRecipe.java

示例12: addLiquid

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
public ItemStack addLiquid(ItemStack is)
{
	if(is == null || is.stackSize > 1)
		return is;
	
	if(FluidContainerRegistry.isFilledContainer(is))
	{
		FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(is);
		if(addLiquid(fs))
		{
			worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
			return FluidContainerRegistry.drainFluidContainer(is);
		}
	}
	else if(is.getItem() instanceof IFluidContainerItem)
	{
		FluidStack isfs = ((IFluidContainerItem) is.getItem()).getFluid(is);
		if(isfs != null && addLiquid(isfs))
		{
			((IFluidContainerItem) is.getItem()).drain(is, is.getMaxDamage(), true);
			worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
		}
	}
	return is;
}
 
開發者ID:StrayWolfe,項目名稱:Cooking-with-TFC,代碼行數:26,代碼來源:TileCookingPot.java

示例13: loadUsageRecipes

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
  public void loadUsageRecipes(ItemStack ingredient)
  {
for (CookingPotRecipe recipe : recipeList)
{			
	if(recipe != null)
	{
		CachedCookingPotRecipe crecipe = new CachedCookingPotRecipe(recipe);
		if(crecipe.contains(crecipe.Ingredients, ingredient))
			arecipes.add(crecipe);

		FluidStack inputFluid = recipe.getInputFluid();
		FluidStack fluidstack = FluidContainerRegistry.getFluidForFilledItem(ingredient);
		
		if (inputFluid != null && inputFluid.isFluidEqual(fluidstack)) 
			arecipes.add(crecipe);
	}
}
  }
 
開發者ID:StrayWolfe,項目名稱:Cooking-with-TFC,代碼行數:20,代碼來源:CookingPotRecipeHandler.java

示例14: fillHandlerWithContainer

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
public static boolean fillHandlerWithContainer(World world, IFluidHandler handler, EntityPlayer player) {

		ItemStack container = player.getCurrentEquippedItem();
		FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(container);

		if (fluid != null) {
			if (handler.fill(ForgeDirection.UNKNOWN, fluid, false) == fluid.amount || player.capabilities.isCreativeMode) {
				if (ServerHelper.isClientWorld(world)) {
					return true;
				}
				handler.fill(ForgeDirection.UNKNOWN, fluid, true);

				if (!player.capabilities.isCreativeMode) {
					player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemHelper.consumeItem(container));
				}
				return true;
			}
		}
		return false;
	}
 
開發者ID:PaleoCrafter,項目名稱:R0b0ts,代碼行數:21,代碼來源:FluidHelper.java

示例15: matches

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean matches(ItemStack subject) {
	FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(subject);

	if (fs == null && subject.getItem() instanceof IFluidContainerItem) {
		IFluidContainerItem item = (IFluidContainerItem)subject.getItem();
		fs = item.getFluid(subject);
	}

	// match amount precisely to avoid having to deal with leftover
	return fs == null && fluid == null ||
			fs != null && fs.getFluid() == fluid && fs.amount >= amount;
}
 
開發者ID:Herobone,項目名稱:HeroUtils,代碼行數:14,代碼來源:RecipeInputFluidContainer.java


注:本文中的net.minecraftforge.fluids.FluidContainerRegistry.getFluidForFilledItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。