本文整理匯總了Java中net.minecraft.entity.passive.EntityTameable類的典型用法代碼示例。如果您正苦於以下問題:Java EntityTameable類的具體用法?Java EntityTameable怎麽用?Java EntityTameable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntityTameable類屬於net.minecraft.entity.passive包,在下文中一共展示了EntityTameable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onHackFinished
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
@Override
public void onHackFinished(Entity entity, EntityPlayer player) {
EntityTameable tameable = (EntityTameable) entity;
if (entity.world.isRemote) {
tameable.handleStatusUpdate((byte) 7);
} else {
tameable.getNavigator().clearPath();
tameable.setAttackTarget(null);
tameable.setHealth(20.0F);
tameable.setOwnerId(player.getUniqueID());
entity.world.setEntityState(tameable, (byte) 7);
tameable.setTamed(true);
// TODO: code smell
// Would be better to have a HackableOcelot subclass, but HackableHandler.getHackableForEntity() isn't
// set up to prioritise getting an ocelot over a generic tameable.
if (entity instanceof EntityOcelot) {
((EntityOcelot) entity).setTameSkin(1 + entity.getEntityWorld().rand.nextInt(3));
}
}
}
示例2: shouldEat
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
private boolean shouldEat()
{
if(!Wrapper.getPlayer().canEat(false))
return false;
if(Wrapper.getMinecraft().currentScreen != null)
return false;
if(Wrapper.getMinecraft().currentScreen == null && Wrapper.getMinecraft().objectMouseOver != null)
{
Entity entity = Wrapper.getMinecraft().objectMouseOver.entityHit;
if(entity instanceof EntityVillager || entity instanceof EntityTameable)
return false;
if(Wrapper.getMinecraft().objectMouseOver.getBlockPos() != null && Wrapper.getWorld().
getBlockState(Wrapper.getMinecraft().objectMouseOver.getBlockPos()).getBlock() instanceof BlockContainer)
return false;
}
return true;
}
示例3: alertOthers
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
protected void alertOthers()
{
double d0 = this.getTargetDistance();
for (EntityCreature entitycreature : this.taskOwner.world.getEntitiesWithinAABB(this.taskOwner.getClass(), (new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D)).expand(d0, 10.0D, d0)))
{
if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && (!(this.taskOwner instanceof EntityTameable) || ((EntityTameable)this.taskOwner).getOwner() == ((EntityTameable)entitycreature).getOwner()) && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
{
boolean flag = false;
for (Class<?> oclass : this.targetClasses)
{
if (entitycreature.getClass() == oclass)
{
flag = true;
break;
}
}
if (!flag)
{
this.setEntityAttackTarget(entitycreature, this.taskOwner.getAITarget());
}
}
}
}
示例4: alertOthers
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
protected void alertOthers()
{
double d0 = this.getTargetDistance();
for (EntityCreature entitycreature : this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), (new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D)).expand(d0, 10.0D, d0)))
{
if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && (!(this.taskOwner instanceof EntityTameable) || ((EntityTameable)this.taskOwner).getOwner() == ((EntityTameable)entitycreature).getOwner()) && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
{
boolean flag = false;
for (Class<?> oclass : this.targetClasses)
{
if (entitycreature.getClass() == oclass)
{
flag = true;
break;
}
}
if (!flag)
{
this.setEntityAttackTarget(entitycreature, this.taskOwner.getAITarget());
}
}
}
}
示例5: onKillEntity
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
@Override
public void onKillEntity(net.minecraft.entity.EntityLivingBase entity)
{
super.onKillEntity(entity);
if (!(entity instanceof EntityTameable))
{
PacketExpToClient packet;
this.experience_to_get += entity.getMaxHealth() * 6;
packet = new PacketExpToClient(this.experience_to_get);
Packets.network.sendTo(packet, this.player);
if (entity instanceof EntityOrc || entity instanceof EntityMageOrc)
this.getPlayer().triggerAchievement(AchievementList.ORC_SLAYER);
else if (entity instanceof EntityBossOrc)
this.getPlayer().triggerAchievement(AchievementList.ORC_BOSS);
}
}
示例6: performEffect
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
@Override
public void performEffect(EntityLivingBase entity, int amplifier) {
if (entity != null) {
List<EntityLivingBase> mobsList = entity.world.getEntitiesWithinAABB(EntityLivingBase.class,
new AxisAlignedBB(entity.posX - 3, entity.posY - 3, entity.posZ - 3,
entity.posX + 3, entity.posY + 3, entity.posZ + 3));
for (EntityLivingBase mob : mobsList) {
if (!(mob instanceof EntityTameable && ((EntityTameable) mob).isTamed() || !ExtendedConfig.infernoDealsDamageToPlayers && mob instanceof EntityPlayer)) {
mob.setFire(10);
}
}
entity.world.spawnParticle(EnumParticleTypes.FLAME, entity.posX + 1, entity.posY + 1, entity.posZ, 0, 0, 0);
entity.world.spawnParticle(EnumParticleTypes.FLAME, entity.posX - 1, entity.posY + 1, entity.posZ, 0, 0, 0);
entity.world.spawnParticle(EnumParticleTypes.FLAME, entity.posX, entity.posY + 1, entity.posZ + 1, 0, 0, 0);
entity.world.spawnParticle(EnumParticleTypes.FLAME, entity.posX, entity.posY + 1, entity.posZ - 1, 0, 0, 0);
}
}
示例7: isEntityApplicable
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
@Override
public boolean isEntityApplicable(Entity var1) {
// This class lets the minion know if they should attack the mob they
// are looking at or not.
// Never attack the owner, even if he attacks them.
if (var1 != owner) {
if (var1 instanceof EntityTameable) {
if (((EntityTameable) var1).getOwner() != owner) {
return true;
} else {
return false;
}
}
if (var1 instanceof IMob) {
return true;
}
}
return false;
}
示例8: func_190105_f
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
protected void func_190105_f()
{
double d0 = this.getTargetDistance();
for (EntityCreature entitycreature : this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), (new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D)).expand(d0, 10.0D, d0)))
{
if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && (!(this.taskOwner instanceof EntityTameable) || ((EntityTameable)this.taskOwner).getOwner() == ((EntityTameable)entitycreature).getOwner()) && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
{
boolean flag = false;
for (Class<?> oclass : this.targetClasses)
{
if (entitycreature.getClass() == oclass)
{
flag = true;
break;
}
}
if (!flag)
{
this.setEntityAttackTarget(entitycreature, this.taskOwner.getAITarget());
}
}
}
}
示例9: func_142018_a
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
@Override
public boolean func_142018_a(EntityLivingBase target, EntityLivingBase owner) {
if (!(target instanceof EntityCreeper) && !(target instanceof EntityGhast)) {
if (target instanceof EntityTameable) {
EntityTameable entityTameable = (EntityTameable) target;
if (entityTameable.isTamed() && entityTameable.getOwner() == owner) {
return false;
}
}
return target instanceof EntityPlayer && owner instanceof EntityPlayer
&& !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target) ? false
: !(target instanceof EntityHorse) || !((EntityHorse) target).isTame();
} else {
return false;
}
}
示例10: EntityAITamedNearestAttackableTarget
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
public EntityAITamedNearestAttackableTarget(EntityTameable p_i1665_1_, Class p_i1665_2_, int p_i1665_3_, boolean p_i1665_4_, boolean p_i1665_5_, final IEntitySelector p_i1665_6_) {
super(p_i1665_1_, p_i1665_4_, p_i1665_5_);
this.tameable = p_i1665_1_;
this.targetClass = p_i1665_2_;
this.targetChance = p_i1665_3_;
this.theNearestAttackableTargetSorter = new EntityAITamedNearestAttackableTarget.Sorter(p_i1665_1_);
this.setMutexBits(1);
this.targetEntitySelector = new IEntitySelector() {
private static final String __OBFID = "CL_00001621";
/**
* Return whether the specified entity is applicable to this filter.
*/
public boolean isEntityApplicable(Entity p_82704_1_) {
return p_82704_1_ instanceof EntityLivingBase && (p_i1665_6_ != null && !p_i1665_6_.isEntityApplicable(p_82704_1_) ? false : EntityAITamedNearestAttackableTarget.this.isSuitableTarget((EntityLivingBase) p_82704_1_, false));
}
};
}
示例11: onWornTick
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
@Override
public boolean onWornTick(World world, ItemStack stack, EntityLivingBase entity) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
double x = player.posX;
double y = player.posY;
double z = player.posZ;
List<EntityTameable> entities = player.worldObj.getEntitiesWithinAABB(EntityTameable.class, AxisAlignedBB.getBoundingBox(x - 8, y - 8, z - 8, x + 8, y + 8, z + 8));
for (EntityTameable entityTame : entities) {
if (!player.worldObj.isRemote) {
if (player.worldObj.rand.nextInt(60) == 0 && entityTame.isTamed()) {
entityTame.heal(1);
return true;
}
}
}
}
return false;
}
示例12: onWornTick
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
@Override
public int onWornTick(ItemStack stack, EntityLivingBase entity, ITrinket item) {
if (!entity.worldObj.isRemote) {
List<EntityTameable> entities = getEntitiesAround(entity, 8, EntityTameable.class);
for (EntityTameable entityTame : entities) {
if (entity.worldObj.rand.nextInt(60) == 0 && entityTame.isTamed() && hasEnergy(item, stack, getUsage())) {
entityTame.heal(1);
return getUsage();
}
}
}
return 0;
}
示例13: func_130002_c
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
public final boolean func_130002_c(EntityPlayer p_130002_1_) {
if(this.func_110167_bD() && this.func_110166_bE() == p_130002_1_) {
this.func_110160_i(true, !p_130002_1_.field_71075_bZ.field_75098_d);
return true;
} else {
ItemStack var2 = p_130002_1_.field_71071_by.func_70448_g();
if(var2 != null && var2.field_77993_c == Item.field_111214_ch.field_77779_bT && this.func_110164_bC()) {
if(!(this instanceof EntityTameable) || !((EntityTameable)this).func_70909_n()) {
this.func_110162_b(p_130002_1_, true);
--var2.field_77994_a;
return true;
}
if(p_130002_1_.func_70005_c_().equalsIgnoreCase(((EntityTameable)this).func_70905_p())) {
this.func_110162_b(p_130002_1_, true);
--var2.field_77994_a;
return true;
}
}
return this.func_70085_c(p_130002_1_)?true:super.func_130002_c(p_130002_1_);
}
}
示例14: addDefaultEntries
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
public static void addDefaultEntries(){
PneumaticRegistry.getInstance().addHackable(Blocks.tnt, HackableTNT.class);
PneumaticRegistry.getInstance().addHackable(Blocks.mob_spawner, HackableMobSpawner.class);
PneumaticRegistry.getInstance().addHackable(Blocks.lever, HackableLever.class);
PneumaticRegistry.getInstance().addHackable(Blocks.stone_button, HackableButton.class);
PneumaticRegistry.getInstance().addHackable(Blocks.wooden_button, HackableButton.class);
PneumaticRegistry.getInstance().addHackable(Blocks.wooden_door, HackableDoor.class);
PneumaticRegistry.getInstance().addHackable(Blocks.tripwire_hook, HackableTripwire.class);
PneumaticRegistry.getInstance().addHackable(Blocks.dispenser, HackableDispenser.class);
PneumaticRegistry.getInstance().addHackable(Blocks.dropper, HackableDispenser.class);
PneumaticRegistry.getInstance().addHackable(Blockss.securityStation, HackableSecurityStation.class);
PneumaticRegistry.getInstance().addHackable(Blocks.monster_egg, HackableTripwire.class);
PneumaticRegistry.getInstance().addHackable(Blocks.noteblock, HackableNoteblock.class);
PneumaticRegistry.getInstance().addHackable(Blocks.jukebox, HackableJukebox.class);
PneumaticRegistry.getInstance().addHackable(EntityCreeper.class, HackableCreeper.class);
PneumaticRegistry.getInstance().addHackable(EntityTameable.class, HackableTameable.class);
PneumaticRegistry.getInstance().addHackable(EntityCow.class, HackableCow.class);
PneumaticRegistry.getInstance().addHackable(EntityCaveSpider.class, HackableCaveSpider.class);
PneumaticRegistry.getInstance().addHackable(EntityBlaze.class, HackableBlaze.class);
PneumaticRegistry.getInstance().addHackable(EntityGhast.class, HackableGhast.class);
PneumaticRegistry.getInstance().addHackable(EntityWitch.class, HackableWitch.class);
PneumaticRegistry.getInstance().addHackable(EntityLiving.class, HackableLivingDisarm.class);
PneumaticRegistry.getInstance().addHackable(EntityEnderman.class, HackableEnderman.class);
PneumaticRegistry.getInstance().addHackable(EntityBat.class, HackableBat.class);
}
示例15: createFromNative
import net.minecraft.entity.passive.EntityTameable; //導入依賴的package包/類
public static ScriptEntity createFromNative(Entity entity) {
if (entity instanceof EntityPlayer)
return new ScriptPlayer((EntityPlayer)entity);
if (entity instanceof EntityOcelot)
return new ScriptOcelot((EntityOcelot)entity);
if (entity instanceof EntityWolf)
return new ScriptWolf((EntityWolf)entity);
if (entity instanceof EntityTameable)
return new ScriptEntityTameable((EntityTameable)entity);
if (entity instanceof EntityPig)
return new ScriptPig((EntityPig)entity);
if (entity instanceof EntitySheep)
return new ScriptSheep((EntitySheep)entity);
if (entity instanceof EntityVillager)
return new ScriptVillager((EntityVillager)entity);
if (entity instanceof EntityAgeable)
return new ScriptEntityAgeable((EntityAgeable)entity);
if (entity instanceof EntityLivingBase)
return new ScriptEntityLivingBase((EntityLivingBase)entity);
return new ScriptEntity(entity);
}