Java 类net.minecraftforge.fluids.UniversalBucket 实例源码

项目:CustomWorldGen    文件:FluidBucketWrapper.java   
protected void setFluid(Fluid fluid) {
    if (fluid == null)
    {
        container.deserializeNBT(new ItemStack(Items.BUCKET).serializeNBT());
    }
    else if (fluid == FluidRegistry.WATER)
    {
        container.deserializeNBT(new ItemStack(Items.WATER_BUCKET).serializeNBT());
    }
    else if (fluid == FluidRegistry.LAVA)
    {
        container.deserializeNBT(new ItemStack(Items.LAVA_BUCKET).serializeNBT());
    }
    else if (fluid.getName().equals("milk"))
    {
        container.deserializeNBT(new ItemStack(Items.MILK_BUCKET).serializeNBT());
    }
    else if (FluidRegistry.isUniversalBucketEnabled() && FluidRegistry.getBucketFluids().contains(fluid))
    {
        ItemStack filledBucket = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, fluid);
        container.deserializeNBT(filledBucket.serializeNBT());
    }
}
项目:CustomWorldGen    文件:ForgeModContainer.java   
@Subscribe
public void preInit(FMLPreInitializationEvent evt)
{
    CapabilityItemHandler.register();
    CapabilityFluidHandler.register();
    CapabilityAnimation.register();
    CapabilityEnergy.register();
    MinecraftForge.EVENT_BUS.register(MinecraftForge.INTERNAL_HANDLER);
    ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory());
    MinecraftForge.EVENT_BUS.register(this);

    if (!ForgeModContainer.disableVersionCheck)
    {
        ForgeVersion.startVersionCheck();
    }

    // Add and register the forge universal bucket, if it's enabled
    if(FluidRegistry.isUniversalBucketEnabled())
    {
        universalBucket = new UniversalBucket();
        universalBucket.setUnlocalizedName("forge.bucketFilled");
        GameRegistry.registerItem(universalBucket, "bucketFilled");
        MinecraftForge.EVENT_BUS.register(universalBucket);
    }
}
项目:Wizardry    文件:RecipeShapelessFluid.java   
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
    NonNullList<ItemStack> remains = super.getRemainingItems(inv);
    for (int i = 0; i < remains.size(); i++)
    {
        ItemStack stack = inv.getStackInSlot(i);
        ItemStack remain = remains.get(i);
        if (!stack.isEmpty() && remain.isEmpty() && stack.getItem() instanceof UniversalBucket)
        {
            ItemStack empty = ((UniversalBucket) stack.getItem()).getEmpty();
            if (!empty.isEmpty())
                remains.set(i, empty.copy());
        }
    }
    return remains;
}
项目:PowerAdvantageAPI    文件:Fuels.java   
public static void init(){
    if(initDone) return;

    FuelRegistry.getInstance().registerFuel(cyano.basemetals.init.Items.carbon_powder,(short)1600);
    ItemStack bucket = new ItemStack(ForgeModContainer.getInstance().universalBucket);


    FuelRegistry.getInstance().registerFuel(ForgeModContainer.getInstance().universalBucket,(ItemStack ub)->{
        if(ub.getItem() instanceof UniversalBucket){
            UniversalBucket ubItem = (UniversalBucket) ub.getItem();
            FluidStack fs = ubItem.getFluid(ub);
            if (fs != null && fs.amount > 0){
                if(fs.getFluid() == Fluids.crude_oil) return (short)(fs.amount * CRUDE_OIL_FUEL_PER_FLUID_UNIT);
                if(fs.getFluid() == Fluids.refined_oil) return (short)(fs.amount * REFINED_OIL_FUEL_PER_FLUID_UNIT);
            }
        }
        return (short)0;
    });

    FuelRegistry.getInstance().registerPostBurnItem(ForgeModContainer.getInstance().universalBucket,(ItemStack sb)->new ItemStack(net.minecraft.init.Items.BUCKET));


    initDone = true;
}
项目:PowerOfMagic    文件:PMFluidRegistry.java   
public static void init() {

        liquidMana = registerFluid(liquidMana);
        liquidWaterSource = registerFluid(liquidWaterSource);
        liquidGrass = registerFluid(liquidGrass);
        liquidFire = registerFluid(liquidFire);

        FluidRegistry.addBucketForFluid(liquidMana);
        FluidRegistry.addBucketForFluid(liquidWaterSource);
        FluidRegistry.addBucketForFluid(liquidGrass);
        FluidRegistry.addBucketForFluid(liquidFire);

        bucketMana = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, liquidMana);
        bucketFire = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, liquidFire);
        bucketGrass = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, liquidGrass);
        bucketWaterSource = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, liquidWaterSource);

        bucketMana.getItem().setCreativeTab(powerofmagic.tabpowerofmagic);
        bucketFire.getItem().setCreativeTab(powerofmagic.tabpowerofmagic);
        bucketGrass.getItem().setCreativeTab(powerofmagic.tabpowerofmagic);
        bucketWaterSource.getItem().setCreativeTab(powerofmagic.tabpowerofmagic);
    }
项目:harshencastle    文件:HarshenRegistry.java   
public static CauldronLiquid getLiquidFromStack(ItemStack key)
{
    if(key.getItem() instanceof UniversalBucket && FluidStack.loadFluidStackFromNBT(key.getTagCompound()) != null &&
            FORGE_BUCKET_MAP.containsKey(FluidStack.loadFluidStackFromNBT(key.getTagCompound()).getFluid()))
        return FORGE_BUCKET_MAP.get(FluidStack.loadFluidStackFromNBT(key.getTagCompound()).getFluid());
    return HarshenUtils.getObjectFromItemMap(HarshenUtils.getObjectFromItemMap(INPUT_MAP, key) != null ? INPUT_MAP : ITEMLIQUID_MAP, key);
}
项目:harshencastle    文件:HarshenRegistry.java   
public static ItemStack getOutPutItem(ItemStack inputItem, CauldronLiquid liquid)
{
    if((inputItem.getItem() instanceof UniversalBucket) && FORGE_BUCKET_MAP.containsValue(liquid))
        return new ItemStack(Items.BUCKET);
    else
        for(CauldronLiquid l : OUTPUT_MAP.keySet())
            if(l == liquid)
                return OUTPUT_MAP.get(l).copy(); 
    return ItemStack.EMPTY;
}
项目:harshencastle    文件:HarshenRegistry.java   
public static int getFill(ItemStack stack)
{
    if(stack.getItem() instanceof UniversalBucket)
        return FORGE_INPUT_AMOUNT.get(FluidStack.loadFluidStackFromNBT(stack.getTagCompound()).getFluid());
    for(ItemStack stack1 : ITEMLIQUID_MAP.keySet())
        if(stack1.isItemEqual(stack))
            return 64;
    return HarshenUtils.getObjectFromItemMap(INPUT_FILLBY, stack);
}
项目:harshencastle    文件:HarshenGlassContainerIngredient.java   
@Override
public boolean apply(ItemStack p_apply_1_) {
    if (p_apply_1_ == null)
           return false;
       else
        for (ItemStack itemstack : this.getMatchingStacks())
            if (itemstack.getItem() == p_apply_1_.getItem())
                if (itemstack.getMetadata() == 32767 || itemstack.getMetadata() == p_apply_1_.getMetadata())
                    return itemstack.getItem() instanceof UniversalBucket ? 
                            FluidStack.loadFluidStackFromNBT(itemstack.getTagCompound()).getFluid() ==  FluidStack.loadFluidStackFromNBT(p_apply_1_.getTagCompound()).getFluid(): true;

    return false;
}
项目:CrystalMod    文件:ModFluids.java   
public static void createBuckets() {
    for(Fluid fluid : bucketFluids){
        if (FluidRegistry.isUniversalBucketEnabled()) {
            FluidRegistry.addBucketForFluid(fluid);
            bucketList.put(fluid, UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, fluid));
        } else {
            bucketList.put(fluid, new ItemStack(ItemBucketCrystalMod.create(null, fluid)));
        }
    }
}
项目:Mekfarm    文件:DungBlock.java   
public void register() {
    GameRegistry.register(this);
    GameRegistry.register(new ItemBlock(this), this.getRegistryName());

    CraftingManager.getInstance().addRecipe(new ShapedOreRecipe(
            new ItemStack(Item.getItemFromBlock(this), 9),
            "hs",
            "wc",
            'h', Blocks.HAY_BLOCK,
            's', UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, FluidsRegistry.sewage),
            'c', Blocks.CLAY,
            'w', Items.WATER_BUCKET
    ));
}
项目:harshencastle    文件:ParticleItem.java   
public ParticleItem(World world, double xCoordIn, double yCoordIn, double zCoordIn, double motionXIn,
        double motionYIn, double motionZIn, float par14, boolean disableMoving, ItemStack stack) {
    super(world, xCoordIn, yCoordIn, zCoordIn, motionXIn, motionYIn, motionZIn, par14, disableMoving);
    this.setParticleTexture(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(stack.getItem(), stack.getMetadata()));
    if(stack.getItem() instanceof ItemBlock)
        this.setParticleTexture(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(((ItemBlock)stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata())));
    if(stack.getItem() instanceof UniversalBucket)
        if(new Random().nextBoolean())
            this.setParticleTexture(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(((UniversalBucket)stack.getItem()).getFluid(stack).getFluid().getBlock().getDefaultState()));
        else
            this.setParticleTexture(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(Items.BUCKET));
    if(stack.getItem() instanceof ItemBed)
    {
        fxLayer = 3;
        setLocation(new ResourceLocation("textures/entity/bed/" + EnumDyeColor.byMetadata(stack.getMetadata()).getName() + ".png"));
        return;
    }
    List<BakedQuad> quadList = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, Minecraft.getMinecraft().player).getQuads((IBlockState)null, (EnumFacing)null, 0L);
    int i = 0;
    boolean flag = !stack.isEmpty();
    boolean flag2 = false;
    ArrayList<Integer> colors = new ArrayList<Integer>();
    for (int j = quadList.size(); i < j; ++i)
       {
           BakedQuad bakedquad = quadList.get(i);
           int k = -1;
           if (flag && bakedquad.hasTintIndex())
           {
            flag2 = true;
               k = Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, bakedquad.getTintIndex());
               if (EntityRenderer.anaglyphEnable)
                   k = TextureUtil.anaglyphColor(k);

               k = k | -16777216;
               colors.add(k);
           }
       }
    if(flag2)
    {
        int color = colors.get(new Random().nextInt(colors.size()));
        this.particleRed = ((color >> 16) & 0xFF) * 255;
        this.particleGreen = ((color >> 8) & 0xFF) * 255;
        this.particleBlue = ((color >> 0) & 0xFF) * 255;
    }
}
项目:AquaRegia    文件:CreativeTabAquaRegia.java   
@SideOnly(Side.CLIENT)
@Override
public Item getTabIconItem() {
    return UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, ModFluids.HNO3HCL).getItem();
}
项目:ExNihiloAdscensio    文件:Util.java   
public static ItemStack getBucketStack(Fluid fluid)
{
    return UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, fluid);
}