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


Java FluidContainerRegistry类代码示例

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


FluidContainerRegistry类属于net.minecraftforge.fluids包,在下文中一共展示了FluidContainerRegistry类的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: 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

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

示例7: registerFluidContainers

import net.minecraftforge.fluids.FluidContainerRegistry; //导入依赖的package包/类
public static void registerFluidContainers()
    {
                 
  //      if (FluidRegistry.getFluid("creosote")!= null)
        		FluidContainerRegistry.registerFluidContainer(new FluidStack(FluidRegistry.getFluid("creosote"), 1000), new ItemStack(TFCPPItems.itemWoodenBucket_Creozote), new ItemStack(TFCItems.woodenBucketEmpty));

 //       if (FluidRegistry.getFluid("oil")!= null)
    		FluidContainerRegistry.registerFluidContainer(new FluidStack(FluidRegistry.getFluid("oil"), 1000), new ItemStack(TFCPPItems.itemWoodenBucket_Oil), new ItemStack(TFCItems.woodenBucketEmpty));

        FluidContainerRegistry.registerFluidContainer(new FluidStack(fluidLeachedUrainite, 1000), new ItemStack(TFCPPItems.itemRedSteelBucket_LeachedUranite), new ItemStack(TFCItems.redSteelBucketEmpty));
        FluidContainerRegistry.registerFluidContainer(new FluidStack(solutionHydrochloricAcid, 1000), new ItemStack(TFCPPItems.itemRedSteelBucket_HydrochloricAcid), new ItemStack(TFCItems.redSteelBucketEmpty));

        FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidWeakBlackSteel, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_WeakBlackSteel), new ItemStack(TFCItems.blueSteelBucketEmpty));
        FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidCarbonBlackSteel, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_CarbonBlackSteel), new ItemStack(TFCItems.blueSteelBucketEmpty));
        // if (FluidRegistry.getFluid("liquidblacksteel")!= null)
        FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidBlackSteel, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_BlackSteel), new ItemStack(TFCItems.blueSteelBucketEmpty));
        FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidPigIron, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_PigIron), new ItemStack(TFCItems.blueSteelBucketEmpty));
//        if (FluidRegistry.getFluid("liquidsteel")!= null)
        	FluidContainerRegistry.registerFluidContainer(new FluidStack(FluidRegistry.getFluid("liquidsteel"), 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_Steel), new ItemStack(TFCItems.blueSteelBucketEmpty));
        FluidContainerRegistry.registerFluidContainer(new FluidStack(fluidMundanePotion, 1000), new ItemStack(Items.potionitem,1,8192), new ItemStack(Items.glass_bottle));
        FluidContainerRegistry.registerFluidContainer(new FluidStack(fluidAwkwardPotion, 1000), new ItemStack(Items.potionitem,1,16), new ItemStack(Items.glass_bottle));

        //        FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidPigIron, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_PigIron), new ItemStack(TFCItems.blueSteelBucketEmpty));

        
    }
 
开发者ID:Wahazar,项目名称:TerraFirmaProgressivePack,代码行数:27,代码来源:TFCPPFluids.java

示例8: setupFluids

import net.minecraftforge.fluids.FluidContainerRegistry; //导入依赖的package包/类
public void setupFluids()
{
	FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(TFCFluids.OLIVEOIL.getName()), new ItemStack(TFPItems.CustomBucketOliveOil), new ItemStack(TFCItems.woodenBucketEmpty));
	
	if(Loader.isModLoaded("BuildCraft|Core"))
	{
		FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(BuildCraftEnergy.fluidOil.getName()), new ItemStack(TFPItems.CustomBucketOil), new ItemStack(TFCItems.woodenBucketEmpty));
	}
	
	if(Loader.isModLoaded("necromancy"))
	{
		FluidContainerRegistry.registerFluidContainer(new FluidStack(TFPFluids.tfpFluidBlood, 1000), new ItemStack(TFPItems.CustomBucketBlood), new ItemStack(TFCItems.woodenBucketEmpty));
		FluidContainerRegistry.registerFluidContainer(new FluidStack(TFPFluids.tfpFluidBlood, 250), ItemGeneric.getItemStackFromName("Jar of Blood"), new ItemStack(TFCItems.glassBottle));
	}
	
	if(Loader.isModLoaded("steamcraft2"))
	{
		FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(TFPFluids.tfpFluidWhaleOil.getName()), new ItemStack(TFPItems.CustomBucketWhaleOil), new ItemStack(TFCItems.woodenBucketEmpty));
	}
}
 
开发者ID:StrayWolfe,项目名称:TerrafirmaPunk-Tweaks,代码行数:21,代码来源:CommonProxy.java

示例9: init

import net.minecraftforge.fluids.FluidContainerRegistry; //导入依赖的package包/类
public static void init() {
	GameRegistry.registerItem(forceGem, "forceGem");
	GameRegistry.registerItem(liquidForceBucket, "liquidForceBucket");
	FluidContainerRegistry.registerFluidContainer(ModFluids.liquidForce, new ItemStack(liquidForceBucket), new ItemStack(Items.bucket));
	BucketHandler.buckets.put(ModBlocks.liquidForce, liquidForceBucket);
	GameRegistry.registerItem(clipboard, "clipboard");
	GameRegistry.registerItem(forceIngot, "forceIngot");
	GameRegistry.registerItem(forceNugget, "forceNugget");
       GameRegistry.registerItem(forceRod, "forceRod");
	GameRegistry.registerItem(forceStick, "forceStick");
       GameRegistry.registerItem(forceBelt, "forceBelt");
	GameRegistry.registerItem(forceMitts, "forceMitts");
	GameRegistry.registerItem(goldenPowerSource, "goldenPowerSource");
	GameRegistry.registerFuelHandler(goldenPowerSource);
       GameRegistry.registerItem(forcePack, "forcePack");
	GameRegistry.registerItem(upgradeTome, "upgradeTome");
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:18,代码来源:ModItems.java

示例10: getFluidFromItem

import net.minecraftforge.fluids.FluidContainerRegistry; //导入依赖的package包/类
public static FluidStack getFluidFromItem(ItemStack stack) {
  if (stack != null) {
    FluidStack fluidStack = null;
    if (stack.getItem() instanceof IFluidContainerItem) {
      fluidStack = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
    }
    if (fluidStack == null) {
      fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
    }
    if (fluidStack == null && Block.getBlockFromItem(stack.getItem()) instanceof IFluidBlock) {
      Fluid fluid = ((IFluidBlock) Block.getBlockFromItem(stack.getItem())).getFluid();
      if (fluid != null) {
        return new FluidStack(fluid, 1000);
      }
    }
    return fluidStack;
  }
  return null;
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:20,代码来源:FluidUtil.java

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

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

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

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

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


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