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


Java FluidContainerRegistry.isFilledContainer方法代码示例

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


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

示例1: getUsedContainer

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
/**
 * Returns the used (empty) container, for example an empty bucket
 * Used, for example, in isItemValidForSlot() logic
 * @param slotItem
 * @return  True if it is a container; False if it is null or not a container 
 */
public static ItemStack getUsedContainer(ItemStack container)
{
       if (FluidContainerRegistry.isBucket(container) && FluidContainerRegistry.isFilledContainer(container))
       {
           return new ItemStack(Items.bucket, container.stackSize);
       }
       else
       {
           container.stackSize--;

           if (container.stackSize == 0)
           {
               return null;
           }
           
           return container;
       }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:25,代码来源:FluidUtil.java

示例2: 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

示例3: isItemValidForSlot

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
{
	if(slotID == 1)
	{
		return false;
	}
	else if(slotID == 0)
	{
		return FluidContainerRegistry.isFilledContainer(itemstack);
	}
	else if(slotID == 2)
	{
		return ChargeUtils.canBeDischarged(itemstack);
	}

	return false;
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:19,代码来源:TileEntityFluidicPlenisher.java

示例4: 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

示例5: useBucket

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
private boolean useBucket( int slot, ItemStack stack) {
	if(slot == 0 && FluidContainerRegistry.isFilledContainer(stack) && FuelRegistry.instance.isFuel(FuelType.LIQUID,FluidContainerRegistry.getFluidForFilledItem(stack).getFluid()) && tank.getFluidAmount() + FluidContainerRegistry.getContainerCapacity(stack) <= tank.getCapacity()) {
		ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(stack);

		if(emptyContainer != null && inventory.getStackInSlot(1) == null || (emptyContainer.isItemEqual(inventory.getStackInSlot(1)) && inventory.getStackInSlot(1).stackSize < inventory.getStackInSlot(1).getMaxStackSize())) {
			tank.fill(FluidContainerRegistry.getFluidForFilledItem(stack), true);

			if(inventory.getStackInSlot(1) == null)
				super.setInventorySlotContents(1, emptyContainer);
			else
				inventory.getStackInSlot(1).stackSize++;
			decrStackSize(0, 1);
		}
		else
			return false;
	}
	else
		return false;
	
	return true;
}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:22,代码来源:TileEntityFuelingStation.java

示例6: setInventorySlotContents

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
    inventory[slot] = stack;
    if (stack != null && stack.stackSize > getInventoryStackLimit())
    {
        stack.stackSize = getInventoryStackLimit();
    }
    if(FluidContainerRegistry.isFilledContainer(stack) && GeneralReference.isValidFuel(FluidContainerRegistry.getFluidForFilledItem(stack).getFluid()))
    {
        InventoryActions.transferContainerTank(this, fuelTank, 0);
    }else
    if(FluidContainerRegistry.isEmptyContainer(stack) && fuelTank.getFluid()!=null && FluidUtils.isContainerForFluid(stack, fuelTank.getFluid().getFluid()))
    {
        InventoryActions.transferContainerTank(this, fuelTank, 0);
    }
    dirtyTanks();
    dirtyInventory();
}
 
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:20,代码来源:InventoryCopterPack.java

示例7: onInventoryChanged

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public void onInventoryChanged()
{
    for (int i = 0; i < inventory.length; i++)
    {
        if (i == 0)
        {
            ItemStack container = getStackInSlot(i);
            if(FluidContainerRegistry.isFilledContainer(container) && FluidUtils.isContainerForFluid(container, FluidRegistry.WATER))
            {
                InventoryActions.transferContainerTank(this, waterTank, i);
            }else
            if(FluidContainerRegistry.isEmptyContainer(container) && waterTank.getFluid()!=null && FluidUtils.isContainerForFluid(container, FluidRegistry.WATER))
            {
                InventoryActions.transferContainerTank(this, waterTank, i);
            }
        }
    }
    markDirty();
}
 
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:20,代码来源:InventorySteamJetpack.java

示例8: isItemValidForSlot

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
	if (gridTE != null)
	{
		ICraftingPattern currentPattern = Util.getAssemblerPattern(itemstack);
		if (currentPattern == null || currentPattern.getRequirements() == null)
			return false;
		if (FluidContainerRegistry.isEmptyContainer(currentPattern.getOutput()))
			return false;

		for (ItemStack entry : currentPattern.getRequirements())
		{
			if (entry != null && entry.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isFilledContainer(entry))
			{
				return doesRecipeExist((ICraftingPatternMAC) currentPattern);
			}
		}
	}
	return false;
}
 
开发者ID:ExtraCells,项目名称:ExtraCells1,代码行数:22,代码来源:ECPrivatePatternInventory.java

示例9: isItemValid

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean isItemValid(ItemStack s) {
    if (s == null)
        return true;

    if (FluidContainerRegistry.isFilledContainer(s))
        return true;

    Block b = Block.getBlockFromItem(s.getItem());

    if (b == Blocks.air)
        return false;

    return true;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:16,代码来源:GuiTexturePortal.java

示例10: loadUsageRecipes

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public void loadUsageRecipes(ItemStack ingredient) {
	for(IRecipe irecipe : RecipesMachine.getInstance().getRecipes(getMachine())) {
		CachedMachineRecipe recipe = new CachedMachineRecipe((((Recipe)irecipe).getRecipeAsAllItemsOnly()));
		boolean match = false;
		
		for(PositionedStack posStack : recipe.getIngredients()) {
			if(posStack.item.isItemEqual(ingredient) || ZUtils.areOresSameTypeOreDict(posStack.item, ingredient)) {
				recipe.setIngredientPermutation(recipe.ingredients, ingredient);
				arecipes.add(recipe);
				match = true;
				break;
			}
		}
		
		if(!match && (FluidContainerRegistry.isFilledContainer(ingredient) || ingredient.getItem() instanceof IFluidContainerItem || 
				(Block.getBlockFromItem(ingredient.getItem()) != Blocks.air && FluidRegistry.lookupFluidForBlock(Block.getBlockFromItem(ingredient.getItem())) != null  ))) {
			
			FluidStack fluidStack = null;
			
			if(ingredient.getItem() instanceof IFluidContainerItem)
				fluidStack  = ((IFluidContainerItem)ingredient.getItem()).getFluid(ingredient);
			else if(FluidContainerRegistry.isFilledContainer(ingredient) && FluidContainerRegistry.isFilledContainer(ingredient))
				fluidStack = FluidContainerRegistry.getFluidForFilledItem(ingredient);
			
			for(FluidStack stack : ((Recipe)irecipe).getFluidIngredients() ) {
				if((fluidStack != null && fluidStack.getFluid() == stack.getFluid()) ||
						(Block.getBlockFromItem(ingredient.getItem()) != Blocks.air && FluidRegistry.lookupFluidForBlock(Block.getBlockFromItem(ingredient.getItem())) == stack.getFluid() )) {
					recipe.setIngredientPermutation(recipe.ingredients, ingredient);
					arecipes.add(recipe);
					break;
				}
			}
		}
	}
}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:37,代码来源:TemplateNEI.java

示例11: interactFirst

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean interactFirst(EntityPlayer player)
   {
	if(!player.worldObj.isRemote)
	{
		if(player.getCurrentEquippedItem() != null)
		  {
			  if(FluidContainerRegistry.isFilledContainer(player.getCurrentEquippedItem()))
			  {
					  this.tank.fill(FluidContainerRegistry.getFluidForFilledItem(player.getCurrentEquippedItem()), true);
					  if(!player.capabilities.isCreativeMode)
					  {
						  player.inventory.consumeInventoryItem(player.getCurrentEquippedItem().getItem());
						  player.inventory.addItemStackToInventory(new ItemStack(Items.bucket, 1));
					  }
				  }
			  
			  if(FluidContainerRegistry.isEmptyContainer(player.getCurrentEquippedItem()))
			  {
					  if(this.tank.getFluidAmount() > 0 && this.tank.getFluid().getFluid()!= AdvancedUtilitiesBlocks.fluidSteam)
					  {
						  player.inventory.addItemStackToInventory(FluidContainerRegistry.fillFluidContainer(this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true), player.getCurrentEquippedItem()));
						  if(!player.capabilities.isCreativeMode)
						  {
							  player.inventory.getCurrentItem().stackSize-=1;
							  if(player.inventory.getCurrentItem().stackSize <= 0)
							  {
								  player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
							  }
						  }
					  }
				  }
			  }
		if(tank.getFluidAmount() > 0)
			player.addChatComponentMessage(new ChatComponentText("Fluid: "+tank.getFluid().getFluid().getName()+" Amount: "+tank.getFluidAmount()+" mB"));
		else
			player.addChatComponentMessage(new ChatComponentText("Empty"));
	}
	return true;
   }
 
开发者ID:Sudwood,项目名称:AdvancedUtilities,代码行数:41,代码来源:EntitySpeedyChunkTankCart.java

示例12: isFilledContainer

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public static boolean isFilledContainer(ItemStack stackInSlot) {
    if (stackInSlot.getItem() instanceof IFluidContainerItem) {
        FluidStack fluidStack = ((IFluidContainerItem) stackInSlot.getItem()).getFluid(stackInSlot);
        if (fluidStack != null) {
            return true;
        }
        else {
            return false;
        }
    }
    else {
        return FluidContainerRegistry.isFilledContainer(stackInSlot);
    }

}
 
开发者ID:TeamDmfMM,项目名称:Extra-Food,代码行数:16,代码来源:FluidContainerRegistryHelper.java

示例13: clickItemStack

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public ItemStack clickItemStack(final int par1, ItemStack item) {
    if (item != null) {
        item = item.copy();
        item.stackSize = 1;
    }
    final String keyname = "items_" + par1;
    final ItemStack filter = this.player.inventory.getStackInSlot(this.currentFilter);
    if (filter == null) {
        return item;
    }
    NBTTagCompound tags = filter.getTagCompound();
    if (item != null) {
        if (tags == null) {
            tags = new NBTTagCompound();
        }
        if (tags.hasKey(keyname)) {
            if (FluidContainerRegistry.isFilledContainer(item) && ItemStack.areItemStacksEqual(ItemStack.loadItemStackFromNBT(tags.getCompoundTag(keyname)), item)) {
                final NBTTagCompound fluidTags = new NBTTagCompound();
                if (tags.hasKey("isLiquid_" + par1)) {
                    tags.removeTag("isLiquid_" + par1);
                }
                else {
                    tags.setBoolean("isLiquid_" + par1, true);
                }
                return item;
            }
            if (tags.hasKey("isLiquid_" + par1)) {
                tags.removeTag("isLiquid_" + par1);
            }
            tags.removeTag(keyname);
        }
        else if (tags.hasKey("isLiquid_" + par1)) {
            tags.removeTag("isLiquid_" + par1);
        }
        final NBTTagCompound itemTags = new NBTTagCompound();
        item.writeToNBT(itemTags);
        tags.setTag(keyname, (NBTBase)itemTags);
        filter.setTagCompound(tags);
    }
    else if (tags != null) {
        if (tags.hasKey("isLiquid_" + par1)) {
            tags.removeTag("isLiquid_" + par1);
        }
        tags.removeTag(keyname);
        if (tags.hasNoTags()) {
            filter.setTagCompound((NBTTagCompound)null);
        }
        else {
            filter.setTagCompound(tags);
        }
    }
    return item;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:54,代码来源:ContainerFilter.java

示例14: onTooltip

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onTooltip(ItemTooltipEvent event){
    if((ConfigHandler.requiresF3plusH && event.showAdvancedItemTooltips) || !ConfigHandler.requiresF3plusH){
        if((ConfigHandler.requiresCtrl && MiscUtil.isCtrlPressed()) || !ConfigHandler.requiresCtrl){
            event.toolTip.add(EnumChatFormatting.GOLD.toString() + "Unlocalized name: " + EnumChatFormatting.GRAY.toString() + event.itemStack.getItem().getUnlocalizedName());

            //GameRegistry stuff
            if(ConfigHandler.showGameRegistryNames) {
                if (GameRegistry.findUniqueIdentifierFor(event.itemStack.getItem()) != null) {
                    event.toolTip.add(EnumChatFormatting.DARK_AQUA.toString() + "GameRegistry name: " + EnumChatFormatting.GRAY.toString() + GameRegistry.findUniqueIdentifierFor(event.itemStack.getItem()).name);
                    event.toolTip.add(EnumChatFormatting.DARK_AQUA.toString() + "Mod ID: " + EnumChatFormatting.GRAY.toString() + GameRegistry.findUniqueIdentifierFor(event.itemStack.getItem()).modId);
                } else {
                    event.toolTip.add(EnumChatFormatting.RED.toString() + "Uh oh. It looks like this item has not");
                    event.toolTip.add(EnumChatFormatting.RED.toString() + "been registered. This is a bug!");
                }
            }

            //FluidRegistry stuff
            if(ConfigHandler.showFluidRegistryNames) {
                if (FluidContainerRegistry.isFilledContainer(event.itemStack)) {
                    event.toolTip.add(EnumChatFormatting.AQUA.toString() + "FluidRegistry name: " + EnumChatFormatting.GRAY.toString() + FluidRegistry.getFluidName(FluidContainerRegistry.getFluidForFilledItem(event.itemStack)));
                } else if (event.itemStack.getItem() instanceof ItemBlock) {
                    if (FluidRegistry.lookupFluidForBlock(Block.getBlockFromItem(event.itemStack.getItem())) != null)
                        event.toolTip.add(EnumChatFormatting.AQUA.toString() + "FluidRegistry name: " + EnumChatFormatting.GRAY.toString() + FluidRegistry.lookupFluidForBlock(Block.getBlockFromItem(event.itemStack.getItem())).getName());
                }
            }

            //Classes
            if(ConfigHandler.showClassNames) {
                event.toolTip.add(EnumChatFormatting.DARK_PURPLE.toString() + "Item class name: " + EnumChatFormatting.GRAY.toString() + event.itemStack.getItem().getClass().getCanonicalName());
                if (event.itemStack.getItem() instanceof ItemBlock) {
                    event.toolTip.add(EnumChatFormatting.DARK_PURPLE.toString() + "Block class name: " + EnumChatFormatting.GRAY.toString() + Block.getBlockFromItem(event.itemStack.getItem()).getClass().getCanonicalName());
                }
            }

            //OreDictionary stuff
            if(ConfigHandler.showOreDictNames) {
                if (OreDictionary.getOreIDs(event.itemStack).length != 0) {
                    event.toolTip.add(EnumChatFormatting.DARK_GREEN.toString() + "OreDictionary names:");
                    for (int id : OreDictionary.getOreIDs(event.itemStack)) {
                        event.toolTip.add("  " + OreDictionary.getOreName(id));
                    }
                }
            }
        }else{
            event.toolTip.add(EnumChatFormatting.DARK_GRAY.toString() + event.itemStack.getItem().getUnlocalizedName());
            event.toolTip.add("Hold Ctrl for more info");
        }
    }
}
 
开发者ID:goldenapple3,项目名称:DevTooltips,代码行数:51,代码来源:TooltipHandler.java

示例15: canPlaceBlock

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
    public boolean canPlaceBlock(World world, int x, int y, int z, ItemStack placing, IToggleController controller)
    {
        return FluidContainerRegistry.isFilledContainer(placing) || placing.getItem() instanceof ItemBucket;
//        return placing.getItem() instanceof ItemBucket && placing.getItem() != Items.bucket;
    }
 
开发者ID:MrSpring,项目名称:ToggleBlocks,代码行数:7,代码来源:BucketToggleAction.java


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