本文整理汇总了Java中net.minecraft.entity.passive.EntityHorse类的典型用法代码示例。如果您正苦于以下问题:Java EntityHorse类的具体用法?Java EntityHorse怎么用?Java EntityHorse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityHorse类属于net.minecraft.entity.passive包,在下文中一共展示了EntityHorse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: songTick
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
@Override
public boolean songTick(EntityPlayer player, ItemStack instrument, int interval, int ticks, int length) {
if (interval == 0 && ticks == 1) {
EnumHand hand = player.getActiveHand();
World world = player.world;
SoundType t = SoundType.getSoundTypeByName(SoundType.AMBIENT.getTag());
if (!world.isRemote) {
EntityHorse horse = new EntityGhostHorse(world);
horse.setHorseSaddled(true);
horse.setTamedBy(player);
horse.setLocationAndAngles(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
world.spawnEntity(horse);
player.startRiding(horse);
NBTTagCompound tag = ItemUtil.getOrCreateTag(instrument);
tag.setInteger("id", horse.getEntityId());
}
player.setActiveHand(hand);
}
return true;
}
示例2: songEnded
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
@Override
public void songEnded(EntityPlayer player, ItemStack instrument, int interval) {
World world = player.world;
player.dismountRidingEntity();
if (!world.isRemote) {
NBTTagCompound tag = ItemUtil.getOrCreateTag(instrument);
if (tag.hasKey("id")) {
int id = tag.getInteger("id");
EntityHorse horse = (EntityHorse) world.getEntityByID(id);
if (horse != null) {
horse.setDead();
}
}
}
}
示例3: preRenderCallback
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
float f = 1.0F;
int i = entitylivingbaseIn.getHorseType();
if (i == 1)
{
f *= 0.87F;
}
else if (i == 2)
{
f *= 0.92F;
}
GlStateManager.scale(f, f, f);
super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
示例4: shouldAttackEntity
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) {
if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) {
if (p_142018_1_ instanceof EntityFrienderman) {
EntityFrienderman frienderman = (EntityFrienderman) p_142018_1_;
if (frienderman.isTamed() && frienderman.getOwner() == p_142018_2_) {
return false;
}
}
return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame();
}
else {
return false;
}
}
示例5: BiomeShrubland
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
public BiomeShrubland() {
super(new BiomeProperties("Shrubland")
.setBaseHeight(0.115f)
.setHeightVariation(0.1f)
.setTemperature(0.77f)
.setRainfall(0.53f)
);
this.setRegistryName(Ref.MODID+":shrubland");
this.decorator.treesPerChunk = 1;
this.decorator.grassPerChunk = 7;
this.decorator.flowersPerChunk = 3;
this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityHorse.class, 2, 2, 4));
Ref.BIOMES.add(this);
}
示例6: updateTask
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
/**
* Updates the task
*/
public void updateTask()
{
DifficultyInstance difficultyinstance = this.horse.worldObj.getDifficultyForLocation(new BlockPos(this.horse));
this.horse.setSkeletonTrap(false);
this.horse.setType(HorseType.SKELETON);
this.horse.setHorseTamed(true);
this.horse.setGrowingAge(0);
this.horse.worldObj.addWeatherEffect(new EntityLightningBolt(this.horse.worldObj, this.horse.posX, this.horse.posY, this.horse.posZ, true));
EntitySkeleton entityskeleton = this.createSkeleton(difficultyinstance, this.horse);
entityskeleton.startRiding(this.horse);
for (int i = 0; i < 3; ++i)
{
EntityHorse entityhorse = this.createHorse(difficultyinstance);
EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, entityhorse);
entityskeleton1.startRiding(entityhorse);
entityhorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
}
}
示例7: createSkeleton
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, EntityHorse p_188514_2_)
{
EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.worldObj);
entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
entityskeleton.hurtResistantTime = 60;
entityskeleton.enablePersistence();
if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
{
entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
}
EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
entityskeleton.worldObj.spawnEntityInWorld(entityskeleton);
return entityskeleton;
}
示例8: preRenderCallback
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
/**
* Allows the render to do state modifications necessary before the model is rendered.
*/
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
float f = 1.0F;
HorseType horsetype = entitylivingbaseIn.getType();
if (horsetype == HorseType.DONKEY)
{
f *= 0.87F;
}
else if (horsetype == HorseType.MULE)
{
f *= 0.92F;
}
GlStateManager.scale(f, f, f);
super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
示例9: shouldAttackEntity
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
public boolean shouldAttackEntity(EntityLivingBase target){
EntityLivingBase owner = getOwner();
if (ConfigValues.HUNTCREEPERS || !(target instanceof EntityCreeper)) {
if (target instanceof EntityWolf) {
EntityWolf entitywolf = (EntityWolf) target;
if (entitywolf.isTamed() && entitywolf.getOwner() == owner || Alliances.getInstance().isAlliedTo(entitywolf.getOwnerId(), getOwnerId()))
return false;
}
if (target instanceof EntityArmyMember)
if ((getAttackMode() < 2 && Enemies.getInstance().isNotEnemiesWith(((EntityArmyMember) target).getOwnerId(), getOwnerId())) || ((EntityArmyMember) target).getOwnerId().equals(getOwnerId()) || Alliances.getInstance().isAlliedTo(((EntityArmyMember) target).getOwnerId(), getOwnerId()))
return false;
return !(target instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target)) && (!(target instanceof EntityHorse) || !((EntityHorse) target).isTame());
} else
return false;
}
示例10: func_142018_a
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
@Override
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
{
if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
{
if (par1EntityLivingBase instanceof EntitySlimeling)
{
EntitySlimeling slimeling = (EntitySlimeling) par1EntityLivingBase;
if (slimeling.isTamed() && slimeling.getOwner() == par2EntityLivingBase)
{
return false;
}
}
return !(par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase)) && (!(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame());
}
else
{
return false;
}
}
示例11: onGuiOpen
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
GuiScreen gui = event.getGui();
if(gui !=null && gui instanceof GuiScreenHorseInventory){
GuiScreenHorseInventory horseGui = (GuiScreenHorseInventory)gui;
EntityHorse horse = (EntityHorse)ReflectionUtils.getPrivateValue(horseGui, GuiScreenHorseInventory.class, ObfuscatedNames.GuiScreenHorseInventory_horseEntity);
if(horse !=null && HorseAccessories.hasEnderChest(horse)){
ContainerHorseChest animalchest = new ContainerHorseChest("HorseChest", 2);
animalchest.setCustomName(horse.getName());
event.setGui(new GuiHorseEnderChest(CrystalMod.proxy.getClientPlayer().inventory, animalchest, horse));
PacketGuiMessage pkt = new PacketGuiMessage("Gui");
pkt.setOpenGui(GuiHandler.GUI_ID_ENTITY, horse.getEntityId(), 0, 0);
CrystalModNetwork.sendToServer(pkt);
}
}
}
示例12: moveToAttackTarget
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
private void moveToAttackTarget(EntityMinionWarrior minion)
{
final EntityLiving entityPathController = (EntityLiving) (minion.getRidingEntity() instanceof EntityHorse ? minion.getRidingEntity() : minion);
float speed = entityPathController instanceof EntityHorse ? MinionConstants.SPEED_HORSE_RUN : MinionConstants.SPEED_WALK;
if (entityPathController instanceof EntityHorse)
{
final EntityHorse horse = (EntityHorse) entityPathController;
//This makes the horse move properly.
if (horse.isHorseSaddled())
{
horse.setHorseSaddled(false);
}
}
if(minion.getNavigator().noPath())
entityPathController.getNavigator().tryMoveToEntityLiving(attackTarget, speed);
}
示例13: onInitialSpawn
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) {
livingdata = super.onInitialSpawn(difficulty, livingdata);
int i;
if (livingdata instanceof EntityHorse.GroupData) {
i = ((EntityHorse.GroupData) livingdata).variant;
} else {
i = this.rand.nextInt(7);
livingdata = new EntityHorse.GroupData(i);
}
this.setHorseVariant(i | this.rand.nextInt(5) << 8);
return livingdata;
}
示例14: setNbt
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
public static void setNbt(AbstractHorse horse, NBTTagCompound nbt) {
setName(horse, nbt);
EnumHorseType horseType = getHorseType(horse);
nbt.setInteger("HorseType", horseType.ordinal());
int variant = 0;
if (horseType == EnumHorseType.HORSE) {
variant = ((EntityHorse) horse).getHorseVariant();
}
nbt.setInteger("Variant", variant);
AbstractAttributeMap attrMap = horse.getAttributeMap();
nbt.setDouble("Max Health", attrMap.getAttributeInstanceByName("Max Health").getAttributeValue());
nbt.setDouble("Movement Speed", attrMap.getAttributeInstanceByName("Movement Speed").getAttributeValue());
nbt.setDouble("Jump Strength", attrMap.getAttributeInstanceByName("Jump Strength").getAttributeValue());
}
示例15: getAnimalWrapper
import net.minecraft.entity.passive.EntityHorse; //导入依赖的package包/类
/**
* @param entity
* the entity to be wrapped
* @return
* return a nicely wrapped entity ready to be exploited in many many ways
*/
public static IAnimalWrapper getAnimalWrapper(EntityAnimal entity) {
IAnimalWrapper wrapper = null;
if (entity instanceof EntityHorse) {
wrapper = new VanillaHorse((EntityHorse) entity);
}
if ((entity instanceof EntityCow) && entity.getClass().getName().equals("com.robrit.moofluids.common.entity.EntityFluidCow")) {
wrapper = new MooFluidCow((EntityCow)entity);
}
if (wrapper == null) {
wrapper = new VanillaGenericAnimal(entity);
}
return wrapper;
}