本文整理匯總了Java中net.minecraft.item.ItemPotion.isSplash方法的典型用法代碼示例。如果您正苦於以下問題:Java ItemPotion.isSplash方法的具體用法?Java ItemPotion.isSplash怎麽用?Java ItemPotion.isSplash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.item.ItemPotion
的用法示例。
在下文中一共展示了ItemPotion.isSplash方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPotionFromInventory
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private int getPotionFromInventory() {
int pot = -1;
int counter = 0;
int i = 1;
while (i < 45) {
ItemStack is;
ItemPotion potion;
Item item;
if (this.mc.thePlayer.inventoryContainer.getSlot(i).getHasStack() && (item = (is = this.mc.thePlayer.inventoryContainer.getSlot(i).getStack()).getItem()) instanceof ItemPotion && (potion = (ItemPotion)item).getEffects(is) != null) {
for (Object o : potion.getEffects(is)) {
PotionEffect effect = (PotionEffect)o;
if (effect.getPotionID() != Potion.heal.id || !ItemPotion.isSplash((int)is.getItemDamage())) continue;
++counter;
pot = i;
}
}
++i;
}
Character colorFormatCharacter = new Character('\u00a7');
this.suffix = OptionManager.getOption((String)"Hyphen", (Module)ModuleManager.getModule(HUD.class)).value ? colorFormatCharacter + "7 - " + counter : colorFormatCharacter + "7 " + counter;
return pot;
}
示例2: getCraftingResult
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult( InventoryCrafting inv )
{
ItemStack item = doCheck( inv );
if ( item == null )
{
return null;
}
int id = ItemPotion.isSplash( item.getItemDamage() ) ? CondensedPotions.condensedSplashItem.itemID : CondensedPotions.condensedNormalItem.itemID;
ItemStack pot = new ItemStack( id, 1, 1 );
NBTTagCompound potTag = new NBTTagCompound();
item.writeToNBT( potTag );
NBTTagCompound comp = new NBTTagCompound();
comp.setTag( "Potion", potTag );
pot.setTagCompound( comp );
return pot;
}
示例3: canBrew
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private boolean canBrew() {
if (fuel > 0 && inventory[3] != null && inventory[3].stackSize > 0) {
ItemStack itemstack = inventory[3];
if (!itemstack.getItem().isPotionIngredient(itemstack))
return false;
else if (itemstack.getItem() == ModItems.dragon_breath) {
for (int i = 0; i < 3; i++)
if (inventory[i] != null && inventory[i].getItem() == Items.potionitem)
if (ItemPotion.isSplash(inventory[i].getItemDamage()))
return true;
return false;
} else {
boolean flag = false;
for (int i = 0; i < 3; i++)
if (inventory[i] != null && inventory[i].getItem() instanceof ItemPotion) {
int j = inventory[i].getItemDamage();
int k = applyIngredient(j, itemstack);
if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) {
flag = true;
break;
}
List<?> list = Items.potionitem.getEffects(j);
List<?> list1 = Items.potionitem.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) {
flag = true;
break;
}
}
return flag;
}
} else
return false;
}
示例4: brewPotions
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private void brewPotions() {
if (ForgeEventFactory.onPotionAttemptBreaw(new ItemStack[] { inventory[0], inventory[1], inventory[2], inventory[3] }))
return;
if (canBrew()) {
for (int i = 0; i < 3; i++)
if (inventory[i] != null && inventory[i].getItem() instanceof ItemPotion) {
int j = inventory[i].getItemDamage();
if (ItemPotion.isSplash(j) && inventory[3].getItem() == ModItems.dragon_breath)
inventory[i] = new ItemStack(ModItems.lingering_potion, inventory[i].stackSize, inventory[i].getItemDamage());
else {
int k = applyIngredient(j, inventory[3]);
List<?> list = Items.potionitem.getEffects(j);
List<?> list1 = Items.potionitem.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) {
if (j != k)
inventory[i].setItemDamage(k);
} else if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
inventory[i].setItemDamage(k);
}
}
boolean hasContainerItem = inventory[3].getItem().hasContainerItem(inventory[3]);
if (--inventory[3].stackSize <= 0)
inventory[3] = hasContainerItem ? inventory[3].getItem().getContainerItem(inventory[3]) : null;
else if (hasContainerItem && !worldObj.isRemote) {
float f = 0.7F;
double x = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
double y = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
double z = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(worldObj, xCoord + x, yCoord + y, zCoord + z, inventory[3].getItem().getContainerItem(inventory[3]));
entityitem.delayBeforeCanPickup = 10;
worldObj.spawnEntityInWorld(entityitem);
}
fuel--;
ForgeEventFactory.onPotionBrewed(new ItemStack[] { inventory[0], inventory[1], inventory[2], inventory[3] });
worldObj.playSound(xCoord, yCoord, zCoord, Reference.MOD_ID + ":block.brewing_stand.brew", 1.0F, 1.0F, true);
}
}
示例5: canBrew
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private boolean canBrew()
{
if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0)
{
ItemStack itemstack = this.brewingItemStacks[3];
if (!itemstack.getItem().isPotionIngredient(itemstack))
{
return false;
}
else
{
boolean flag = false;
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem)
{
int j = this.brewingItemStacks[i].getMetadata();
int k = this.getPotionResult(j, itemstack);
if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
flag = true;
break;
}
List<PotionEffect> list = Items.potionitem.getEffects(j);
List<PotionEffect> list1 = Items.potionitem.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k)
{
flag = true;
break;
}
}
}
return flag;
}
}
else
{
return false;
}
}
示例6: brewPotions
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private void brewPotions()
{
if (this.canBrew())
{
ItemStack itemstack = this.brewingItemStacks[3];
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem)
{
int j = this.brewingItemStacks[i].getMetadata();
int k = this.getPotionResult(j, itemstack);
List<PotionEffect> list = Items.potionitem.getEffects(j);
List<PotionEffect> list1 = Items.potionitem.getEffects(k);
if (j > 0 && list == list1 || list != null && (list.equals(list1) || list1 == null))
{
if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
else if (j != k)
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
}
if (itemstack.getItem().hasContainerItem())
{
this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem());
}
else
{
--this.brewingItemStacks[3].stackSize;
if (this.brewingItemStacks[3].stackSize <= 0)
{
this.brewingItemStacks[3] = null;
}
}
}
}
示例7: func_145934_k
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private boolean func_145934_k()
{
if (this.field_145945_j[3] != null && this.field_145945_j[3].stackSize > 0)
{
ItemStack var1 = this.field_145945_j[3];
if (!var1.getItem().isPotionIngredient(var1))
{
return false;
}
else
{
boolean var2 = false;
for (int var3 = 0; var3 < 3; ++var3)
{
if (this.field_145945_j[var3] != null && this.field_145945_j[var3].getItem() == Items.potionitem)
{
int var4 = this.field_145945_j[var3].getItemDamage();
int var5 = this.func_145936_c(var4, var1);
if (!ItemPotion.isSplash(var4) && ItemPotion.isSplash(var5))
{
var2 = true;
break;
}
List var6 = Items.potionitem.getEffects(var4);
List var7 = Items.potionitem.getEffects(var5);
if ((var4 <= 0 || var6 != var7) && (var6 == null || !var6.equals(var7) && var7 != null) && var4 != var5)
{
var2 = true;
break;
}
}
}
return var2;
}
}
else
{
return false;
}
}
示例8: func_145940_l
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private void func_145940_l()
{
if (this.func_145934_k())
{
ItemStack var1 = this.field_145945_j[3];
for (int var2 = 0; var2 < 3; ++var2)
{
if (this.field_145945_j[var2] != null && this.field_145945_j[var2].getItem() == Items.potionitem)
{
int var3 = this.field_145945_j[var2].getItemDamage();
int var4 = this.func_145936_c(var3, var1);
List var5 = Items.potionitem.getEffects(var3);
List var6 = Items.potionitem.getEffects(var4);
if ((var3 <= 0 || var5 != var6) && (var5 == null || !var5.equals(var6) && var6 != null))
{
if (var3 != var4)
{
this.field_145945_j[var2].setItemDamage(var4);
}
}
else if (!ItemPotion.isSplash(var3) && ItemPotion.isSplash(var4))
{
this.field_145945_j[var2].setItemDamage(var4);
}
}
}
if (var1.getItem().hasContainerItem())
{
this.field_145945_j[3] = new ItemStack(var1.getItem().getContainerItem());
}
else
{
--this.field_145945_j[3].stackSize;
if (this.field_145945_j[3].stackSize <= 0)
{
this.field_145945_j[3] = null;
}
}
}
}
示例9: canBrew
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private boolean canBrew()
{
if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0)
{
ItemStack itemstack = this.brewingItemStacks[3];
if (!itemstack.getItem().isPotionIngredient(itemstack))
{
return false;
}
else
{
boolean flag = false;
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion)
{
int j = this.brewingItemStacks[i].getItemDamage();
int k = this.func_145936_c(j, itemstack);
if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
flag = true;
break;
}
List list = Items.potionitem.getEffects(j);
List list1 = Items.potionitem.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k)
{
flag = true;
break;
}
}
}
return flag;
}
}
else
{
return false;
}
}
示例10: brewPotions
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private void brewPotions()
{
if (this.canBrew())
{
ItemStack itemstack = this.brewingItemStacks[3];
// CraftBukkit start
if (getOwner() != null)
{
BrewEvent event = new BrewEvent(worldObj.getWorld().getBlockAt(xCoord, yCoord, zCoord), (org.bukkit.inventory.BrewerInventory) this.getOwner().getInventory());
org.bukkit.Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
{
return;
}
}
// CraftBukkit end
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion)
{
int j = this.brewingItemStacks[i].getItemDamage();
int k = this.func_145936_c(j, itemstack);
List list = Items.potionitem.getEffects(j);
List list1 = Items.potionitem.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null))
{
if (j != k)
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
else if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
}
if (itemstack.getItem().hasContainerItem(itemstack))
{
this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack);
}
else
{
--this.brewingItemStacks[3].stackSize;
if (this.brewingItemStacks[3].stackSize <= 0)
{
this.brewingItemStacks[3] = null;
}
}
MinecraftForge.EVENT_BUS.post(new PotionBrewedEvent(brewingItemStacks));
}
}
示例11: brewPotions
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private void brewPotions()
{
if (this.canBrew())
{
ItemStack itemstack = this.brewingItemStacks[3];
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion)
{
int j = this.brewingItemStacks[i].getItemDamage();
int k = this.func_145936_c(j, itemstack);
List list = Items.potionitem.getEffects(j);
List list1 = Items.potionitem.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null))
{
if (j != k)
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
else if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
}
if (itemstack.getItem().hasContainerItem(itemstack))
{
this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack);
}
else
{
--this.brewingItemStacks[3].stackSize;
if (this.brewingItemStacks[3].stackSize <= 0)
{
this.brewingItemStacks[3] = null;
}
}
MinecraftForge.EVENT_BUS.post(new PotionBrewedEvent(brewingItemStacks));
}
}
示例12: dispense
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
/**
* Dispenses the specified ItemStack from a dispenser.
*/
public ItemStack dispense(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
return ItemPotion.isSplash(par2ItemStack.getItemDamage()) ? (new DispenserBehaviorPotionProjectile(this, par2ItemStack)).dispense(par1IBlockSource, par2ItemStack) : this.defaultDispenserItemBehavior.dispense(par1IBlockSource, par2ItemStack);
}
示例13: canBrew
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private boolean canBrew()
{
if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0)
{
ItemStack itemstack = this.brewingItemStacks[3];
if (!Item.itemsList[itemstack.itemID].isPotionIngredient())
{
return false;
}
else
{
boolean flag = false;
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion)
{
int j = this.brewingItemStacks[i].getItemDamage();
int k = this.getPotionResult(j, itemstack);
if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
flag = true;
break;
}
List list = Item.potion.getEffects(j);
List list1 = Item.potion.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k)
{
flag = true;
break;
}
}
}
return flag;
}
}
else
{
return false;
}
}
示例14: brewPotions
import net.minecraft.item.ItemPotion; //導入方法依賴的package包/類
private void brewPotions()
{
if (this.canBrew())
{
ItemStack itemstack = this.brewingItemStacks[3];
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion)
{
int j = this.brewingItemStacks[i].getItemDamage();
int k = this.getPotionResult(j, itemstack);
List list = Item.potion.getEffects(j);
List list1 = Item.potion.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null))
{
if (j != k)
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
else if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
}
if (Item.itemsList[itemstack.itemID].hasContainerItem())
{
this.brewingItemStacks[3] = Item.itemsList[itemstack.itemID].getContainerItemStack(brewingItemStacks[3]);
}
else
{
--this.brewingItemStacks[3].stackSize;
if (this.brewingItemStacks[3].stackSize <= 0)
{
this.brewingItemStacks[3] = null;
}
}
MinecraftForge.EVENT_BUS.post(new PotionBrewedEvent(brewingItemStacks));
}
}