當前位置: 首頁>>代碼示例>>Java>>正文


Java ItemBucket類代碼示例

本文整理匯總了Java中net.minecraft.item.ItemBucket的典型用法代碼示例。如果您正苦於以下問題:Java ItemBucket類的具體用法?Java ItemBucket怎麽用?Java ItemBucket使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ItemBucket類屬於net.minecraft.item包,在下文中一共展示了ItemBucket類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: placeFluid

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
boolean placeFluid(PumpCoord pc, Fluid fluid) {
    at.w = worldObj;
    at.set(pc.pos);
    if (!at.isReplacable()) return false;
    Block block = fluid.getBlock();
    if (block == null) return false;
    if (drainBlock(pc, false) != null) return false;
    if (block == Blocks.water) block = Blocks.flowing_water;
    else if (block == Blocks.lava) block = Blocks.flowing_lava;
    
    if (block == Blocks.flowing_water) {
        ((ItemBucket) Items.water_bucket).tryPlaceContainedLiquid(at.w, pos);
    } else {
        // NORELEASE: Is there a 1.8-ish way of placing fluid blocks now?
        at.setIdMd(block, block instanceof BlockFluidFinite ? 0xF : 0, true);
    }
    buffer.setFluid(null);
    at.notifyBlockChange();
    return true;
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:21,代碼來源:PumpLiquids.java

示例2: placeBlock

import net.minecraft.item.ItemBucket; //導入依賴的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);
    }
}
 
開發者ID:MrSpring,項目名稱:ToggleBlocks,代碼行數:25,代碼來源:BucketToggleAction.java

示例3: addToWhiteList

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
public final static boolean addToWhiteList(String id){
	String[] parts = id.split(":", 4);
	if(parts.length < 1)
		return false;
	ItemStack stack = GameRegistry.findItemStack(parts.length==1 ? "minecraft" : parts[0], parts.length==1 ? parts[0] : parts[1], 1);
	if(stack == null)
		return false;
	if((stack.getItem() instanceof ItemBlock) || (stack.getItem() instanceof ItemPotion) || (stack.getItem() instanceof ItemArmor) || (stack.getItem() instanceof ItemBucket))
		return false;
	int meta=OreDictionary.WILDCARD_VALUE;
	if(parts.length >= 3){
		try{
			meta=Integer.parseInt(parts[2]);
		}catch(NumberFormatException e){
			meta=OreDictionary.WILDCARD_VALUE;
		}
	}
	return addToWhiteList(new ItemData(stack.getItem(), meta));
}
 
開發者ID:AnimeniacYuuto,項目名稱:InventoryTools,代碼行數:20,代碼來源:ToolBoxRegistry.java

示例4: initializeItems

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
public static void initializeItems(){
	
	timeToolMaterial = EnumHelper.addToolMaterial("timeToolMaterial", 6, 1620, 8.0F, 4.0F, 7);
	pheromoneArmor = EnumHelper.addArmorMaterial("pheromoneArmor", 12, new int[]{2, 4, 2, 1}, 9);

	fossil_Shard = new Item().setUnlocalizedName("iat.fossil_Shard").setTextureName("iat:fossil").setCreativeTab(ItsAboutTime.iatTab);
	rockPick = new ItemRockPick().setUnlocalizedName("iat.rockPick").setTextureName("iat:rockPick").setCreativeTab(ItsAboutTime.iatTab);
	fossil_Broken = new ItemFossilBroken().setUnlocalizedName("iat.fossil_Broken").setCreativeTab(ItsAboutTime.iatTab);
	fossil = new ItemFossil().setUnlocalizedName("iat.fossil").setCreativeTab(ItsAboutTime.iatTab);
	for (int i = 0; i < EnumFossilSkeleton.values().length; i++) {
		EnumFossilSkeleton.values()[i].fossilItem = new Item().setTextureName("iat:fossil").setUnlocalizedName("iat.fossil" + EnumFossilSkeleton.values()[i].name).setCreativeTab(ItsAboutTime.iatTab);
		EnumFossilSkeleton.values()[i].fossilBrokenItem = new Item().setTextureName("iat:fossil").setUnlocalizedName("iat.fossil_Broken" + EnumFossilSkeleton.values()[i].name).setCreativeTab(ItsAboutTime.iatTab);
	}
	amber = new ItemAmber().setUnlocalizedName("iat.amber").setCreativeTab(ItsAboutTime.iatTab);
	plaster_Ball = new Item().setUnlocalizedName("iat.plaster_Ball").setTextureName("iat:plaster").setCreativeTab(ItsAboutTime.iatTab);
	time_Crystal = new ItemTimeCrystal().setUnlocalizedName("iat.time_Crystal").setTextureName("iat:time_Crystal").setCreativeTab(ItsAboutTime.iatTab);
	time_Shovel = new ItemModSpade(timeToolMaterial).setUnlocalizedName("iat.time_Shovel").setTextureName("iat:time_Shovel").setCreativeTab(ItsAboutTime.iatTab);
	time_Pickaxe = new ItemModPickaxe(timeToolMaterial).setUnlocalizedName("iat.time_Pickaxe").setTextureName("iat:time_Pickaxe").setCreativeTab(ItsAboutTime.iatTab);
	time_Axe = new ItemModAxe(timeToolMaterial).setUnlocalizedName("iat.time_Axe").setTextureName("iat:time_Axe").setCreativeTab(ItsAboutTime.iatTab);
	time_Sword = new ItemSword(timeToolMaterial).setUnlocalizedName("iat.time_Sword").setTextureName("iat:time_Sword").setCreativeTab(ItsAboutTime.iatTab);
	time_Hoe = new ItemHoe(timeToolMaterial).setUnlocalizedName("iat.time_Hoe").setTextureName("iat:time_Hoe").setCreativeTab(ItsAboutTime.iatTab);
	pheromoneChest = new ItemPheromoneArmor(pheromoneArmor, 0, 1).setUnlocalizedName("iat.pheromoneCanester").setTextureName("iat:pheromoneCanester").setCreativeTab(ItsAboutTime.iatTab);
	bucket_Time = new ItemBucket(ModBlocks.fluidTimeBlock).setUnlocalizedName("iat.bucket_Time").setTextureName("iat:bucket_Time").setContainerItem(Items.bucket);
	ginkoNuts = new ItemFood(2, 0.2F, false).setPotionEffect(Potion.hunger.id, 30, 0, 0.3F).setUnlocalizedName("iat.ginkoNut").setTextureName("iat:ginko_nut").setCreativeTab(ItsAboutTime.iatTab);
}
 
開發者ID:Alex-the-666,項目名稱:It-s-About-Time-Minecraft-Mod,代碼行數:26,代碼來源:ModItems.java

示例5: dispenseStack

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    ItemBucket itembucket = (ItemBucket)par2ItemStack.getItem();
    int i = par1IBlockSource.getXInt();
    int j = par1IBlockSource.getYInt();
    int k = par1IBlockSource.getZInt();
    EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());

    if (itembucket.tryPlaceContainedLiquid(par1IBlockSource.getWorld(), i + enumfacing.getFrontOffsetX(), j + enumfacing.getFrontOffsetY(), k + enumfacing.getFrontOffsetZ()))
    {
        par2ItemStack.itemID = Item.bucketEmpty.itemID;
        par2ItemStack.stackSize = 1;
        return par2ItemStack;
    }
    else
    {
        return this.defaultDispenserItemBehavior.dispense(par1IBlockSource, par2ItemStack);
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:23,代碼來源:DispenserBehaviorFilledBucket.java

示例6: identityType

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
private static String identityType(@Nonnull ItemStack stack) {
	Item item = stack.getItem();
	if (item instanceof ItemArmor) {
		switch (((ItemArmor)item).armorType) {
			case HEAD:
				return "helmet";
			case CHEST:
				return "chestplate";
			case LEGS:
				return "leggings";
			case FEET:
				return "boots";
			default:
				break;
		}
	} else if (item instanceof ItemPickaxe) return "pickaxe";
	else if (item instanceof ItemShears) return "shears";
	else if (item instanceof ItemAxe) return "axe";
	else if (item instanceof ItemSpade) return "shovel";
	else if (item instanceof ItemBlock) return "block";
	else if (item instanceof ItemBucket) return "bucket";

	return "gizmo";
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:25,代碼來源:LoreFlimFlam.java

示例7: onItemTooltip

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent event) {
    if (event.getItemStack().getItem() instanceof IProgrammable) {
        handleProgrammableTooltip(event);
    } else if (event.getItemStack().getItem() instanceof ItemBucket || event.getItemStack().getItem() instanceof UniversalBucket) {
        handleFluidContainerTooltip(event);
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:9,代碼來源:ClientEventHandler.java

示例8: decrVanillaGrid

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
private void decrVanillaGrid(int amount) {
	for (int i = 1; i < 10; i++) {
		if (slots[i] != null) {
			if (slots[i].stackSize == amount) {
				if (slots[i].getItem() instanceof ItemBucket) {
					slots[i] = new ItemStack(Items.BUCKET);
				} else {
					slots[i] = null;
				}
			} else if (slots[i].stackSize > amount) {
				slots[i].stackSize -= amount;
			}
		}
	}
}
 
開發者ID:yolp900,項目名稱:ItsJustaCharm1.10.2Dead,代碼行數:16,代碼來源:TileEntityConstructionTable.java

示例9: decrAllGrid

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
private void decrAllGrid(int amount) {
	for (int i = 1; i <= 17; i++) {
		if (slots[i] != null) {
			if (slots[i].stackSize == amount) {
				if (slots[i].getItem() instanceof ItemBucket) {
					slots[i] = new ItemStack(Items.BUCKET);
				} else {
					slots[i] = null;
				}
			} else if (slots[i].stackSize > amount) {
				slots[i].stackSize -= amount;
			}
		}
	}
}
 
開發者ID:yolp900,項目名稱:ItsJustaCharm1.10.2Dead,代碼行數:16,代碼來源:TileEntityConstructionTable.java

示例10: onItemRightClick

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
@Patch.Exception
@Hook("net.minecraft.item.ItemBucket#func_77659_a")
public static Hook.Result onItemRightClick(ItemBucket item, ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
	if (item == Items.LAVA_BUCKET) {
		RayTraceResult rayTrace = item.rayTrace(world, player, false);
		if (rayTrace == null) {
			player.setActiveHand(hand);
			return new Hook.Result(new ActionResult(EnumActionResult.SUCCESS, stack));
		}
	}
	return Hook.Result.VOID;
}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:13,代碼來源:DrinkingLava.java

示例11: onItemUseFinish

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
@Patch.Exception
	@Hook("net.minecraft.item.ItemBucket#func_77654_b")
	public static Hook.Result onItemUseFinish(ItemBucket item, ItemStack stack, World world, EntityLivingBase living) {
		if (item == Items.LAVA_BUCKET) {
			living.attackEntityFrom(DamageSource.LAVA, 10);
			living.setFire(30);
//			if (living instanceof EntityPlayer) {
//				EntityPlayer player = (EntityPlayer) living;
//			}
			return new Hook.Result(new ItemStack(Items.BUCKET));
		} else
			return Hook.Result.VOID;
	}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:14,代碼來源:DrinkingLava.java

示例12: hasBucketInStacks

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
public boolean hasBucketInStacks() {
    for (int i = 0; i < this.stackList.length; ++i) {
        if (this.stackList[i] != null && this.stackList[i].getItem() instanceof ItemBucket) {
            return true;
        }
    }
    return false;
}
 
開發者ID:Darkyoooooo,項目名稱:DimsumCraft,代碼行數:9,代碼來源:RChoppingBoardCrafting.java

示例13: isItemValid

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
@Override
public boolean isItemValid(ItemStack stack) {
    if (stack != null) {
        if (stack.getItem() instanceof ItemBucket) {
            return !this.inv.hasBucketInStacks();
        } else if (stack.getItem().getContainerItem() != null) {
            return !this.inv.hasItemsHasContainerItem();
        } else {
            return true;
        }
    }
    return false;
}
 
開發者ID:Darkyoooooo,項目名稱:DimsumCraft,代碼行數:14,代碼來源:SChoppingBoard.java

示例14: importFuel

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
protected void importFuel() {
  ItemStack itemstack = this.getStackInSlot(this.fuelSlot);
  //pull in item from fuel slot, if it has fuel burn time
  int fuelFromStack = FUEL_FACTOR * TileEntityFurnace.getItemBurnTime(itemstack);
  if (fuelFromStack > 0 && this.energyStorage.emptyCapacity() >= fuelFromStack
      && world.isRemote == false) {
    int newEnergy = Math.min(this.getFuelMax(), this.getFuelCurrent() + fuelFromStack);
    this.energyStorage.setEnergyStored(newEnergy);
    if (itemstack.getItem() instanceof ItemBucket && itemstack.getCount() == 1) {
      this.setInventorySlotContents(this.fuelSlot, new ItemStack(Items.BUCKET));
    }
    else {
      itemstack.shrink(1);
    }
  }
  //what if item in fuel slot is an RF battery type item? start draining it ya
  if (itemstack.hasCapability(CapabilityEnergy.ENERGY, null)) {
    IEnergyStorage storage = itemstack.getCapability(CapabilityEnergy.ENERGY, null);
    if (storage != null && storage.getEnergyStored() > 0) {
      int canWithdraw = Math.min(EnergyStore.MAX_INPUT, storage.getEnergyStored());
      if (canWithdraw > 0 && this.getFuelCurrent() + canWithdraw <= this.getFuelMax()) {
        storage.extractEnergy(canWithdraw, false);
        this.setFuelCurrent(this.getFuelCurrent() + canWithdraw);
      }
    }
  }
}
 
開發者ID:PrinceOfAmber,項目名稱:Cyclic,代碼行數:28,代碼來源:TileEntityBaseMachineInvo.java

示例15: isValidTool

import net.minecraft.item.ItemBucket; //導入依賴的package包/類
public static final boolean isValidTool(ItemStack stack){
	if((stack.getItem() instanceof ItemBlock) || (stack.getItem() instanceof ItemPotion) || (stack.getItem() instanceof ItemArmor) || (stack.getItem() instanceof ItemBucket))
		return false;
	if(isWhiteListed(stack))
		return true;
	if(isBlackListed(stack))
		return false;
	return stack.getMaxStackSize() == 1 && !(stack.getItem() instanceof ItemBlock) && !(stack.getItem() instanceof ItemPotion) && !(stack.getItem() instanceof ItemArmor) && !(stack.getItem() instanceof ItemBucket);
}
 
開發者ID:AnimeniacYuuto,項目名稱:InventoryTools,代碼行數:10,代碼來源:ToolBoxRegistry.java


注:本文中的net.minecraft.item.ItemBucket類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。