本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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;
}