本文整理匯總了Java中net.minecraftforge.fluids.FluidContainerRegistry類的典型用法代碼示例。如果您正苦於以下問題:Java FluidContainerRegistry類的具體用法?Java FluidContainerRegistry怎麽用?Java FluidContainerRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FluidContainerRegistry類屬於net.minecraftforge.fluids包,在下文中一共展示了FluidContainerRegistry類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drain
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
@Nullable
@Override
public FluidStack drain(FluidStack resource, boolean doDrain)
{
if (container.stackSize != 1 || resource == null)
{
return null;
}
FluidStack contained = FluidContainerRegistry.getFluidForFilledItem(container);
if (contained != null && contained.isFluidEqual(resource))
{
return drain(resource.amount, doDrain);
}
return null;
}
示例2: getFuelBurn
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
@Override
public double getFuelBurn(final ItemStack item) {
if (item != null) {
if (item.getItem() == Items.ender_pearl) {
return 750.0;
}
if (item.getItem() == Items.ender_eye) {
return 3000.0;
}
if (item.getItem() == Item.getItemFromBlock((Block)ExtraUtils.enderLily)) {
return 12000.0;
}
final FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(item);
if (fluid != null && "ender".equals(fluid.getFluid().getName())) {
return fluid.amount * 6;
}
}
return 0.0;
}
示例3: onBlockActivated
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
public boolean onBlockActivated(final World worldObj, final int x, final int y, final int z, final EntityPlayer player, final int side, final float dx, final float dy, final float dz) {
if (worldObj.isRemote) {
return true;
}
final TileEntity tile = worldObj.getTileEntity(x, y, z);
if (player.getCurrentEquippedItem() != null && tile instanceof IFluidHandler) {
final ItemStack item = player.getCurrentEquippedItem();
final FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(item);
if (fluid != null && ((IFluidHandler)tile).fill(ForgeDirection.getOrientation(side), fluid, false) == fluid.amount) {
((IFluidHandler)tile).fill(ForgeDirection.getOrientation(side), fluid, true);
if (!player.capabilities.isCreativeMode) {
player.setCurrentItemOrArmor(0, item.getItem().getContainerItem(item));
}
return true;
}
}
player.openGui((Object)ExtraUtilsMod.instance, 0, worldObj, x, y, z);
return true;
}
示例4: getOveride
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
public List<String> getOveride(final ItemStack par1ItemStack, final int par2, final int par3) {
int j1 = 0;
while (j1 < this.inventorySlots.inventorySlots.size()) {
final Slot slot = (Slot) this.inventorySlots.inventorySlots.get(j1);
if (slot instanceof SlotGhostItemContainer && slot.getHasStack()) {
if (!this.func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, par2, par3) || !slot.func_111238_b()) {
return null;
}
final ItemStack filter = this.player.inventory.getStackInSlot(this.currentFilter);
if (filter != null && filter.hasTagCompound() && filter.getTagCompound().hasKey("isLiquid_" + slot.slotNumber)) {
final FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(slot.getStack());
final List t = new ArrayList();
t.add(XUHelper.getFluidName(liquid));
return (List<String>)t;
}
return null;
}
else {
++j1;
}
}
return null;
}
示例5: getUsedContainer
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
/**
* Returns the used (empty) container, for example an empty bucket
* Used, for example, in isItemValidForSlot() logic
* @param slotItem
* @return True if it is a container; False if it is null or not a container
*/
public static ItemStack getUsedContainer(ItemStack container)
{
if (FluidContainerRegistry.isBucket(container) && FluidContainerRegistry.isFilledContainer(container))
{
return new ItemStack(Items.bucket, container.stackSize);
}
else
{
container.stackSize--;
if (container.stackSize == 0)
{
return null;
}
return container;
}
}
示例6: fillTankWithContainer
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
public static boolean fillTankWithContainer(IFluidHandler tank, EntityPlayer player)
{
ItemStack stack = player.getCurrentEquippedItem();
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack);
if(liquid == null)
return false;
if(tank.fill(ForgeDirection.UNKNOWN, liquid, false) != liquid.amount && !player.capabilities.isCreativeMode)
return false;
tank.fill(ForgeDirection.UNKNOWN, liquid, true);
if(!player.capabilities.isCreativeMode)
InventoryUtils.consumeItem(player.inventory, player.inventory.currentItem);
player.inventoryContainer.detectAndSendChanges();
return true;
}
示例7: registerFluidContainers
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
public static void registerFluidContainers()
{
// if (FluidRegistry.getFluid("creosote")!= null)
FluidContainerRegistry.registerFluidContainer(new FluidStack(FluidRegistry.getFluid("creosote"), 1000), new ItemStack(TFCPPItems.itemWoodenBucket_Creozote), new ItemStack(TFCItems.woodenBucketEmpty));
// if (FluidRegistry.getFluid("oil")!= null)
FluidContainerRegistry.registerFluidContainer(new FluidStack(FluidRegistry.getFluid("oil"), 1000), new ItemStack(TFCPPItems.itemWoodenBucket_Oil), new ItemStack(TFCItems.woodenBucketEmpty));
FluidContainerRegistry.registerFluidContainer(new FluidStack(fluidLeachedUrainite, 1000), new ItemStack(TFCPPItems.itemRedSteelBucket_LeachedUranite), new ItemStack(TFCItems.redSteelBucketEmpty));
FluidContainerRegistry.registerFluidContainer(new FluidStack(solutionHydrochloricAcid, 1000), new ItemStack(TFCPPItems.itemRedSteelBucket_HydrochloricAcid), new ItemStack(TFCItems.redSteelBucketEmpty));
FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidWeakBlackSteel, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_WeakBlackSteel), new ItemStack(TFCItems.blueSteelBucketEmpty));
FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidCarbonBlackSteel, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_CarbonBlackSteel), new ItemStack(TFCItems.blueSteelBucketEmpty));
// if (FluidRegistry.getFluid("liquidblacksteel")!= null)
FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidBlackSteel, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_BlackSteel), new ItemStack(TFCItems.blueSteelBucketEmpty));
FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidPigIron, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_PigIron), new ItemStack(TFCItems.blueSteelBucketEmpty));
// if (FluidRegistry.getFluid("liquidsteel")!= null)
FluidContainerRegistry.registerFluidContainer(new FluidStack(FluidRegistry.getFluid("liquidsteel"), 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_Steel), new ItemStack(TFCItems.blueSteelBucketEmpty));
FluidContainerRegistry.registerFluidContainer(new FluidStack(fluidMundanePotion, 1000), new ItemStack(Items.potionitem,1,8192), new ItemStack(Items.glass_bottle));
FluidContainerRegistry.registerFluidContainer(new FluidStack(fluidAwkwardPotion, 1000), new ItemStack(Items.potionitem,1,16), new ItemStack(Items.glass_bottle));
// FluidContainerRegistry.registerFluidContainer(new FluidStack(liquidPigIron, 1000), new ItemStack(TFCPPItems.itemBlueSteelBucket_PigIron), new ItemStack(TFCItems.blueSteelBucketEmpty));
}
示例8: setupFluids
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
public void setupFluids()
{
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(TFCFluids.OLIVEOIL.getName()), new ItemStack(TFPItems.CustomBucketOliveOil), new ItemStack(TFCItems.woodenBucketEmpty));
if(Loader.isModLoaded("BuildCraft|Core"))
{
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(BuildCraftEnergy.fluidOil.getName()), new ItemStack(TFPItems.CustomBucketOil), new ItemStack(TFCItems.woodenBucketEmpty));
}
if(Loader.isModLoaded("necromancy"))
{
FluidContainerRegistry.registerFluidContainer(new FluidStack(TFPFluids.tfpFluidBlood, 1000), new ItemStack(TFPItems.CustomBucketBlood), new ItemStack(TFCItems.woodenBucketEmpty));
FluidContainerRegistry.registerFluidContainer(new FluidStack(TFPFluids.tfpFluidBlood, 250), ItemGeneric.getItemStackFromName("Jar of Blood"), new ItemStack(TFCItems.glassBottle));
}
if(Loader.isModLoaded("steamcraft2"))
{
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(TFPFluids.tfpFluidWhaleOil.getName()), new ItemStack(TFPItems.CustomBucketWhaleOil), new ItemStack(TFCItems.woodenBucketEmpty));
}
}
示例9: init
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
public static void init() {
GameRegistry.registerItem(forceGem, "forceGem");
GameRegistry.registerItem(liquidForceBucket, "liquidForceBucket");
FluidContainerRegistry.registerFluidContainer(ModFluids.liquidForce, new ItemStack(liquidForceBucket), new ItemStack(Items.bucket));
BucketHandler.buckets.put(ModBlocks.liquidForce, liquidForceBucket);
GameRegistry.registerItem(clipboard, "clipboard");
GameRegistry.registerItem(forceIngot, "forceIngot");
GameRegistry.registerItem(forceNugget, "forceNugget");
GameRegistry.registerItem(forceRod, "forceRod");
GameRegistry.registerItem(forceStick, "forceStick");
GameRegistry.registerItem(forceBelt, "forceBelt");
GameRegistry.registerItem(forceMitts, "forceMitts");
GameRegistry.registerItem(goldenPowerSource, "goldenPowerSource");
GameRegistry.registerFuelHandler(goldenPowerSource);
GameRegistry.registerItem(forcePack, "forcePack");
GameRegistry.registerItem(upgradeTome, "upgradeTome");
}
示例10: getFluidFromItem
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
public static FluidStack getFluidFromItem(ItemStack stack) {
if (stack != null) {
FluidStack fluidStack = null;
if (stack.getItem() instanceof IFluidContainerItem) {
fluidStack = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
}
if (fluidStack == null) {
fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
}
if (fluidStack == null && Block.getBlockFromItem(stack.getItem()) instanceof IFluidBlock) {
Fluid fluid = ((IFluidBlock) Block.getBlockFromItem(stack.getItem())).getFluid();
if (fluid != null) {
return new FluidStack(fluid, 1000);
}
}
return fluidStack;
}
return null;
}
示例11: placeBlock
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
@Override
public void placeBlock(World world, int x, int y, int z, ForgeDirection direction, EntityPlayer player,
ItemStack placing, IToggleController controller) // TODO: Add storage item index as parameter?
{
if (FluidContainerRegistry.isFilledContainer(placing))
{
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(placing);
Fluid fluid = fluidStack.getFluid();
if (fluidStack.getFluid().canBePlacedInWorld())
{
Block fluidBlock = fluid.getBlock();
world.setBlock(x, y, z, fluidBlock);
world.notifyBlockChange(x, y, z, fluidBlock);
fluidBlock.onBlockAdded(world, x, y, z);
ItemStack drainedContainer = FluidContainerRegistry.drainFluidContainer(placing);
placing.stackSize--;
controller.getStorageHandler().addItemStackToStorage(drainedContainer);
}
} else if (placing.getItem() instanceof ItemBucket)
{
ItemBucket item = (ItemBucket) placing.getItem();
item.tryPlaceContainedLiquid(world, x, y, z);
}
}
示例12: applyPlayerContainerInteraction
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
public static boolean applyPlayerContainerInteraction(final World world, final TileEntity entity, final EntityPlayer player) {
final ItemStack stack = player.getCurrentEquippedItem();
if(stack == null || !FluidContainerRegistry.isContainer(stack))
return false;
boolean update = false;
final IFluidHandler handler = (IFluidHandler)entity;
// Get the fluid from the item. If there is one they are trying
// to fill. Otherwise they are trying to remove.
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack);
if(liquid != null) {
update = FluidHelper.fillHandlerWithContainer(world, handler, player);
}
else {
liquid = handler.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
update = FluidHelper.fillContainerFromHandler(world, handler, player, liquid);
}
if(update)
world.markBlockForUpdate(entity.xCoord, entity.yCoord, entity.zCoord);
return update;
}
示例13: isItemFuel
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
@Override
protected boolean isItemFuel(ItemStack itemstack) {
FluidStack containedFluid = null;
if(itemstack.getItem() instanceof IFluidContainerItem) {
containedFluid = ((IFluidContainerItem)itemstack.getItem()).getFluid(itemstack);
}
if(containedFluid == null) {
containedFluid = FluidContainerRegistry.getFluidForFilledItem(itemstack);
}
if(containedFluid != null) {
if(containedFluid.getFluid() == fuel) {
return true;
}
return FluidUtil.testFuel(FluidRegistry.getFluidName(containedFluid));
}
return false;
}
示例14: isItemValidForSlot
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack) {
if(itemstack == null) return false;
switch(slotID) {
case 0:
FluidStack containedFluid = FluidContainerRegistry.getFluidForFilledItem(itemstack);
if(containedFluid != null && containedFluid.getFluid() == fuel) {
return true;
}
break;
case 1:
return ItemElectricBase.isElectricItem(itemstack.getItem());
}
return false;
// return (slotID == 0 && itemstack != null && itemstack.getItem() == GCItems.fuelCanister);
}
示例15: getResultFluid
import net.minecraftforge.fluids.FluidContainerRegistry; //導入依賴的package包/類
@Override
public FluidStack getResultFluid(ItemStack inIS, FluidStack inFS, int sealedTime)
{
if(recipeOutFluid != null)
{
FluidStack fs = recipeOutFluid.copy();
FluidStack itemLiquid = FluidContainerRegistry.getFluidForFilledItem(inIS);
if(!removesLiquid)
{
fs.amount = inFS.amount+itemLiquid.amount;
}
else
{
fs.amount = ( fs.amount * inFS.amount ) / recipeFluid.amount;
}
return fs;
}
return null;
}