本文整理匯總了Java中net.minecraft.entity.player.EntityPlayerMP.isPlayerSleeping方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityPlayerMP.isPlayerSleeping方法的具體用法?Java EntityPlayerMP.isPlayerSleeping怎麽用?Java EntityPlayerMP.isPlayerSleeping使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.player.EntityPlayerMP
的用法示例。
在下文中一共展示了EntityPlayerMP.isPlayerSleeping方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onImpact
import net.minecraft.entity.player.EntityPlayerMP; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition p_70184_1_)
{
EntityLivingBase entitylivingbase = this.getThrower();
if (p_70184_1_.entityHit != null)
{
if (p_70184_1_.entityHit == this.field_181555_c)
{
return;
}
p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, entitylivingbase), 0.0F);
}
for (int i = 0; i < 32; ++i)
{
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian(), new int[0]);
}
if (!this.worldObj.isRemote)
{
if (entitylivingbase instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)entitylivingbase;
if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping())
{
if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getBoolean("doMobSpawning"))
{
EntityEndermite entityendermite = new EntityEndermite(this.worldObj);
entityendermite.setSpawnedByPlayer(true);
entityendermite.setLocationAndAngles(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, entitylivingbase.rotationYaw, entitylivingbase.rotationPitch);
this.worldObj.spawnEntityInWorld(entityendermite);
}
if (entitylivingbase.isRiding())
{
entitylivingbase.mountEntity((Entity)null);
}
entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ);
entitylivingbase.fallDistance = 0.0F;
entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F);
}
}
else if (entitylivingbase != null)
{
entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ);
entitylivingbase.fallDistance = 0.0F;
}
this.setDead();
}
}
示例2: onImpact
import net.minecraft.entity.player.EntityPlayerMP; //導入方法依賴的package包/類
@Override
protected void onImpact(RayTraceResult result) {
EntityLivingBase entitylivingbase = getThrower();
if (result.entityHit != null) {
if (result.entityHit == thrower) {
return;
}
else {
if (entitylivingbase != null && result.entityHit instanceof EntityCreature && !(result.entityHit instanceof EntityMob)) {
EntityCreature passiveEntity = (EntityCreature) result.entityHit;
passiveEntity.setPositionAndUpdate(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ);
passiveEntity.fallDistance = 0.0F;
setDead();
return;
}
}
}
if (result.typeOfHit == RayTraceResult.Type.BLOCK) {
BlockPos blockpos = result.getBlockPos();
TileEntity tileentity = EasyMappings.world(this).getTileEntity(blockpos);
if (tileentity instanceof TileEntityEndGateway) {
TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway) tileentity;
if (entitylivingbase != null) {
tileentityendgateway.teleportEntity(entitylivingbase);
setDead();
return;
}
tileentityendgateway.teleportEntity(this);
return;
}
}
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
for (int i = 0; i < 32; ++i) {
ParticleUtil.spawn(EnumParticles.LOVE, EasyMappings.world(this), posX, posY + rand.nextDouble() * 2.0D, posZ, rand.nextGaussian(), 0.0D, rand.nextGaussian());
}
}
if (!EasyMappings.world(this).isRemote) {
if (entitylivingbase instanceof EntityPlayerMP) {
EntityPlayerMP entityplayermp = (EntityPlayerMP) entitylivingbase;
if (entityplayermp.connection.getNetworkManager().isChannelOpen() && EasyMappings.world(entityplayermp) == EasyMappings.world(this) && !entityplayermp.isPlayerSleeping()) {
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, posX, posY, posZ, 5.0F);
if (!MinecraftForge.EVENT_BUS.post(event)) {
if (entitylivingbase.isRiding()) {
entitylivingbase.dismountRidingEntity();
}
entitylivingbase.setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ());
entitylivingbase.fallDistance = 0.0F;
}
}
}
else if (entitylivingbase != null) {
entitylivingbase.setPositionAndUpdate(posX, posY, posZ);
entitylivingbase.fallDistance = 0.0F;
}
setDead();
}
}
示例3: onImpact
import net.minecraft.entity.player.EntityPlayerMP; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(RayTraceResult result)
{
EntityLivingBase entitylivingbase = this.getThrower();
if (result.entityHit != null)
{
if (result.entityHit == this.thrower)
{
return;
}
result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, entitylivingbase), 0.0F);
}
if (result.typeOfHit == RayTraceResult.Type.BLOCK)
{
BlockPos blockpos = result.getBlockPos();
TileEntity tileentity = this.world.getTileEntity(blockpos);
if (tileentity instanceof TileEntityEndGateway)
{
TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway)tileentity;
if (entitylivingbase != null)
{
tileentityendgateway.teleportEntity(entitylivingbase);
this.setDead();
return;
}
tileentityendgateway.teleportEntity(this);
return;
}
}
for (int i = 0; i < 32; ++i)
{
this.world.spawnParticle(EnumParticleTypes.PORTAL, this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian(), new int[0]);
}
if (!this.world.isRemote)
{
if (entitylivingbase instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)entitylivingbase;
if (entityplayermp.connection.getNetworkManager().isChannelOpen() && entityplayermp.world == this.world && !entityplayermp.isPlayerSleeping())
{
if (this.rand.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning"))
{
EntityEndermite entityendermite = new EntityEndermite(this.world);
entityendermite.setSpawnedByPlayer(true);
entityendermite.setLocationAndAngles(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, entitylivingbase.rotationYaw, entitylivingbase.rotationPitch);
this.world.spawnEntityInWorld(entityendermite);
}
if (entitylivingbase.isRiding())
{
entitylivingbase.dismountRidingEntity();
}
entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ);
entitylivingbase.fallDistance = 0.0F;
entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F);
}
}
else if (entitylivingbase != null)
{
entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ);
entitylivingbase.fallDistance = 0.0F;
}
this.setDead();
}
}