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


Java FluidUtil.getFilledBucket方法代码示例

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


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

示例1: onFillBucket

import net.minecraftforge.fluids.FluidUtil; //导入方法依赖的package包/类
@SubscribeEvent
public void onFillBucket(FillBucketEvent event) {
    RayTraceResult rtr = event.getTarget();
    if (rtr != null) {
        Block b = event.getWorld().getBlockState(rtr.getBlockPos()).getBlock();
        if (b instanceof IFluidBlock) {
            Fluid fluid = ((IFluidBlock) b).getFluid();
            ItemStack filled = FluidUtil.getFilledBucket(new FluidStack(fluid, 1000));
            if (!filled.isEmpty()) {
                event.setFilledBucket(FluidUtil.getFilledBucket(new FluidStack(fluid, 1000)));
                event.getWorld().setBlockToAir(rtr.getBlockPos());
                event.setResult(Result.ALLOW);
                if (TileEntityRefinery.isInputFluidValid(fluid, 4) && event.getEntityPlayer() instanceof EntityPlayerMP) {
                    AdvancementTriggers.OIL_BUCKET.trigger((EntityPlayerMP) event.getEntityPlayer());
                }
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:EventHandlerPneumaticCraft.java

示例2: matches

import net.minecraftforge.fluids.FluidUtil; //导入方法依赖的package包/类
@Override
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
	boolean foundSyringe = false;
	boolean foundBucket = false;

	ItemStack bucket = FluidUtil.getFilledBucket(new FluidStack(ModBlocks.FLUID_MANA.getFluid(), 1));

	for (int i = 0; i < inv.getSizeInventory(); i++) {
		ItemStack stack = inv.getStackInSlot(i);
		if (stack.getItem() == ModItems.SYRINGE && stack.getItemDamage() == 0) {
				foundSyringe = true;
		}
		if (ItemStack.areItemStacksEqual(bucket, stack))
			foundBucket = true;
	}
	return foundSyringe && foundBucket;
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:18,代码来源:RecipeManaSyringe.java

示例3: matches

import net.minecraftforge.fluids.FluidUtil; //导入方法依赖的package包/类
@Override
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
	boolean foundSyringe = false;
	boolean foundMana = false;
	boolean foundNacre = false;
	boolean foundLava = false;
	boolean foundDevilDust = false;

	ItemStack mana = FluidUtil.getFilledBucket(new FluidStack(ModBlocks.FLUID_MANA.getFluid(), 1));
	ItemStack nacre = FluidUtil.getFilledBucket(new FluidStack(ModBlocks.FLUID_NACRE.getFluid(), 1));

	for (int i = 0; i < inv.getSizeInventory(); i++) {
		ItemStack stack = inv.getStackInSlot(i);
		if (stack.getItem() == ModItems.SYRINGE && stack.getItemDamage() == 0) foundSyringe = true;
		if (ItemStack.areItemStacksEqual(mana, stack)) foundMana = true;
		if (ItemStack.areItemStacksEqual(nacre, stack)) foundNacre = true;
		if (stack.getItem() == Items.LAVA_BUCKET) foundLava = true;
		if (stack.getItem() == ModItems.DEVIL_DUST) foundDevilDust = true;
	}
	return foundSyringe && foundMana && foundDevilDust && foundLava && foundNacre;
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:22,代码来源:RecipeSteroidSyringe.java

示例4: phaseBucket

import net.minecraftforge.fluids.FluidUtil; //导入方法依赖的package包/类
public static ItemStack phaseBucket(Block block)
{
	if(block instanceof BlockLiquid || block instanceof IFluidBlock)
	{
		Fluid fluid = block instanceof BlockLiquid ? FluidRegistry.lookupFluidForBlock(block) : ((IFluidBlock)block).getFluid();
		if(fluid == null)
			return new ItemStack(block);
		ItemStack stack = FluidUtil.getFilledBucket(new FluidStack(fluid, 1000));
		return stack.isEmpty() ? new ItemStack(block) : stack; 
	}
	
	return new ItemStack(block);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:14,代码来源:HarshenUtils.java

示例5: getMatchingStacks

import net.minecraftforge.fluids.FluidUtil; //导入方法依赖的package包/类
@Override
public ItemStack[] getMatchingStacks()
{
	if (cachedStacks == null)
	{
		cachedStacks = new ItemStack[] { FluidUtil.getFilledBucket(fluid) };
	}
	return this.cachedStacks;
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:10,代码来源:IngredientFluidStack.java

示例6: getFilledBucket

import net.minecraftforge.fluids.FluidUtil; //导入方法依赖的package包/类
private ItemStack getFilledBucket(FluidStack fluid) {
	for (Pair<FluidStack, ItemStack> e : buckets) {
		if (e.getLeft().isFluidEqual(fluid))
			return e.getRight();
	}

	return FluidUtil.getFilledBucket(fluid);
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:9,代码来源:ContainerBucketFillHandler.java

示例7: getItemStack

import net.minecraftforge.fluids.FluidUtil; //导入方法依赖的package包/类
@Override
public ItemStack getItemStack() {
    return tank.getFluid() == null ? new ItemStack(Items.BUCKET) : FluidUtil.getFilledBucket(tank.getFluid());
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:5,代码来源:BlackHoleTankTile.java

示例8: ComponentStructureList

import net.minecraftforge.fluids.FluidUtil; //导入方法依赖的package包/类
public ComponentStructureList(Structure structure) {
	super(0, 0, 200, 300);
	Deque<Block> sorted = new ArrayDeque<>();
	HashMap<Block, Integer> ingredients = new HashMap<>();
	HashMap<Block, IBlockState> access = new HashMap<>();

	for (Template.BlockInfo info : structure.blockInfos()) {
		if (info.blockState.getBlock() == Blocks.AIR) continue;

		ingredients.putIfAbsent(info.blockState.getBlock(), 0);
		ingredients.put(info.blockState.getBlock(), ingredients.get(info.blockState.getBlock()) + 1);
		access.putIfAbsent(info.blockState.getBlock(), info.blockState);

		if (!sorted.contains(info.blockState.getBlock())) sorted.add(info.blockState.getBlock());
	}


	ComponentVoid recipe = new ComponentVoid(0, 0, 200, 300);
	recipe.getTransform().setScale(2);
	add(recipe);

	ComponentText text = new ComponentText(0, 3, ComponentText.TextAlignH.LEFT, ComponentText.TextAlignV.TOP);
	text.setSize(new Vec2d(200, 16));
	text.getText().setValue(" " + LibrarianLib.PROXY.translate("wizardry.misc.structure_materials"));
	recipe.add(text);

	ComponentSprite lineBreak = new ComponentSprite(BookGui.LINE_BREAK, (int) (getSize().getX() / 2.0 - 177.0 / 2.0), 30, 177, 2);
	add(lineBreak);

	int i = 0;
	int row = 0;
	while (!sorted.isEmpty() && sorted.peek() != null) {

		Block nextBlock = sorted.pop();
		ItemStack stack;
		if (FluidRegistry.lookupFluidForBlock(nextBlock) != null) {
			stack = FluidUtil.getFilledBucket(new FluidStack(FluidRegistry.lookupFluidForBlock(nextBlock), 1));
			stack = new ItemStack(stack.getItem(), ingredients.get(nextBlock), stack.getMetadata(), stack.getTagCompound());
		} else {
			NonNullList<ItemStack> itemStacks = NonNullList.create();
			nextBlock.getDrops(itemStacks, structure.getBlockAccess(), null, access.get(nextBlock), 0);
			if (itemStacks.isEmpty())
				stack = new ItemStack(nextBlock, ingredients.get(nextBlock));
			else {
				stack = itemStacks.get(0);
				stack.setCount(ingredients.get(nextBlock));
			}
		}

		ComponentStack componentStack = new ComponentStack(i * 16, 20 + row * 16);
		componentStack.getStack().setValue(stack);
		recipe.add(componentStack);

		if (i++ > 4) {
			i = 0;
			row++;
		}
	}
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:60,代码来源:ComponentStructureList.java


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