本文整理匯總了Java中net.minecraft.item.ItemFireball類的典型用法代碼示例。如果您正苦於以下問題:Java ItemFireball類的具體用法?Java ItemFireball怎麽用?Java ItemFireball使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ItemFireball類屬於net.minecraft.item包,在下文中一共展示了ItemFireball類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dispense
import net.minecraft.item.ItemFireball; //導入依賴的package包/類
/** Custom dispense routines */
@Override
protected void dispense(World worldIn, BlockPos pos) {
BlockSourceImpl src = new BlockSourceImpl(worldIn, pos);
TileEntityDispenser tile = (TileEntityDispenser)src.getBlockTileEntity();
if (tile != null) {
int i = tile.getDispenseSlot();
if (i < 0) {
worldIn.playEvent(1001, pos, 0);
} else {
// get the active item from its slot
ItemStack itemstack = tile.getStackInSlot(i);
IBehaviorDispenseItem defaultbehavior = this.getBehavior(itemstack);
// make sure it's not regular dropper behavior
if (defaultbehavior != IBehaviorDispenseItem.DEFAULT_BEHAVIOR) {
ItemStack itemstack1 = null;
// replace vanilla behavior
if(defaultbehavior instanceof BehaviorProjectileDispense) {
itemstack1 = this.dispenseProjectile((BehaviorProjectileDispense)defaultbehavior, src, itemstack);
} else if(itemstack.getItem() instanceof ItemSplashPotion || itemstack.getItem() instanceof ItemLingeringPotion) {
itemstack1 = this.dispensePotion(src, itemstack);
} else if(itemstack.getItem() instanceof ItemFireball) {
itemstack1 = this.dispenseFireball(src, itemstack);
}
// revert to vanilla on failure
if(itemstack1 == null) {
itemstack1 = defaultbehavior.dispense(src, itemstack);
}
// update the inventory
tile.setInventorySlotContents(i, itemstack1.getCount() <= 0 ? ItemStack.EMPTY : itemstack1);
}
}
}
}