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


Java FluidContainerRegistry.BUCKET_VOLUME屬性代碼示例

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


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

示例1: canCrush

public boolean canCrush()
{
	if(this.tank.getFluidAmount() >= (FluidContainerRegistry.BUCKET_VOLUME/2)+this.costMod && inventory.length > 0)
	{
		if(inventory[0]!=null && CrushRecipes.getCrushResult(inventory[0])!=null)
		{
			if(inventory[1]== null)
				return true;
			ItemStack temp = CrushRecipes.getCrushResult(inventory[0]);
			
			if(inventory[1].isItemEqual(temp) && inventory[1].stackSize + temp.stackSize <= 64)
			{
				return true;
			}
			
		}
	}
	return false;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:19,代碼來源:TileEntitySteamCrusher.java

示例2: fillCustomBucket

private ItemStack fillCustomBucket(World world, MovingObjectPosition pos, ItemStack container) {
	Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
	Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
	if (fluid != null) {
		boolean isSource = world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0;
		if (!isSource) {
			return null;
		}
		FluidStack fluidStack = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME);
		ItemStack bucket = FluidContainerRegistry.fillFluidContainer(fluidStack, container);
		if (bucket != null) {
			world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
			return bucket;
		}
	}
	return null;
}
 
開發者ID:lawremi,項目名稱:PerFabricaAdAstra,代碼行數:17,代碼來源:BucketHandler.java

示例3: tryFillContainer

/**
 * This tries to fill the given container (at inventory[slot]) with fluid from the specified tank
 * If successful, it places the resulting filled container in inventory[slot]
 * 
 * Note: this deals with the issue where FluidContainerRegistry.fillFluidContainer() returns null for failed fills
 * 
 * @param tank		The tank to take the fluid from
 * @param liquid   The type of liquid in that tank (the calling method will normally have checked this already)
 * @param inventory
 * @param slot
 * @param canisterType  The type of canister to return, if it's a canister being filled (pre-matched with the liquid type)
 * 
 */
   public static void tryFillContainer(FluidTank tank, FluidStack liquid, ItemStack[] inventory, int slot, Item canisterType)
{
	ItemStack slotItem = inventory[slot];
	boolean isCanister = slotItem.getItem() instanceof ItemCanisterGeneric;
	final int amountToFill = Math.min(liquid.amount, isCanister ? slotItem.getItemDamage() - 1 : FluidContainerRegistry.BUCKET_VOLUME);

	if (amountToFill <= 0 || (isCanister && slotItem.getItem() != canisterType && slotItem.getItemDamage() != ItemCanisterGeneric.EMPTY))
		return;
	
	if (isCanister)
	{
		inventory[slot] = new ItemStack(canisterType, 1, slotItem.getItemDamage() - amountToFill);
		tank.drain(amountToFill, true);
	}
	else if (amountToFill == FluidContainerRegistry.BUCKET_VOLUME)
	{
		inventory[slot] = FluidContainerRegistry.fillFluidContainer(liquid, inventory[slot]);

		if (inventory[slot] == null)
		{
			//Failed to fill container: restore item that was there before
			inventory[slot] = slotItem;
		}
		else
		{
			tank.drain(amountToFill, true);
		}
	}
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:42,代碼來源:FluidUtil.java

示例4: getFluid

/**
 * Gets a fluid from a certain location.
 * @param world - world the block is in
 * @param x - x coordinate
 * @param y - y coordinate
 * @param z - z coordinate
 * @return the fluid at the certain location, null if it doesn't exist
 */
public static FluidStack getFluid(World world, int x, int y, int z, boolean filter)
{
	Block block = world.getBlock(x, y, z);
	int meta = world.getBlockMetadata(x, y, z);

	if(block == null)
	{
		return null;
	}

	if((block == Blocks.water || block == Blocks.flowing_water) && meta == 0)
	{
		if(!filter)
		{
			return new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME);
		}
		else {
			return new FluidStack(FluidRegistry.getFluid("heavywater"), 10);
		}
	}
	else if((block == Blocks.lava || block == Blocks.flowing_lava) && meta == 0)
	{
		return new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME);
	}
	else if(block instanceof IFluidBlock)
	{
		IFluidBlock fluid = (IFluidBlock)block;

		if(meta == 0)
		{
			return fluid.drain(world, x, y, z, false);
		}
	}

	return null;
}
 
開發者ID:Microsoft,項目名稱:vsminecraft,代碼行數:44,代碼來源:MekanismUtils.java

示例5: BlockFluidEuropaWater

public BlockFluidEuropaWater(String name, Fluid fluid, Material par2Material) {
	super(fluid, par2Material);
	this.setQuantaPerBlock(8);
	this.setRenderPass(1);
	this.needsRandomTick = true;
	this.stack = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME);
	this.setBlockName(name);
}
 
開發者ID:4Space,項目名稱:4Space-1.7,代碼行數:8,代碼來源:BlockFluidEuropaWater.java

示例6: PixelFluidLavaBlock

public PixelFluidLavaBlock(String name, Fluid fluid, Material par2Material) {
	super(fluid, par2Material);
	this.setQuantaPerBlock(8);
	this.setRenderPass(1);
	this.needsRandomTick = true;
	this.stack = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME);
	this.setBlockName(name);
	this.setCreativeTab(PixelCreativeTab.PixelBlocksTab);
}
 
開發者ID:RamiLego4Game,項目名稱:GalacticraftPixelGalaxy,代碼行數:9,代碼來源:PixelFluidLavaBlock.java

示例7: PixelFluidH3OBlock

public PixelFluidH3OBlock(String name, Fluid fluid, Material par2Material) {
	super(fluid, par2Material);
	this.setQuantaPerBlock(8);
	this.setRenderPass(1);
	this.needsRandomTick = true;
	this.stack = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME);
	this.setBlockName(name);
	this.setCreativeTab(PixelCreativeTab.PixelBlocksTab);
}
 
開發者ID:RamiLego4Game,項目名稱:GalacticraftPixelGalaxy,代碼行數:9,代碼來源:PixelFluidH3OBlock.java

示例8: onBlockActivated

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOffset, float yOffset, float zOffset)
{

    TileEntityForge blockTileEntity = (TileEntityForge) world.getTileEntity(x, y, z);

    ItemStack equippedItem = player.getCurrentEquippedItem();

    if (equippedItem != null && equippedItem.getItem() == Items.lava_bucket)
    {
        FluidStack stack = new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME);
        int fill = blockTileEntity.fill(ForgeDirection.UNKNOWN, stack, false);

        if (fill == FluidContainerRegistry.BUCKET_VOLUME)
        {
            blockTileEntity.fill(ForgeDirection.UNKNOWN, stack, true);
            equippedItem.stackSize--;

            if (equippedItem.stackSize <= 0)
            {
                ItemStack stack2 = equippedItem.getItem().getContainerItem(equippedItem);
                player.inventory.addItemStackToInventory(stack2);
            }

            world.markBlockForUpdate(x, y, z);
            return true;
        }
    }

    return super.onBlockActivated(world, x, y, z, player, side, xOffset, yOffset, zOffset);
}
 
開發者ID:TeamMetallurgy,項目名稱:Metallurgy4,代碼行數:31,代碼來源:BlockForge.java

示例9: getValidInputs

/**
 * Returns a list of all registered fluids for which <code>isValidInput(...)</code> would 
 * return true. This method is only used for displaying recipes in NEI and does not need to be 
 * performance optimized.
 * @return A collection of allowed inputs.
 */
public Collection<FluidStack> getValidInputs(){
	LinkedList<FluidStack> l = new LinkedList<>();
	for(Fluid f : FluidRegistry.getRegisteredFluids().values()){
		FluidStack stack = new FluidStack(f,FluidContainerRegistry.BUCKET_VOLUME);
		if(this.isValidInput(stack)){
			l.add(stack);
		}
	}
	return l;
}
 
開發者ID:cyanobacterium,項目名稱:PowerAdvantageAPI,代碼行數:16,代碼來源:DistillationRecipe.java

示例10: displayInformation

public void displayInformation(ItemStack stack){
	String message;
	NBTTagCompound dataTag;
	if(!stack.hasTagCompound()){
		dataTag = new NBTTagCompound();
	} else {
		dataTag = stack.getTagCompound();
	}
	if(dataTag.hasKey("Volume") && dataTag.hasKey("FluidID")){
		float buckets = (float)dataTag.getInteger("Volume") / (float)FluidContainerRegistry.BUCKET_VOLUME;
		message = (I18n.translateToLocal("tooltip.poweradvantage.buckets_of")
				.replace("%x", String.valueOf(buckets))
				.replace("%y",FluidRegistry.getFluid(dataTag.getString("FluidID")).getName()));
	} else {
		message = (I18n.translateToLocal("tooltip.poweradvantage.empty"));
	}
	
	NBTTagCompound displayTag;
	if(dataTag.hasKey("display")){
		displayTag = dataTag.getCompoundTag("display");
	} else {
		displayTag = new NBTTagCompound();
		dataTag.setTag("display", displayTag);
	}
	NBTTagList loreTag;
	if(dataTag.hasKey("Lore")){
		loreTag = displayTag.getTagList("Lore",8);
	} else {
		loreTag = new NBTTagList();
		displayTag.setTag("Lore", loreTag);
	}
	loreTag.appendTag(new NBTTagString(message));
	if(!stack.hasTagCompound()){
		stack.setTagCompound(new NBTTagCompound());
	}
}
 
開發者ID:cyanobacterium,項目名稱:PowerAdvantageAPI,代碼行數:36,代碼來源:StorageTankBlock.java

示例11: drain

@Override
public FluidStack drain(World world, int x, int y, int z, boolean doDrain) {
	if(!isSourceBlock(world, x, y, z)) {
		return null;
	}
	FluidStack stack = new FluidStack(getFluid(world, x, y, z), FluidContainerRegistry.BUCKET_VOLUME);
	if(doDrain) {
		world.setBlockToAir(x, y, z);
	}
	return stack;
}
 
開發者ID:ElConquistador,項目名稱:ElConQore,代碼行數:11,代碼來源:BlockFluidMetadata.java

示例12: getSubItems

@SuppressWarnings("unchecked")
@Override
   @SideOnly(Side.CLIENT)
   public void getSubItems(Item item, CreativeTabs tabs, @SuppressWarnings("rawtypes") List itemStacks)
   {
       Collection<Fluid> fluids = FluidRegistry.getRegisteredFluids().values();
       for (Fluid fluid : fluids) {
           FluidStack fluidStack = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME);
           ItemStack filledContainer = FluidContainerRegistry.fillFluidContainer(fluidStack, FluidContainerRegistry.EMPTY_BOTTLE);
           if (filledContainer != null && filledContainer.getItem() instanceof FilledGlassBottleItem) {
               itemStacks.add(filledContainer);
           }
       }
   }
 
開發者ID:lawremi,項目名稱:PerFabricaAdAstra,代碼行數:14,代碼來源:FilledGlassBottleItem.java

示例13: registerMixingRecipe

protected void registerMixingRecipe(Object[] inputs, FluidStack fluidInput, FluidStack fluidInput2,
		ItemStack output, FluidStack liquidOutput, Condition condition, Set<ItemStack> catalyst) {
	if (condition.temperature != Constants.STANDARD_TEMPERATURE) {
		return;
	}
	if (fluidInput != null && (fluidInput.getFluid().isGaseous() || 
			fluidInput.amount > FluidContainerRegistry.BUCKET_VOLUME) || 
		fluidInput2 != null && (fluidInput2.getFluid().isGaseous() ||
			fluidInput2.amount > FluidContainerRegistry.BUCKET_VOLUME)) {
		return;
	}
	if (!catalyst.isEmpty()) {
		return;
	}
	int offset = fluidInput2 != null ? 2 : fluidInput != null ? 1 : 0;
	inputs = Arrays.copyOf(inputs, inputs.length + offset);
	if (fluidInput != null) {
		inputs[inputs.length - offset] = toBucket(fluidInput);
	}
	if (fluidInput2 != null) {
		inputs[inputs.length - 1] = toBucket(fluidInput2);
	}
	if (output == null && liquidOutput.amount >= FluidContainerRegistry.BUCKET_VOLUME) {
		inputs = Arrays.copyOf(inputs, inputs.length + 1);
		inputs[inputs.length - 1] = new ItemStack(Items.bucket);
		output = FluidContainerRegistry.fillFluidContainer(liquidOutput, new ItemStack(Items.bucket));
	}
	RecipeUtils.addShapelessRecipe(output, inputs);
}
 
開發者ID:lawremi,項目名稱:PerFabricaAdAstra,代碼行數:29,代碼來源:VanillaIntegration.java

示例14: RecipeInputFluidContainer

public RecipeInputFluidContainer(Fluid fluid) {
	this(fluid, FluidContainerRegistry.BUCKET_VOLUME);
}
 
開發者ID:nikita488,項目名稱:RainbowElectricity,代碼行數:3,代碼來源:RecipeInputFluidContainer.java

示例15: SteamTankTileEntity

public SteamTankTileEntity() {
	super(Power.steam_power, FluidContainerRegistry.BUCKET_VOLUME * 10, SteamTankTileEntity.class.getSimpleName());
}
 
開發者ID:cyanobacterium,項目名稱:SteamAdvantage,代碼行數:3,代碼來源:SteamTankTileEntity.java


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