本文整理匯總了Java中net.minecraft.block.BlockDispenser.func_149939_a方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockDispenser.func_149939_a方法的具體用法?Java BlockDispenser.func_149939_a怎麽用?Java BlockDispenser.func_149939_a使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.block.BlockDispenser
的用法示例。
在下文中一共展示了BlockDispenser.func_149939_a方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
World world = par1IBlockSource.getWorld();
IPosition iposition = BlockDispenser.func_149939_a(par1IBlockSource);
EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
ItemStack stack = par2ItemStack.splitStack(1);
if (matchesItem(par2ItemStack)) {
// dispense item as projectile because the item matches
IProjectile iprojectile = this.getProjectileEntity(world, iposition, par2ItemStack);
iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
world.spawnEntityInWorld((Entity) iprojectile);
} else {
// dispense item as item because it doesn't match
BehaviorDefaultDispenseItem.doDispense(world, stack, 6, enumfacing, iposition);
}
return par2ItemStack;
}
示例2: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource blockSource, ItemStack stack) {
if (NBTHelper.hasTag(stack, "identifier")) {
World world = blockSource.getWorld();
IPosition iposition = BlockDispenser.func_149939_a(blockSource);
EnumFacing enumfacing = BlockDispenser.func_149937_b(blockSource.getBlockMetadata());
EntityNanoBotSwarm iprojectile = new EntityNanoBotSwarm(world, iposition.getX(), iposition.getY(), iposition.getZ());
iprojectile.antennaIdentifier = UUID.fromString(NBTHelper.getString(stack, "identifier"));
if (NBTHelper.hasTag(stack, "label"))
iprojectile.label = NBTHelper.getString(stack, "label");
iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY()+0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
world.spawnEntityInWorld(iprojectile);
stack.splitStack(1);
} else {
return super.dispenseStack(blockSource, stack);
}
return stack;
}
示例3: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
World var3 = par1IBlockSource.getWorld();
IPosition var4 = BlockDispenser.func_149939_a(par1IBlockSource);
EnumFacing var5 = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
IProjectile var6 = this.getProjectileEntity(var3, var4);
var6.setThrowableHeading((double)var5.getFrontOffsetX(), (double)((float)var5.getFrontOffsetY() + 0.1F), (double)var5.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
var3.spawnEntityInWorld((Entity)var6);
par2ItemStack.splitStack(1);
return par2ItemStack;
}
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:15,代碼來源:BehaviorProjectileDispense.java
示例4: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing var3 = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
IPosition var4 = BlockDispenser.func_149939_a(par1IBlockSource);
ItemStack var5 = par2ItemStack.splitStack(1);
doDispense(par1IBlockSource.getWorld(), var5, 6, var3, var4);
return par2ItemStack;
}
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:12,代碼來源:BehaviorDefaultDispenseItem.java
示例5: spawnDispenseParticles
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
super.spawnDispenseParticles(blocksource, face);
if (!normalDispense)
{
IPosition pos = BlockDispenser.func_149939_a(blocksource);
blocksource.getWorld().spawnParticle("flame", pos.getX() + face.getFrontOffsetX(), pos.getY(), pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
}
}
示例6: spawnDispenseParticles
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
super.spawnDispenseParticles(blocksource, face);
IPosition pos = BlockDispenser.func_149939_a(blocksource);
blocksource.getWorld().spawnParticle("flame", pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(), pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.2D, 0.0D);
}
示例7: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
EnumFacing face = EnumFacing.getFront(blocksource.getBlockMetadata());
IPosition pos = BlockDispenser.func_149939_a(blocksource);
EntityBlunderShot.fireFromDispenser(blocksource.getWorld(), pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(), pos.getZ() + face.getFrontOffsetZ(), face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ());
itemstack.splitStack(1);
return itemstack;
}
示例8: spawnDispenseParticles
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
super.spawnDispenseParticles(blocksource, face);
IPosition pos = BlockDispenser.func_149939_a(blocksource);
blocksource.getWorld().spawnParticle("flame", pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(), pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
}
示例9: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
World world = blocksource.getWorld();
IPosition pos = BlockDispenser.func_149939_a(blocksource);
EnumFacing face = BlockDispenser.func_149937_b(blocksource.getBlockMetadata());
IProjectile projectile = getProjectileEntity(world, pos, itemstack);
projectile.setThrowableHeading(face.getFrontOffsetX(), face.getFrontOffsetY() + getYVel(), face.getFrontOffsetZ(), getVelocity(), getDeviation());
world.spawnEntityInWorld((Entity) projectile);
itemstack.splitStack(1);
return itemstack;
}
示例10: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
protected ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
ItemStack itemstack1 = p_82487_2_.splitStack(1);
// CraftBukkit start
if (!doDispense(p_82487_1_.getWorld(), itemstack1, 6, enumfacing, p_82487_1_))
{
p_82487_2_.stackSize++;
}
// CraftBukkit end
return p_82487_2_;
}
示例11: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
World world = p_82487_1_.getWorld();
IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
IProjectile iprojectile = this.getProjectileEntity(world, iposition);
iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
world.spawnEntityInWorld((Entity)iprojectile);
p_82487_2_.splitStack(1);
return p_82487_2_;
}
示例12: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
protected ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
ItemStack itemstack1 = p_82487_2_.splitStack(1);
doDispense(p_82487_1_.getWorld(), itemstack1, 6, enumfacing, iposition);
return p_82487_2_;
}
示例13: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
boolean canfire = false;
normalDispense = false;
TileEntity tileentity = blocksource.getWorld().getTileEntity(MathHelper.floor_double(blocksource.getXInt()), MathHelper.floor_double(blocksource.getYInt()), MathHelper.floor_double(blocksource.getZInt()));
if (tileentity instanceof TileEntityDispenser)
{
TileEntityDispenser dispenser = ((TileEntityDispenser) tileentity);
Item itemtocheck = null;
if (itemstack.getItem() == Items.gunpowder)
{
itemtocheck = BalkonsWeaponMod.cannonBall;
} else if (itemstack.getItem() == BalkonsWeaponMod.cannonBall)
{
itemtocheck = Items.gunpowder;
}
for (int i = 0; i < dispenser.getSizeInventory(); i++)
{
ItemStack itemstack1 = dispenser.getStackInSlot(i);
if (itemstack1 != null && itemstack1.getItem() == itemtocheck)
{
dispenser.decrStackSize(i, 1);
canfire = true;
break;
}
}
}
if (!canfire)
{
normalDispense = true;
return super.dispenseStack(blocksource, itemstack);
}
EnumFacing face = BlockDispenser.func_149937_b(blocksource.getBlockMetadata());
double xvel = face.getFrontOffsetX() * 1.5D;
double yvel = face.getFrontOffsetY() * 1.5D;
double zvel = face.getFrontOffsetZ() * 1.5D;
IPosition pos = BlockDispenser.func_149939_a(blocksource);
EntityCannonBall entitycannonball = new EntityCannonBall(blocksource.getWorld(), pos.getX() + xvel, pos.getY() + yvel, pos.getZ() + zvel);
entitycannonball.setThrowableHeading(xvel, yvel + 0.15D, zvel, 2.0F, 2.0F);
blocksource.getWorld().spawnEntityInWorld(entitycannonball);
itemstack.splitStack(1);
return itemstack;
}
示例14: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
World world = p_82487_1_.getWorld();
IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
IProjectile iprojectile = this.getProjectileEntity(world, iposition);
// CraftBukkit start
ItemStack itemstack1 = p_82487_2_.splitStack(1);
org.bukkit.block.Block block = world.getWorld().getBlockAt(p_82487_1_.getXInt(), p_82487_1_.getYInt(), p_82487_1_.getZInt());
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumfacing.getFrontOffsetX(), (double)((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ()));
if (!BlockDispenser.eventFired)
{
world.getServer().getPluginManager().callEvent(event);
}
if (event.isCancelled())
{
p_82487_2_.stackSize++;
return p_82487_2_;
}
if (!event.getItem().equals(craftItem))
{
p_82487_2_.stackSize++;
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
IBehaviorDispenseItem ibehaviordispenseitem = (IBehaviorDispenseItem) BlockDispenser.dispenseBehaviorRegistry.getObject(eventStack.getItem());
if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider && ibehaviordispenseitem != this)
{
ibehaviordispenseitem.dispense(p_82487_1_, eventStack);
return p_82487_2_;
}
}
iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) p_82487_1_.getBlockTileEntity());
// CraftBukkit end
world.spawnEntityInWorld((Entity)iprojectile);
// p_82487_2_.splitStack(1); // CraftBukkit - Handled during event processing
return p_82487_2_;
}
示例15: doDispense
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
public static boolean doDispense(World world, ItemStack itemstack, int i, EnumFacing enumfacing, IBlockSource iblocksource)
{
IPosition iposition = BlockDispenser.func_149939_a(iblocksource);
// CraftBukkit end
double d0 = iposition.getX();
double d1 = iposition.getY();
double d2 = iposition.getZ();
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
double d3 = world.rand.nextDouble() * 0.1D + 0.2D;
entityitem.motionX = (double) enumfacing.getFrontOffsetX() * d3;
entityitem.motionY = 0.20000000298023224D;
entityitem.motionZ = (double) enumfacing.getFrontOffsetZ() * d3;
entityitem.motionX += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
entityitem.motionY += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
entityitem.motionZ += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(iblocksource.getXInt(), iblocksource.getYInt(), iblocksource.getZInt());
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(entityitem.motionX, entityitem.motionY, entityitem.motionZ));
if (!BlockDispenser.eventFired)
{
world.getServer().getPluginManager().callEvent(event);
}
if (event.isCancelled())
{
return false;
}
entityitem.setEntityItemStack(CraftItemStack.asNMSCopy(event.getItem()));
entityitem.motionX = event.getVelocity().getX();
entityitem.motionY = event.getVelocity().getY();
entityitem.motionZ = event.getVelocity().getZ();
if (!event.getItem().equals(craftItem))
{
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
IBehaviorDispenseItem ibehaviordispenseitem = (IBehaviorDispenseItem) BlockDispenser.dispenseBehaviorRegistry.getObject(eventStack.getItem());
if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider && ibehaviordispenseitem.getClass() != BehaviorDefaultDispenseItem.class)
{
ibehaviordispenseitem.dispense(iblocksource, eventStack);
}
else
{
world.spawnEntityInWorld(entityitem);
}
return false;
}
world.spawnEntityInWorld(entityitem);
return true;
// CraftBukkit end
}