本文整理匯總了Java中net.minecraft.block.BlockDispenser.getFacing方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockDispenser.getFacing方法的具體用法?Java BlockDispenser.getFacing怎麽用?Java BlockDispenser.getFacing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.block.BlockDispenser
的用法示例。
在下文中一共展示了BlockDispenser.getFacing方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource dispenser, ItemStack cartItemStack)
{
EntityMinecartBase entityMinecartBase;
World world = dispenser.getWorld();
boolean cartSpawned = false;
if(ItemStackUtils.isItemInstanceOf(cartItemStack, ItemMinecartBase.class))
{
ItemMinecartBase itemMinecartBase = (ItemMinecartBase)cartItemStack.getItem();
entityMinecartBase = itemMinecartBase.getEntityFromItem(world, cartItemStack);
if(entityMinecartBase != null)
{
EnumFacing enumfacing = BlockDispenser.getFacing(dispenser.getBlockMetadata());
BlockPos blockpos = dispenser.getBlockPos().offset(enumfacing);
cartSpawned = itemMinecartBase.placeCart(cartItemStack, world, blockpos, entityMinecartBase);
}
}
if(!cartSpawned)
{
cartItemStack = super.dispenseStack(dispenser, cartItemStack);
}
return cartItemStack;
}
示例2: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
float y = 1.1F;
World var3 = source.getWorld();
IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
EnumFacing var5 = BlockDispenser.getFacing(source.getBlockMetadata());
IProjectile var6 = this.getProjectileEntity(var3, var4, stack.getItemDamage());
if(var6 != null)
{
var6.setThrowableHeading((double)var5.getFrontOffsetX(), 0.10000000149011612D*y, (double)var5.getFrontOffsetY(), this.func_82500_b(), this.func_82498_a());
var3.spawnEntityInWorld((Entity)var6);
stack.splitStack(1);
}
return stack;
}
示例3: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
float y = 1.1F;
World var3 = source.getWorld();
IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
IProjectile iprojectile = this.getProjectileEntity(var3, var4, stack.getItemDamage());
if(iprojectile != null)
{
iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
var3.spawnEntityInWorld((Entity)iprojectile);
stack.splitStack(1);
}
return stack;
}
示例4: 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)
{
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
IPosition iposition = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource);
double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
World world = par1IBlockSource.getWorld();
Random random = world.rand;
double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例5: 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)
{
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
double d0 = par1IBlockSource.getX() + (double)enumfacing.getFrontOffsetX();
double d1 = (double)((float)par1IBlockSource.getYInt() + 0.2F);
double d2 = par1IBlockSource.getZ() + (double)enumfacing.getFrontOffsetZ();
Entity entity = ItemMonsterPlacer.spawnCreature(par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), d0, d1, d2);
if (entity instanceof EntityLivingBase && par2ItemStack.hasDisplayName())
{
((EntityLiving)entity).setCustomNameTag(par2ItemStack.getDisplayName());
}
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例6: 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)
{
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);
}
}
示例7: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
World world = source.getWorld();
IPosition iposition = BlockDispenser.getDispensePosition(source);
EnumFacing enumfacing = BlockDispenser.getFacing(source.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);
stack.splitStack(1);
return stack;
}
示例8: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
IPosition iposition = BlockDispenser.getDispensePosition(source);
ItemStack itemstack = stack.splitStack(1);
doDispense(source.getWorld(), itemstack, 6, enumfacing, iposition);
return stack;
}
示例9: dispenseStack
import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
World world = blocksource.getWorld();
IPosition pos = BlockDispenser.getDispensePosition(blocksource);
EnumFacing face = BlockDispenser.getFacing(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包/類
@Override
public ItemStack dispenseStack(IBlockSource block, ItemStack stack) {
EnumFacing facing = BlockDispenser.getFacing(block.getBlockMetadata());
double dx = block.getX() + facing.getFrontOffsetX();
double dy = ((float) block.getBlockPos().getY() + 0.2F);
double dz= block.getZ() + facing.getFrontOffsetZ();
Entity entity = ((ItemCustomEgg) stack.getItem()).spawnCreature(block.getWorld(), stack.getItemDamage(), dx, dy, dz);
if (entity instanceof EntityLivingBase && stack.hasDisplayName()) {
((EntityLiving) entity).setCustomNameTag(stack.getDisplayName());
}
stack.splitStack(1);
return stack;
}
示例11: 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)
{
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
World world = par1IBlockSource.getWorld();
double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
int l = world.getBlockId(i, j, k);
double d3;
if (BlockRailBase.isRailBlock(l))
{
d3 = 0.0D;
}
else
{
if (l != 0 || !BlockRailBase.isRailBlock(world.getBlockId(i, j - 1, k)))
{
return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
}
d3 = -1.0D;
}
EntityMinecart entityminecart = EntityMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemMinecart)par2ItemStack.getItem()).minecartType);
if (par2ItemStack.hasDisplayName())
{
entityminecart.setMinecartName(par2ItemStack.getDisplayName());
}
world.spawnEntityInWorld(entityminecart);
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例12: 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 enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1));
List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new EntitySelectorArmoredMob(par2ItemStack));
if (list.size() > 0)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
int l = entitylivingbase instanceof EntityPlayer ? 1 : 0;
int i1 = EntityLiving.getArmorPosition(par2ItemStack);
ItemStack itemstack1 = par2ItemStack.copy();
itemstack1.stackSize = 1;
entitylivingbase.setCurrentItemOrArmor(i1, itemstack1); //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.
if (entitylivingbase instanceof EntityLiving)
{
((EntityLiving)entitylivingbase).setEquipmentDropChance(i1, 2.0F);
}
--par2ItemStack.stackSize;
return par2ItemStack;
}
else
{
return super.dispenseStack(par1IBlockSource, par2ItemStack);
}
}
示例13: 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 enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
World world = par1IBlockSource.getWorld();
int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), (EntityLivingBase)null);
world.spawnEntityInWorld(entitytntprimed);
--par2ItemStack.stackSize;
return par2ItemStack;
}
示例14: 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)
{
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
World world = par1IBlockSource.getWorld();
int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
Material material = world.getBlockMaterial(i, j, k);
int l = world.getBlockMetadata(i, j, k);
Item item;
if (Material.water.equals(material) && l == 0)
{
item = Item.bucketWater;
}
else
{
if (!Material.lava.equals(material) || l != 0)
{
return super.dispenseStack(par1IBlockSource, par2ItemStack);
}
item = Item.bucketLava;
}
world.setBlockToAir(i, j, k);
if (--par2ItemStack.stackSize == 0)
{
par2ItemStack.itemID = item.itemID;
par2ItemStack.stackSize = 1;
}
else if (((TileEntityDispenser)par1IBlockSource.getBlockTileEntity()).addItem(new ItemStack(item)) < 0)
{
this.defaultDispenserItemBehavior.dispense(par1IBlockSource, new ItemStack(item));
}
return par2ItemStack;
}
示例15: 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.getIPositionFromBlockSource(par1IBlockSource);
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.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);
par2ItemStack.splitStack(1);
return par2ItemStack;
}