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


Java FluidContainerRegistry.isContainer方法代碼示例

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


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

示例1: applyPlayerContainerInteraction

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

        final ItemStack stack = player.getCurrentEquippedItem();
        if(stack == null || !FluidContainerRegistry.isContainer(stack))
        	return false;

		boolean update = false;
		final IFluidHandler handler = (IFluidHandler)entity;
		
		// Get the fluid from the item.  If there is one they are trying
		// to fill.  Otherwise they are trying to remove.
        FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack);
        if(liquid != null) {
        	update = FluidHelper.fillHandlerWithContainer(world, handler, player);
        }
        else {
        	liquid = handler.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
        	update = FluidHelper.fillContainerFromHandler(world, handler, player, liquid);
        }

        if(update)
            world.markBlockForUpdate(entity.xCoord, entity.yCoord, entity.zCoord);
		
		return update;
	}
 
開發者ID:OreCruncher,項目名稱:ThermalRecycling,代碼行數:26,代碼來源:FluidStackHelper.java

示例2: onBlockActivated

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {

    TileEntity tileEntity = worldIn.getTileEntity(pos);
    if (tileEntity == null || playerIn.isSneaking()) {
        return false;
    }

    if (worldIn.isRemote) {
        return true;
    }

    ItemStack item = playerIn.getHeldItemMainhand();
    if (item != null && FluidContainerRegistry.isContainer(item)) {
        IFluidTankBlock te = (IFluidTankBlock) tileEntity;
        FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(item);
        if (fluid != null && fluid.getFluid() == FluidRegistry.WATER) {
            if (te.getTank().getFluidAmount() <= 0 && te.getTank().getCapacity() >= fluid.amount) {
                // В пустой танк
                te.getTank().setFluid(fluid);
                FluidHelper.bucktDrain(playerIn, item, worldIn);
                return true;
            } else if (te.getTank().getFluid().getFluid().equals(fluid.getFluid())
                    && (te.getTank().getFluidAmount() + fluid.amount) <= te.getTank().getCapacity()) {
                //В не пустой танк
                te.getTank().fill(fluid, true);
                FluidHelper.bucktDrain(playerIn, item, worldIn);
                tileEntity.markDirty();
                return true;
            } else {
                return false;
            }
        }
    }
    playerIn.openGui(Nord.instance, 2, worldIn, pos.getX(), pos.getY(), pos.getZ());
    return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
}
 
開發者ID:Dark32,項目名稱:NordMod,代碼行數:38,代碼來源:BlockWasher.java

示例3: isItemValidForSlot

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

	return false;
}
 
開發者ID:Microsoft,項目名稱:vsminecraft,代碼行數:11,代碼來源:TileEntityPortableTank.java

示例4: isItemValidForSlot

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
    if (stack.getItem() instanceof ItemAdventureBackpack || Block.getBlockFromItem(stack.getItem()) instanceof BlockAdventureBackpack)
    {
        return false;
    }
    if (slot == 6 || slot == 8)
    {
        return FluidContainerRegistry.isContainer(stack);
    }

    return !(slot == 0 || slot == 3) || SlotTool.isValidTool(stack);
}
 
開發者ID:Darkona,項目名稱:AdventureBackpack2,代碼行數:15,代碼來源:TileAdventureBackpack.java

示例5: isItemValidForSlot

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
    if (stack.getItem() instanceof ItemAdventureBackpack || Block.getBlockFromItem(stack.getItem()) instanceof BlockAdventureBackpack)
    {
        return false;
    }
    if (slot == Constants.bucketInRight || slot == Constants.bucketInLeft)
    {
        return FluidContainerRegistry.isContainer(stack);
    }

    return !(slot == Constants.upperTool || slot == Constants.lowerTool) || SlotTool.isValidTool(stack);
}
 
開發者ID:Darkona,項目名稱:AdventureBackpack2,代碼行數:15,代碼來源:InventoryBackpack.java

示例6: canSmelt

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
/**
 * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc.
 */
private boolean canSmelt()
{
    if (this.getFurnaceItemStack(0) == null)
    {
        return false;
    }
    else
    {
    	ItemStack cur0 = this.getFurnaceItemStack(0);
    	ItemStack cur = this.getFurnaceItemStack(2);
        FluidStack fluidstack = FluidHeatRecipes.heating().getHeatingResultF(cur0);
        if (fluidstack == null) return false;
        if (cur == null) return false;
        if (FluidContainerRegistry.isContainer(cur) && (FluidContainerRegistry.isEmptyContainer(cur) || FluidContainerRegistry.containsFluid(cur, fluidstack))) return true;
        if (cur0.getItem() instanceof IFluidContainerItem && cur.getItem() instanceof IFluidContainerItem)
        {
        	FluidStack stack = ((IFluidContainerItem)cur0.getItem()).drain(cur0, 100, false);
        	if(stack != null && stack.amount == 100)
        		return true;
        	return false;
        }
        else if(cur.getItem() instanceof IFluidContainerItem)
        {
        	return ((IFluidContainerItem)cur.getItem()).fill(cur0, fluidstack, false) != 0;
        }
        return false;
    }
}
 
開發者ID:nolimet,項目名稱:SciAPI,代碼行數:32,代碼來源:MultiFluidHeater.java

示例7: valid

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
public static boolean valid(ItemStack stack)
{
    return ((stack != null) && (FluidContainerRegistry.isContainer(stack)));
}
 
開發者ID:Darkona,項目名稱:AdventureBackpack2,代碼行數:5,代碼來源:SlotFluid.java

示例8: isItemValid

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean isItemValid(ItemStack stack)
{
    return ((stack != null) && (FluidContainerRegistry.isContainer(stack)));
}
 
開發者ID:Darkona,項目名稱:AdventureBackpack2,代碼行數:6,代碼來源:SlotFluid.java

示例9: addFinalValues

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
private static void addFinalValues() {
    // Fluid handling
    for (Item item : GameData.getItemRegistry().typeSafeIterable()) {
        LinkedList<ItemStack> subItems = Lists.newLinkedList();

        try {
            item.getSubItems(item, item.getCreativeTab(), subItems);
        } catch (Exception ignore) {}

        for (ItemStack itemStack : subItems) {
            if (FluidContainerRegistry.isContainer(itemStack)) {
                FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(itemStack);
                ItemStack empty = FluidContainerRegistry.drainFluidContainer(itemStack);

                if (fluidStack != null && empty != null) {
                    setEMC(itemStack, getEMC(empty) + getEMC(fluidStack.getFluid()));
                }
            }
        }
    }

    // Stone brick handling
    double stoneBrickEmc = getEMC(Blocks.stonebrick);
    for (int i = 1; i < BlockStoneBrick.field_150141_b.length; i++) {
        setEMC(new ItemStack(Blocks.stonebrick, 1, i), stoneBrickEmc);
    }

    // Anvil handling
    double anvilEmc = getEMC(new ItemStack(Blocks.anvil, 1, 0));
    setEMC(new ItemStack(Blocks.anvil, 1, 1), anvilEmc * 0.66D);
    setEMC(new ItemStack(Blocks.anvil, 1, 2), anvilEmc * 0.33D);

    // Name tag
    double string = getEMC(Items.string);
    double paper = getEMC(Items.paper);
    setEMC(Items.name_tag, string + paper);

    if (Loader.isModLoaded("Thaumcraft")) {
        setEMC(GameRegistry.findItem("Thaumcraft", "ItemThaumonomicon"), getEMC(Blocks.bookshelf));
    }
}
 
開發者ID:AgileMods,項目名稱:MateriaMuto,代碼行數:42,代碼來源:EMCRegistry.java

示例10: isPlayerHoldingFluidContainer

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
/**
 * Determine if a player is holding a registered Fluid Container.
 */
public static final boolean isPlayerHoldingFluidContainer(EntityPlayer player) {

	return FluidContainerRegistry.isContainer(player.getCurrentEquippedItem());
}
 
開發者ID:PaleoCrafter,項目名稱:R0b0ts,代碼行數:8,代碼來源:ItemHelper.java

示例11: isItemValidForSlot

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean isItemValidForSlot(int slot, ItemStack item) {
	if (slot == 3) return FluidContainerRegistry.isContainer(item);
	return slot == 2 ? false : (slot == 1 ? getItemFreezeTime(item) > 0 : true);
}
 
開發者ID:AlexDGr8r,項目名稱:MeteorsMod,代碼行數:6,代碼來源:TileEntityFreezingMachine.java

示例12: canInsertItem

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean canInsertItem(int slot, ItemStack item, int side) {
	return FluidContainerRegistry.isContainer(item) ? slot == 3 : slot == 1;
}
 
開發者ID:AlexDGr8r,項目名稱:MeteorsMod,代碼行數:5,代碼來源:TileEntityFreezingMachine.java

示例13: isItemValidForSlot

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
	return FluidContainerRegistry.isContainer(itemstack) || (itemstack != null && itemstack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) itemstack.getItem()).getFluid(itemstack) != null);
}
 
開發者ID:ExtraCells,項目名稱:ExtraCells1,代碼行數:6,代碼來源:ECPrivateInventory.java

示例14: isValidContainer

import net.minecraftforge.fluids.FluidContainerRegistry; //導入方法依賴的package包/類
/**
 * Test for any container type at all
 * 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 boolean isValidContainer(ItemStack slotItem)
{
	return slotItem != null && slotItem.stackSize == 1 && (slotItem.getItem() instanceof ItemCanisterGeneric || FluidContainerRegistry.isContainer(slotItem));
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:11,代碼來源:FluidUtil.java


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