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