本文整理汇总了Java中net.minecraftforge.fluids.UniversalBucket类的典型用法代码示例。如果您正苦于以下问题:Java UniversalBucket类的具体用法?Java UniversalBucket怎么用?Java UniversalBucket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UniversalBucket类属于net.minecraftforge.fluids包,在下文中一共展示了UniversalBucket类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFluid
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
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());
}
}
示例2: preInit
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
@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);
}
}
示例3: getRemainingItems
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
@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;
}
示例4: init
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的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;
}
示例5: init
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
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);
}
示例6: getLiquidFromStack
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
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);
}
示例7: getOutPutItem
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
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;
}
示例8: getFill
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
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);
}
示例9: apply
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
@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;
}
示例10: createBuckets
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
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)));
}
}
}
示例11: register
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
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
));
}
示例12: ParticleItem
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
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;
}
}
示例13: getTabIconItem
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public Item getTabIconItem() {
return UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, ModFluids.HNO3HCL).getItem();
}
示例14: getBucketStack
import net.minecraftforge.fluids.UniversalBucket; //导入依赖的package包/类
public static ItemStack getBucketStack(Fluid fluid)
{
return UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, fluid);
}