本文整理匯總了Java中net.minecraft.util.EntityDamageSourceIndirect類的典型用法代碼示例。如果您正苦於以下問題:Java EntityDamageSourceIndirect類的具體用法?Java EntityDamageSourceIndirect怎麽用?Java EntityDamageSourceIndirect使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntityDamageSourceIndirect類屬於net.minecraft.util包,在下文中一共展示了EntityDamageSourceIndirect類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
if (isEntityInvulnerable(source)) {
return false;
}
if ((source instanceof EntityDamageSourceIndirect)) {
for (int i = 0; i < 64; i++) {
}
return false;
}
boolean flag = super.attackEntityFrom(source, amount);
if ((source.isUnblockable()) && (rand.nextInt(10) != 0)) {
teleportRandomly();
}
return flag;
}
示例2: snowballFight
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
public boolean snowballFight(DamageSource damagesource) {
if (damagesource instanceof EntityDamageSourceIndirect) {
EntityDamageSourceIndirect snowdamage = (EntityDamageSourceIndirect) damagesource;
if (snowdamage.getSourceOfDamage() != null && snowdamage
.getSourceOfDamage() instanceof EntitySnowball) {
snowballin += 1;
if (attackTime < 10) {
attackTime = 10;
}
}
}
return snowballin <= 0;
}
示例3: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
@Override
public boolean attackEntityFrom(DamageSource damageSource, float damage) {
if (damageSource instanceof EntityDamageSourceIndirect) {
return false;
}
Entity src = damageSource.getSourceOfDamage();
if (!(src instanceof EntityPlayer)) {
return false;
}
if (isDead) {
return false;
}
EntityPlayer player = (EntityPlayer) src;
if (worldObj.isRemote) return true;
setDead();
if (!PlayerUtil.isPlayerCreative(player)) dropItemsOnBreak();
return true;
}
示例4: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
@Override
public boolean attackEntityFrom(DamageSource source, float damage)
{
if(source instanceof EntityDamageSourceIndirect)
{
EntityDamageSourceIndirect src = (EntityDamageSourceIndirect)source;
if(src.getEntity() != null && src.getEntity() == this)
{
return false;
}
}
if(this.hurtTime == 0)
{
playSound("mob.skeleton.hurt", 1.0F, 1.0F);
}
if(!worldObj.isRemote)
{
System.out.println("Dam: " + damage);
}
return super.attackEntityFrom(source, damage);
}
示例5: onImpact
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
@Override
protected void onImpact(MovingObjectPosition pos) {
if (pos.entityHit instanceof EntityEnderman) return;
if (pos.typeOfHit == MovingObjectType.BLOCK) {
if (worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ).getMaterial().isReplaceable()) return;
}
setDead();
if (!worldObj.isRemote) {
if (pos.entityHit != null && pos.entityHit instanceof EntityLivingBase) {
float min = (float)FarragoMod.config.getDouble("blunderbuss.damage.min");
float max = (float)FarragoMod.config.getDouble("blunderbuss.damage.max");
((EntityLivingBase)pos.entityHit).attackEntityFrom(new EntityDamageSourceIndirect("blunderbuss", this, getThrower()), (rand.nextFloat()*(max-min))+min);
((EntityLivingBase)pos.entityHit).hurtResistantTime = 1;
}
if (worldObj instanceof WorldServer) {
((WorldServer)worldObj).func_147487_a("smoke", pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 1, 0.2f, 0.2f, 0.2f, 0f);
((WorldServer)worldObj).playSoundAtEntity(this, "step.stone", 0.5f, 0.3f);
}
}
}
示例6: func_70097_a
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
if(this.func_85032_ar()) {
return false;
} else {
this.func_70819_e(true);
if(p_70097_1_ instanceof EntityDamageSource && p_70097_1_.func_76346_g() instanceof EntityPlayer) {
this.field_104003_g = true;
}
if(p_70097_1_ instanceof EntityDamageSourceIndirect) {
this.field_104003_g = false;
for(int var3 = 0; var3 < 64; ++var3) {
if(this.func_70820_n()) {
return true;
}
}
return false;
} else {
return super.func_70097_a(p_70097_1_, p_70097_2_);
}
}
}
示例7: onLivingHurt
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
@SubscribeEvent
public void onLivingHurt(LivingHurtEvent event)
{
if(event.source.getEntity() instanceof EntityPlayerMP && !(event.source instanceof EntityDamageSourceIndirect))
{
EntityPlayer player = (EntityPlayer)event.source.getEntity();
MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);
if(info != null && player.getCurrentEquippedItem() == null)
{
for(Ability ab : info.morphAbilities)
{
if(ab instanceof AbilityPotionEffect)
{
AbilityPotionEffect abPot = (AbilityPotionEffect)ab;
event.entityLiving.addPotionEffect(new PotionEffect(abPot.potionId, abPot.duration, abPot.amplifier, abPot.ambient));
}
}
}
}
}
示例8: onHit
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
@Override
public void onHit(EntityThrown entity, RayTraceResult result, boolean isServer) {
if(result.entityHit != null && result.entityHit != entity.getThrower())
{
entity.setDead();
if(result.entityHit.attackEntityFrom(new EntityDamageSourceIndirect("ender_bow", entity, entity.getThrower() == null ? entity : entity.getThrower()).setProjectile(), power * 20f))
entity.playSound(SoundEvents.ENTITY_ARROW_HIT, 1.0F, 1.2F / (itemRand.nextFloat() * 0.2F + 0.9F));
}
}
示例9: livingAttack
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
@SubscribeEvent
public void livingAttack(LivingAttackEvent event) {
if (event.source instanceof EntityDamageSourceIndirect) {
EntityDamageSourceIndirect dmgSrc = (EntityDamageSourceIndirect) event.source;
if (dmgSrc.getSourceOfDamage() instanceof EntityTippedArrow) {
EntityTippedArrow tippedArrow = (EntityTippedArrow) dmgSrc.getSourceOfDamage();
if (!tippedArrow.worldObj.isRemote)
event.entityLiving.addPotionEffect(tippedArrow.getEffect());
}
}
}
示例10: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else if (!this.world.isRemote && !this.isDead)
{
if (source instanceof EntityDamageSourceIndirect && source.getEntity() != null && this.isPassenger(source.getEntity()))
{
return false;
}
else
{
this.setForwardDirection(-this.getForwardDirection());
this.setTimeSinceHit(10);
this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
this.setBeenAttacked();
boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode;
if (flag || this.getDamageTaken() > 40.0F)
{
if (!flag && this.world.getGameRules().getBoolean("doEntityDrops"))
{
this.dropItemWithOffset(this.getItemBoat(), 1, 0.0F);
}
this.setDead();
}
return true;
}
}
else
{
return true;
}
}
示例11: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else if (source instanceof EntityDamageSourceIndirect)
{
for (int i = 0; i < 64; ++i)
{
if (this.teleportRandomly())
{
return true;
}
}
return false;
}
else
{
boolean flag = super.attackEntityFrom(source, amount);
if (source.isUnblockable() && this.rand.nextInt(10) != 0)
{
this.teleportRandomly();
}
return flag;
}
}
示例12: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else if (!this.worldObj.isRemote && !this.isDead)
{
if (source instanceof EntityDamageSourceIndirect && source.getEntity() != null && this.isPassenger(source.getEntity()))
{
return false;
}
else
{
this.setForwardDirection(-this.getForwardDirection());
this.setTimeSinceHit(10);
this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
this.setBeenAttacked();
boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode;
if (flag || this.getDamageTaken() > 40.0F)
{
if (!flag && this.worldObj.getGameRules().getBoolean("doEntityDrops"))
{
this.dropItemWithOffset(this.getItemBoat(), 1, 0.0F);
}
this.setDead();
}
return true;
}
}
else
{
return true;
}
}
示例13: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
public boolean attackEntityFrom(DamageSource source, float amount) {
if (this.isEntityInvulnerable(source)) {
return false;
}
if (!world.isRemote) {
if (source instanceof EntityDamageSourceIndirect) {
redirectArrowAtAttacker(source);
} else {
redirectAttack(source, amount);
}
}
return false;
}
示例14: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
public boolean attackEntityFrom(DamageSource source, float amount) {
if (this.isEntityInvulnerable(source)) {
return false;
}
if (source instanceof EntityDamageSourceIndirect) {
redirectArrowAtAttacker(source);
return false;
} else {
amount = redirectAttack(source, amount);
}
return super.attackEntityFrom(source, amount);
}
示例15: attackEntityFrom
import net.minecraft.util.EntityDamageSourceIndirect; //導入依賴的package包/類
public boolean attackEntityFrom(DamageSource source, float amount) {
if (this.isEntityInvulnerable(source)) {
return false;
}
if (source instanceof EntityDamageSourceIndirect) {
attackDistantAttackerWithBats(source);
}
return super.attackEntityFrom(source, amount);
}