本文整理匯總了Java中net.minecraftforge.event.entity.living.EnderTeleportEvent.getTargetZ方法的典型用法代碼示例。如果您正苦於以下問題:Java EnderTeleportEvent.getTargetZ方法的具體用法?Java EnderTeleportEvent.getTargetZ怎麽用?Java EnderTeleportEvent.getTargetZ使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.event.entity.living.EnderTeleportEvent
的用法示例。
在下文中一共展示了EnderTeleportEvent.getTargetZ方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Location
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
/**
* Creates a Location based on the target position of a player and a fired
* {@link EnderTeleportEvent}
*/
public Location(EnderTeleportEvent event, EntityPlayerMP player)
{
world = (WorldServer) player.worldObj;
posX = event.getTargetX();
posY = event.getTargetY();
posZ = event.getTargetZ();
pitch = player.rotationPitch;
yaw = player.rotationYaw;
}
示例2: teleportTo
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
protected boolean teleportTo(double par1, double par3, double par5)
{
EnderTeleportEvent event = new EnderTeleportEvent(this, par1, par3, par5, 0);
if (MinecraftForge.EVENT_BUS.post(event))
return false;
double d3 = posX;
double d4 = posY;
double d5 = posZ;
posX = event.getTargetX();
posY = event.getTargetY();
posZ = event.getTargetZ();
boolean flag = false;
BlockPos pos = new BlockPos(posX, posY, posZ);
if (world.isBlockLoaded(pos))
{
boolean flag1 = false;
while (!flag1 && pos.getY() > 0)
{
BlockPos pos1 = pos.down();
IBlockState block = world.getBlockState(pos1);
if (block.getMaterial().blocksMovement())
flag1 = true;
else
{
--posY;
pos = pos1;
}
}
if (flag1)
{
setPosition(posX, posY, posZ);
if (world.getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(getEntityBoundingBox()))
flag = true;
}
}
if (!flag)
{
setPosition(d3, d4, d5);
return false;
}
else
{
short short1 = 128;
for (int l = 0; l < short1; ++l)
{
double d6 = l / (short1 - 1.0D);
float f = (rand.nextFloat() - 0.5F) * 0.2F;
float f1 = (rand.nextFloat() - 0.5F) * 0.2F;
float f2 = (rand.nextFloat() - 0.5F) * 0.2F;
double d7 = d3 + (posX - d3) * d6 + (rand.nextDouble() - 0.5D) * width * 2.0D;
double d8 = d4 + (posY - d4) * d6 + rand.nextDouble() * height;
double d9 = d5 + (posZ - d5) * d6 + (rand.nextDouble() - 0.5D) * width * 2.0D;
if(ACConfig.particleEntity)
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d7, d8, d9, f, f1, f2);
}
world.playSound(d3, d4, d5, SoundEvents.ENTITY_ENDERMEN_TELEPORT, getSoundCategory(), 1.0F, 1.0F, false);
playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
return true;
}
}
示例3: teleportTo
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
protected boolean teleportTo(double par1, double par3, double par5, EntityPlayer player, World world)
{
EnderTeleportEvent event = new EnderTeleportEvent(player, par1, par3, par5, 0);
if (MinecraftForge.EVENT_BUS.post(event))
return false;
double d3 = player.posX;
double d4 = player.posY;
double d5 = player.posZ;
player.posX = event.getTargetX();
player.posY = event.getTargetY();
player.posZ = event.getTargetZ();
boolean flag = false;
BlockPos pos = new BlockPos(player.posX, player.posY, player.posZ);
if (world.isBlockLoaded(pos))
{
boolean flag1 = false;
while (!flag1 && pos.getY() > 0)
{
BlockPos pos1 = pos.down();
IBlockState block = world.getBlockState(pos1);
if (block.getMaterial().blocksMovement())
flag1 = true;
else
{
--player.posY;
pos = pos1;
}
}
if (flag1)
{
player.setPosition(player.posX, player.posY, player.posZ);
if (world.getCollisionBoxes(player, player.getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(player.getEntityBoundingBox()))
flag = true;
}
}
if (!flag)
{
player.setPosition(d3, d4, d5);
return false;
}
else
{
short short1 = 128;
for (int l = 0; l < short1; ++l)
{
double d6 = l / (short1 - 1.0D);
float f = (world.rand.nextFloat() - 0.5F) * 0.2F;
float f1 = (world.rand.nextFloat() - 0.5F) * 0.2F;
float f2 = (world.rand.nextFloat() - 0.5F) * 0.2F;
double d7 = d3 + (player.posX - d3) * d6 + (world.rand.nextDouble() - 0.5D) * player.width * 2.0D;
double d8 = d4 + (player.posY - d4) * d6 + world.rand.nextDouble() * player.height;
double d9 = d5 + (player.posZ - d5) * d6 + (world.rand.nextDouble() - 0.5D) * player.width * 2.0D;
world.spawnParticle(EnumParticleTypes.PORTAL, d7, d8, d9, f, f1, f2);
}
world.playSound(d3, d4, d5, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F, false);
player.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
return true;
}
}
示例4: teleportTo
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
protected boolean teleportTo(double x, double y, double z) {
EnderTeleportEvent event = new EnderTeleportEvent(this, x, y, z, 0);
if(MinecraftForge.EVENT_BUS.post(event)) {
return false;
}
double d3 = posX;
double d4 = posY;
double d5 = posZ;
posX = event.getTargetX();
posY = event.getTargetY();
posZ = event.getTargetZ();
int xInt = MathHelper.floor(posX);
int yInt = MathHelper.floor(posY);
int zInt = MathHelper.floor(posZ);
boolean flag = false;
if(world.isBlockLoaded(new BlockPos(xInt, yInt, zInt))) {
boolean foundGround = false;
while (!foundGround && yInt > 0) {
IBlockState bs = world.getBlockState(new BlockPos(xInt, yInt - 1, zInt));
if(bs.getMaterial().blocksMovement()) {
foundGround = true;
} else {
--posY;
--yInt;
}
}
if(foundGround) {
setPosition(posX, posY, posZ);
if(world.getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(getEntityBoundingBox())) {
flag = true;
}
}
}
if(!flag) {
setPosition(d3, d4, d5);
return false;
}
short short1 = 128;
for (int l = 0; l < short1; ++l) {
double d6 = l / (short1 - 1.0D);
float f = (rand.nextFloat() - 0.5F) * 0.2F;
float f1 = (rand.nextFloat() - 0.5F) * 0.2F;
float f2 = (rand.nextFloat() - 0.5F) * 0.2F;
double d7 = d3 + (posX - d3) * d6 + (rand.nextDouble() - 0.5D) * width * 2.0D;
double d8 = d4 + (posY - d4) * d6 + rand.nextDouble() * height;
double d9 = d5 + (posZ - d5) * d6 + (rand.nextDouble() - 0.5D) * width * 2.0D;
world.spawnParticle(EnumParticleTypes.PORTAL, d7, d8, d9, f, f1, f2);
}
world.playSound(d3, d4, d5, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.NEUTRAL, 1.0F, 1.0F, false);
playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
return true;
}
示例5: teleportTo
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
public static boolean teleportTo(EntityLivingBase entity, double x, double y, double z, boolean fireEndermanEvent) {
EnderTeleportEvent event = new EnderTeleportEvent(entity, x, y, z, 0);
if (fireEndermanEvent) {
if (MinecraftForge.EVENT_BUS.post(event)) {
return false;
}
}
double origX = entity.posX;
double origY = entity.posY;
double origZ = entity.posZ;
entity.posX = event.getTargetX();
entity.posY = event.getTargetY();
entity.posZ = event.getTargetZ();
int xInt = MathHelper.floor(entity.posX);
int yInt = Math.max(2, MathHelper.floor(entity.posY));
int zInt = MathHelper.floor(entity.posZ);
boolean doTeleport = false;
World worldObj = entity.getEntityWorld();
if (worldObj.isBlockLoaded(new BlockPos(xInt, yInt, zInt), true)) {
boolean foundGround = false;
while (!foundGround && yInt > 2) {
IBlockState bs = worldObj.getBlockState(new BlockPos(xInt, yInt - 1, zInt));
if (bs != null && bs.getBlock() != null && bs.getMaterial().blocksMovement()) {
foundGround = true;
} else {
--entity.posY;
--yInt;
}
}
if (foundGround) {
entity.setPosition(entity.posX, entity.posY, entity.posZ);
if (worldObj.getCollisionBoxes(entity, entity.getEntityBoundingBox()).isEmpty()
&& !worldObj.containsAnyLiquid(entity.getEntityBoundingBox())) {
doTeleport = true;
} else if (yInt <= 0) {
doTeleport = false;
}
}
}
if (!doTeleport) {
entity.setPosition(origX, origY, origZ);
return false;
}
entity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
short short1 = 128;
for (int l = 0; l < short1; ++l) {
double d6 = l / (short1 - 1.0D);
float f = (rand.nextFloat() - 0.5F) * 0.2F;
float f1 = (rand.nextFloat() - 0.5F) * 0.2F;
float f2 = (rand.nextFloat() - 0.5F) * 0.2F;
double d7 = origX + (entity.posX - origX) * d6 + (rand.nextDouble() - 0.5D) * entity.width * 2.0D;
double d8 = origY + (entity.posY - origY) * d6 + rand.nextDouble() * entity.height;
double d9 = origZ + (entity.posZ - origZ) * d6 + (rand.nextDouble() - 0.5D) * entity.width * 2.0D;
worldObj.spawnParticle(EnumParticleTypes.PORTAL, d7, d8, d9, f, f1, f2);
}
worldObj.playSound(origX, origY, origZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.NEUTRAL, 1.0F, 1.0F, false);
entity.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
return true;
}