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


Java ForgeModContainer.getInstance方法代码示例

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


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

示例1: getFluid

import net.minecraftforge.common.ForgeModContainer; //导入方法依赖的package包/类
@Nullable
public FluidStack getFluid()
{
    Item item = container.getItem();
    if (item == Items.WATER_BUCKET)
    {
        return new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME);
    }
    else if (item == Items.LAVA_BUCKET)
    {
        return new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME);
    }
    else if (item == Items.MILK_BUCKET)
    {
        return FluidRegistry.getFluidStack("milk", Fluid.BUCKET_VOLUME);
    }
    else if (item == ForgeModContainer.getInstance().universalBucket)
    {
        return ForgeModContainer.getInstance().universalBucket.getFluid(container);
    }
    else
    {
        return null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:FluidBucketWrapper.java

示例2: init

import net.minecraftforge.common.ForgeModContainer; //导入方法依赖的package包/类
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;
}
 
开发者ID:cyanobacterium,项目名称:PowerAdvantageAPI,代码行数:25,代码来源:Fuels.java

示例3: isItemValidForSlot

import net.minecraftforge.common.ForgeModContainer; //导入方法依赖的package包/类
@Override
public boolean isItemValidForSlot(final int slot, final ItemStack item) {
	if(this.getInventory() == null) return false;
	if(slot >= this.getInventory().length) return false;
	if(item.getItem() == ForgeModContainer.getInstance().universalBucket) return true;
	return FluidContainerRegistry.isFilledContainer(item)
			&& FluidContainerRegistry.getFluidForFilledItem(item) != null; 
}
 
开发者ID:cyanobacterium,项目名称:PowerAdvantageAPI,代码行数:9,代码来源:MetalTankTileEntity.java

示例4: getBurnTimePerBucketFor

import net.minecraftforge.common.ForgeModContainer; //导入方法依赖的package包/类
private static Float getBurnTimePerBucketFor(Fluid fluid){
	if(fluid == null) return 0f;
	if(flammibilityCache.containsKey(fluid)){
		return flammibilityCache.get(fluid)*1000;
	} else {
		// first, check configured overrides
		if(SteamAdvantage.fluidBurnValues.containsKey(fluid.getUnlocalizedName())){
			Float fuelPerBucket = SteamAdvantage.fluidBurnValues.get(fluid.getUnlocalizedName());
			flammibilityCache.put(fluid,0.001F*fuelPerBucket);
			return fuelPerBucket;
		}
		// second, check universal bucket fuel registry
		ItemStack bucket = new ItemStack(ForgeModContainer.getInstance().universalBucket);
		int vol = ForgeModContainer.getInstance().universalBucket.getCapacity(bucket);
		ForgeModContainer.getInstance().universalBucket.fill(bucket,new FluidStack(fluid,vol),true);
		Float burnTicksPerAmount = (float) FuelRegistry.getActualBurntimeForItem(bucket) / (float) vol;
		if(burnTicksPerAmount > 0){
			flammibilityCache.put(fluid,burnTicksPerAmount);
			return 1000*burnTicksPerAmount;
		}

		// third, deprecated fluid container registry
		FluidContainerRegistry.FluidContainerData[] registry = FluidContainerRegistry.getRegisteredFluidContainerData();
		for(FluidContainerRegistry.FluidContainerData datum : registry){
			if(datum.fluid.getFluid() == fluid){
				if(FuelRegistry.getActualBurntimeForItem(datum.filledContainer) > 0){
					vol = FluidContainerRegistry.getContainerCapacity(datum.filledContainer);
					Float fuelPerVolume = (float)FuelRegistry.getActualBurntimeForItem(datum.filledContainer) / (float)vol;
					flammibilityCache.put(fluid,fuelPerVolume);
					return 1000*fuelPerVolume;
				}
			}
		}

		// it just isn't a fuel
		flammibilityCache.put(fluid,0f);
	}
	// no containers (buckets) for this fluid
	return 0f;


}
 
开发者ID:cyanobacterium,项目名称:SteamAdvantage,代码行数:43,代码来源:OilBoilerTileEntity.java


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