本文整理匯總了Java中net.minecraft.dispenser.IBlockSource.getY方法的典型用法代碼示例。如果您正苦於以下問題:Java IBlockSource.getY方法的具體用法?Java IBlockSource.getY怎麽用?Java IBlockSource.getY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.dispenser.IBlockSource
的用法示例。
在下文中一共展示了IBlockSource.getY方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDispensePosition
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Get the position where the dispenser at the given Coordinates should dispense to.
*/
public static IPosition getDispensePosition(IBlockSource coords)
{
EnumFacing enumfacing = getFacing(coords.getBlockMetadata());
double d0 = coords.getX() + 0.7D * (double)enumfacing.getFrontOffsetX();
double d1 = coords.getY() + 0.7D * (double)enumfacing.getFrontOffsetY();
double d2 = coords.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ();
return new PositionImpl(d0, d1, d2);
}
示例2: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
World world = source.getWorld();
double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
BlockPos blockpos = source.getBlockPos().offset(enumfacing);
Material material = world.getBlockState(blockpos).getMaterial();
double d3;
if (Material.WATER.equals(material))
{
d3 = 1.0D;
}
else
{
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getBlockState(blockpos.down()).getMaterial()))
{
return this.dispenseBehavior.dispense(source, stack);
}
d3 = 0.0D;
}
EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
entityboat.setBoatType(this.boatType);
entityboat.rotationYaw = enumfacing.getHorizontalAngle();
world.spawnEntityInWorld(entityboat);
stack.func_190918_g(1);
return stack;
}
示例3: getDispensePosition
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Get the position where the dispenser at the given Coordinates should dispense to.
*/
public static IPosition getDispensePosition(IBlockSource coords)
{
EnumFacing enumfacing = (EnumFacing)coords.getBlockState().getValue(FACING);
double d0 = coords.getX() + 0.7D * (double)enumfacing.getFrontOffsetX();
double d1 = coords.getY() + 0.7D * (double)enumfacing.getFrontOffsetY();
double d2 = coords.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ();
return new PositionImpl(d0, d1, d2);
}
示例4: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
World world = source.getWorld();
double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
BlockPos blockpos = source.getBlockPos().offset(enumfacing);
Material material = world.getBlockState(blockpos).getMaterial();
double d3;
if (Material.WATER.equals(material))
{
d3 = 1.0D;
}
else
{
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getBlockState(blockpos.down()).getMaterial()))
{
return this.dispenseBehavior.dispense(source, stack);
}
d3 = 0.0D;
}
EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
entityboat.setBoatType(this.boatType);
entityboat.rotationYaw = enumfacing.getOpposite().getHorizontalAngle();
world.spawnEntityInWorld(entityboat);
stack.splitStack(1);
return stack;
}
示例5: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource at, ItemStack is) {
World world = at.getWorld();
IBlockState dispenserState = world.getBlockState(at.getBlockPos());
EnumFacing enumfacing = dispenserState.getValue(BlockDispenser.FACING);
double x = at.getX() + (double) ((float) enumfacing.getFrontOffsetX() * 1.125F);
double y = at.getY() + (double) ((float) enumfacing.getFrontOffsetY() * 1.125F);
double z = at.getZ() + (double) ((float) enumfacing.getFrontOffsetZ() * 1.125F);
BlockPos target = at.getBlockPos().offset(enumfacing);
IBlockState bs = world.getBlockState(target);
Block block = bs.getBlock();
double yOffset;
if (BlockRailBase.isRailBlock(bs)) {
yOffset = 0.0D;
} else {
if (block.getMaterial() != Material.air || !BlockRailBase.isRailBlock(world.getBlockState(target.down()))) {
return this.behaviourDefaultDispenseItem.dispense(at, is);
}
yOffset = -1.0D;
}
EntityMinecart entityminecart = Core.registry.barrelCart.placeCart(null, is, at.getWorld(), new BlockPos((int) x, (int) y, (int) z));
if (is.hasDisplayName()) {
entityminecart.setCustomNameTag(is.getDisplayName());
}
return is;
}
示例6: getDispensePosition
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Get the position where the dispenser at the given Coordinates should dispense to.
*/
public IPosition getDispensePosition(IBlockSource coords) {
EnumFacing enumfacing = this.getFacing(coords.getBlockState());
double d0 = coords.getX() + 0.7D * (double) enumfacing.getFrontOffsetX();
double d1 = coords.getY() + 0.7D * (double) enumfacing.getFrontOffsetY();
double d2 = coords.getZ() + 0.7D * (double) enumfacing.getFrontOffsetZ();
return new PositionImpl(d0, d1, d2);
}
示例7: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing var3 = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
World var4 = par1IBlockSource.getWorld();
double var5 = par1IBlockSource.getX() + (double)((float)var3.getFrontOffsetX() * 1.125F);
double var7 = par1IBlockSource.getY() + (double)((float)var3.getFrontOffsetY() * 1.125F);
double var9 = par1IBlockSource.getZ() + (double)((float)var3.getFrontOffsetZ() * 1.125F);
int var11 = par1IBlockSource.getXInt() + var3.getFrontOffsetX();
int var12 = par1IBlockSource.getYInt() + var3.getFrontOffsetY();
int var13 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ();
Block var14 = var4.getBlock(var11, var12, var13);
double var15;
if (BlockRailBase.func_150051_a(var14))
{
var15 = 0.0D;
}
else
{
if (var14.getMaterial() != Material.air || !BlockRailBase.func_150051_a(var4.getBlock(var11, var12 - 1, var13)))
{
return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
}
var15 = -1.0D;
}
EntityMinecart var17 = EntityMinecart.createMinecart(var4, var5, var7 + var15, var9, ((ItemMinecart)par2ItemStack.getItem()).minecartType);
if (par2ItemStack.hasDisplayName())
{
var17.setMinecartName(par2ItemStack.getDisplayName());
}
var4.spawnEntityInWorld(var17);
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例8: func_149939_a
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
public static IPosition func_149939_a(IBlockSource p_149939_0_)
{
EnumFacing var1 = func_149937_b(p_149939_0_.getBlockMetadata());
double var2 = p_149939_0_.getX() + 0.7D * (double)var1.getFrontOffsetX();
double var4 = p_149939_0_.getY() + 0.7D * (double)var1.getFrontOffsetY();
double var6 = p_149939_0_.getZ() + 0.7D * (double)var1.getFrontOffsetZ();
return new PositionImpl(var2, var4, var6);
}
示例9: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
EnumFacing enumfacing = (EnumFacing)source.func_189992_e().getValue(BlockDispenser.FACING);
World world = source.getWorld();
double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
BlockPos blockpos = source.getBlockPos().offset(enumfacing);
Material material = world.getBlockState(blockpos).getMaterial();
double d3;
if (Material.WATER.equals(material))
{
d3 = 1.0D;
}
else
{
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getBlockState(blockpos.down()).getMaterial()))
{
return this.dispenseBehavior.dispense(source, stack);
}
d3 = 0.0D;
}
EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
entityboat.setBoatType(this.boatType);
entityboat.rotationYaw = enumfacing.getOpposite().getHorizontalAngle();
world.spawnEntityInWorld(entityboat);
stack.splitStack(1);
return stack;
}
示例10: getDispensePosition
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Get the position where the dispenser at the given Coordinates should dispense to.
*/
public static IPosition getDispensePosition(IBlockSource coords)
{
EnumFacing enumfacing = (EnumFacing)coords.func_189992_e().getValue(FACING);
double d0 = coords.getX() + 0.7D * (double)enumfacing.getFrontOffsetX();
double d1 = coords.getY() + 0.7D * (double)enumfacing.getFrontOffsetY();
double d2 = coords.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ();
return new PositionImpl(d0, d1, d2);
}
示例11: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
World world = p_82487_1_.getWorld();
double d0 = p_82487_1_.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = p_82487_1_.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = p_82487_1_.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
int i = p_82487_1_.getXInt() + enumfacing.getFrontOffsetX();
int j = p_82487_1_.getYInt() + enumfacing.getFrontOffsetY();
int k = p_82487_1_.getZInt() + enumfacing.getFrontOffsetZ();
Block block = world.getBlock(i, j, k);
double d3;
if (BlockRailBase.func_150051_a(block))
{
d3 = 0.0D;
}
else
{
if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
{
return this.behaviourDefaultDispenseItem.dispense(p_82487_1_, p_82487_2_);
}
d3 = -1.0D;
}
EntityMinecart entityminecart = EntityMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemMinecart)p_82487_2_.getItem()).minecartType);
if (p_82487_2_.hasDisplayName())
{
entityminecart.setMinecartName(p_82487_2_.getDisplayName());
}
world.spawnEntityInWorld(entityminecart);
p_82487_2_.splitStack(1);
return p_82487_2_;
}
示例12: func_149939_a
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
public static IPosition func_149939_a(IBlockSource p_149939_0_)
{
EnumFacing enumfacing = func_149937_b(p_149939_0_.getBlockMetadata());
double d0 = p_149939_0_.getX() + 0.7D * (double)enumfacing.getFrontOffsetX();
double d1 = p_149939_0_.getY() + 0.7D * (double)enumfacing.getFrontOffsetY();
double d2 = p_149939_0_.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ();
return new PositionImpl(d0, d1, d2);
}
示例13: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockDispenser.func_149937_b(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();
Block block = world.getBlock(i, j, k);
double d3;
if (BlockRailBase.func_150051_a(block))
{
d3 = 0.0D;
}
else
{
if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
{
return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
}
d3 = -1.0D;
}
EntitySpeedyChestcart entityminecart = (EntitySpeedyChestcart) EntitySpeedyChestcart.createMinecart(world, d0, d1 + d3, d2, ((ItemSpeedyChestcart)par2ItemStack.getItem()).minecartType);
if (par2ItemStack.hasDisplayName())
{
entityminecart.setMinecartName(par2ItemStack.getDisplayName());
}
world.spawnEntityInWorld(entityminecart);
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例14: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockDispenser.func_149937_b(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();
Block block = world.getBlock(i, j, k);
double d3;
if (BlockRailBase.func_150051_a(block))
{
d3 = 0.0D;
}
else
{
if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
{
return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
}
d3 = -1.0D;
}
EntitySpeedyMinecart entityminecart = (EntitySpeedyMinecart) EntitySpeedyMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemSpeedyTankCart)par2ItemStack.getItem()).minecartType);
if (par2ItemStack.hasDisplayName())
{
entityminecart.setMinecartName(par2ItemStack.getDisplayName());
}
world.spawnEntityInWorld(entityminecart);
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例15: dispenseStack
import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockDispenser.func_149937_b(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();
Block block = world.getBlock(i, j, k);
double d3;
if (BlockRailBase.func_150051_a(block))
{
d3 = 0.0D;
}
else
{
if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
{
return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
}
d3 = -1.0D;
}
EntitySpeedyMinecart entityminecart = (EntitySpeedyMinecart) EntitySpeedyMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemSpeedyMinecart)par2ItemStack.getItem()).minecartType);
if (par2ItemStack.hasDisplayName())
{
entityminecart.setMinecartName(par2ItemStack.getDisplayName());
}
world.spawnEntityInWorld(entityminecart);
par2ItemStack.splitStack(1);
return par2ItemStack;
}