当前位置: 首页>>代码示例>>Java>>正文


Java AbstractHorse类代码示例

本文整理汇总了Java中net.minecraft.entity.passive.AbstractHorse的典型用法代码示例。如果您正苦于以下问题:Java AbstractHorse类的具体用法?Java AbstractHorse怎么用?Java AbstractHorse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AbstractHorse类属于net.minecraft.entity.passive包,在下文中一共展示了AbstractHorse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateTask

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
/**
 * Updates the task
 */
public void updateTask()
{
    DifficultyInstance difficultyinstance = this.horse.world.getDifficultyForLocation(new BlockPos(this.horse));
    this.horse.func_190691_p(false);
    this.horse.setHorseTamed(true);
    this.horse.setGrowingAge(0);
    this.horse.world.addWeatherEffect(new EntityLightningBolt(this.horse.world, 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)
    {
        AbstractHorse abstracthorse = this.createHorse(difficultyinstance);
        EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, abstracthorse);
        entityskeleton1.startRiding(abstracthorse);
        abstracthorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EntityAISkeletonRiders.java

示例2: createSkeleton

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, AbstractHorse p_188514_2_)
{
    EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.world);
    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).func_190926_b())
    {
        entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
    }

    entityskeleton.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false));
    entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false));
    entityskeleton.world.spawnEntityInWorld(entityskeleton);
    return entityskeleton;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:EntityAISkeletonRiders.java

示例3: addEnderChest

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
public static boolean addEnderChest(AbstractHorse horse){
  	if(horse == null || !(horse instanceof AbstractChestHorse) || horse.getGrowingAge() != 0 
|| hasEnderChest(horse)) return false;
  	
  	AbstractChestHorse horseChest = (AbstractChestHorse)horse;
  	
  	if(horseChest.hasChest()){
  		ContainerHorseChest chest = getHorseChest(horse);
  		if (!horse.world.isRemote && chest != null)
          {
              for (int i = 0; i < chest.getSizeInventory(); ++i)
              {
                  ItemStack itemstack = chest.getStackInSlot(i);

                  if (!itemstack.isEmpty())
                  {
                      horse.entityDropItem(itemstack, 0.0F);
                  }
              }
          }
  	}
  	
  	setHasEnderChest(horse, true);
  	return true;
  }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:26,代码来源:HorseAccessories.java

示例4: setNbt

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的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());
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:18,代码来源:HorseCorpseHelper.java

示例5: getCorpse

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
public static List<ItemStack> getCorpse(Entity entity, EnumCorpse type) {
    NBTTagCompound nbtTag = new NBTTagCompound();
    switch (type) {
        case VILLAGER:
            VillagerCorpseHelper.setNbt((EntityVillager) entity, nbtTag);
            break;
        case HORSE:
            HorseCorpseHelper.setNbt((AbstractHorse) entity, nbtTag);
            break;
        case DOG:
            DogCorpseHelper.setNbt((EntityWolf) entity, nbtTag);
            break;
        case CAT:
            CatCorpseHelper.setNbt((EntityOcelot) entity, nbtTag);
            break;
    }

    List<ItemStack> corpse = new ArrayList<>();
    ItemStack stack = new ItemStack(GSBlock.CORPSE, 1, type.ordinal());
    stack.setTagCompound(nbtTag);
    corpse.add(stack);
    return corpse;
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:24,代码来源:CorpseHelper.java

示例6: onEntityInteractEvent

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
@SubscribeEvent
public void onEntityInteractEvent(EntityInteract event) {
  if (event.getEntity() instanceof EntityPlayer == false) {
    return;
  }
  EntityPlayer player = (EntityPlayer) event.getEntity();
  //    ItemStack held = player.getHeldItemMainhand();
  ItemStack itemstack = event.getItemStack();
  if (itemstack != null && itemstack.getItem() instanceof ItemAppleLapis && itemstack.getCount() > 0) {
    if (event.getTarget() instanceof EntityZombieHorse || event.getTarget() instanceof EntitySkeletonHorse) {
      AbstractHorse h = (AbstractHorse) event.getTarget();
      if (h.isTame() == false) {
        h.setTamedBy(player);
        h.setEatingHaystack(true);
        //        UtilChat.addChatMessage(player, UtilChat.lang("item.apple_emerald.merchant"));
        itemstack.shrink(1);
        if (itemstack.getCount() == 0) {
          itemstack = ItemStack.EMPTY;
        }
        event.setCanceled(true);// stop the GUI inventory opening && horse mounting
      }
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:25,代码来源:ItemAppleLapis.java

示例7: register

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
public static void register() {
  for (Field f : AbstractHorse.class.getDeclaredFields()) {
    try {
      if (f.getName().equals("JUMP_STRENGTH") || f.getName().equals("field_110270_bw") || "interface net.minecraft.entity.ai.attributes.IAttribute".equals(f.getType() + "")) {
        f.setAccessible(true);
        // save pointer to the obj so we can reference it later
        horseJumpStrength = (IAttribute) f.get(null);
        break;
      }
    }
    catch (Exception e) {
      ModCyclic.logger.error("Severe error, please report this to the mod author [ JUMP_STRENGTH ]:");
      ModCyclic.logger.error(e.getStackTrace().toString());
    }
  }
  if (horseJumpStrength == null) {
    ModCyclic.logger.error(Const.MODID + ": JUMP_STRENGTH : Error - field not found using reflection");
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:20,代码来源:ReflectionRegistry.java

示例8: preChildEntHeadRenderCalls

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
@Override
public void preChildEntHeadRenderCalls(AbstractHorse living, RenderLivingBase render)
{
    if(living.isChild()) //I don't like this if statement any more than you do.
    {
        float modelScale = 0.0625F;
        if(iChunUtil.config.horseEasterEgg == 1)
        {
            GlStateManager.scale(0.625F, 0.45454544F, 0.45454544F);
            GlStateManager.translate(0.0F, 33.0F * modelScale, 0.0F);
        }
        else
        {
            GlStateManager.scale(0.71428573F, 0.64935064F, 0.7936508F);
            GlStateManager.translate(0.0F, 21.0F * modelScale, 0.22F);
        }
    }
}
 
开发者ID:iChun,项目名称:iChunUtil,代码行数:19,代码来源:HeadLlama.java

示例9: onLivingUpdate

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
    if (EntityUtils.isDrivenByPlayer(event.getEntity()) && getRidingEntity() instanceof AbstractHorse) {

        IAttribute JUMP_STRENGTH = FastReflection.Fields.AbstractHorse_JUMP_STRENGTH.get(getRidingEntity());
        IAttribute MOVEMENT_SPEED = FastReflection.Fields.SharedMonsterAttributes_MOVEMENT_SPEED.get(getRidingEntity());

        ((EntityLivingBase) getRidingEntity()).getEntityAttribute(JUMP_STRENGTH).setBaseValue(jumpHeight.getAsDouble());
        ((EntityLivingBase) getRidingEntity()).getEntityAttribute(MOVEMENT_SPEED).setBaseValue(speed.getAsDouble());
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:12,代码来源:HorseStats.java

示例10: openGuiHorseInventory

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
@Override
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn) {
	if (m_realPlayer == null) {
		super.openGuiHorseInventory(horse, inventoryIn);
	} else {
		syncToRealPlayer();
		m_realPlayer.openGuiHorseInventory(horse, inventoryIn);
		syncPublicFieldsFromReal();
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:11,代码来源:EntityPlayerMPProxy.java

示例11: openGuiHorseInventory

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
@Override
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn) {
	if (m_realPlayer == null) {
		super.openGuiHorseInventory(horse, inventoryIn);
	} else {
		m_realPlayer.openGuiHorseInventory(horse, inventoryIn);
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:9,代码来源:EntityPlayerProxy.java

示例12: openGuiHorseInventory

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    this.getNextWindowId();
    this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "EntityHorse", inventoryIn.getDisplayName(), inventoryIn.getSizeInventory(), horse.getEntityId()));
    this.openContainer = new ContainerHorseInventory(this.inventory, inventoryIn, horse, this);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addListener(this);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:14,代码来源:EntityPlayerMP.java

示例13: addMountedMovementStat

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
/**
 * Adds a value to a mounted movement statistic field - by minecart, boat, or pig.
 */
private void addMountedMovementStat(double p_71015_1_, double p_71015_3_, double p_71015_5_)
{
    if (this.isRiding())
    {
        int i = Math.round(MathHelper.sqrt(p_71015_1_ * p_71015_1_ + p_71015_3_ * p_71015_3_ + p_71015_5_ * p_71015_5_) * 100.0F);

        if (i > 0)
        {
            if (this.getRidingEntity() instanceof EntityMinecart)
            {
                this.addStat(StatList.MINECART_ONE_CM, i);

                if (this.startMinecartRidingCoordinate == null)
                {
                    this.startMinecartRidingCoordinate = new BlockPos(this);
                }
                else if (this.startMinecartRidingCoordinate.distanceSq((double)MathHelper.floor(this.posX), (double)MathHelper.floor(this.posY), (double)MathHelper.floor(this.posZ)) >= 1000000.0D)
                {
                    this.addStat(AchievementList.ON_A_RAIL);
                }
            }
            else if (this.getRidingEntity() instanceof EntityBoat)
            {
                this.addStat(StatList.BOAT_ONE_CM, i);
            }
            else if (this.getRidingEntity() instanceof EntityPig)
            {
                this.addStat(StatList.PIG_ONE_CM, i);
            }
            else if (this.getRidingEntity() instanceof AbstractHorse)
            {
                this.addStat(StatList.HORSE_ONE_CM, i);
            }
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:40,代码来源:EntityPlayer.java

示例14: handleOpenWindow

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
/**
 * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table,
 * Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse
 */
public void handleOpenWindow(SPacketOpenWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayerSP entityplayersp = this.gameController.player;

    if ("minecraft:container".equals(packetIn.getGuiId()))
    {
        entityplayersp.displayGUIChest(new InventoryBasic(packetIn.getWindowTitle(), packetIn.getSlotCount()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else if ("minecraft:villager".equals(packetIn.getGuiId()))
    {
        entityplayersp.displayVillagerTradeGui(new NpcMerchant(entityplayersp, packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else if ("EntityHorse".equals(packetIn.getGuiId()))
    {
        Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

        if (entity instanceof AbstractHorse)
        {
            entityplayersp.openGuiHorseInventory((AbstractHorse)entity, new ContainerHorseChest(packetIn.getWindowTitle(), packetIn.getSlotCount()));
            entityplayersp.openContainer.windowId = packetIn.getWindowId();
        }
    }
    else if (!packetIn.hasSlots())
    {
        entityplayersp.displayGui(new LocalBlockIntercommunication(packetIn.getGuiId(), packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else
    {
        IInventory iinventory = new ContainerLocalMenu(packetIn.getGuiId(), packetIn.getWindowTitle(), packetIn.getSlotCount());
        entityplayersp.displayGUIChest(iinventory);
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:42,代码来源:NetHandlerPlayClient.java

示例15: createHorse

import net.minecraft.entity.passive.AbstractHorse; //导入依赖的package包/类
private AbstractHorse createHorse(DifficultyInstance p_188515_1_)
{
    EntitySkeletonHorse entityskeletonhorse = new EntitySkeletonHorse(this.horse.world);
    entityskeletonhorse.onInitialSpawn(p_188515_1_, (IEntityLivingData)null);
    entityskeletonhorse.setPosition(this.horse.posX, this.horse.posY, this.horse.posZ);
    entityskeletonhorse.hurtResistantTime = 60;
    entityskeletonhorse.enablePersistence();
    entityskeletonhorse.setHorseTamed(true);
    entityskeletonhorse.setGrowingAge(0);
    entityskeletonhorse.world.spawnEntityInWorld(entityskeletonhorse);
    return entityskeletonhorse;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:EntityAISkeletonRiders.java


注:本文中的net.minecraft.entity.passive.AbstractHorse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。