Java 类net.minecraft.entity.passive.AbstractHorse 实例源码

项目:Backmemed    文件:EntityAISkeletonRiders.java   
/**
 * 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);
    }
}
项目:Backmemed    文件:EntityAISkeletonRiders.java   
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;
}
项目:CrystalMod    文件:HorseAccessories.java   
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;
  }
项目:Gravestone-mod-Extended    文件:HorseCorpseHelper.java   
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());
}
项目:Gravestone-mod-Extended    文件:CorpseHelper.java   
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;
}
项目:Cyclic    文件:ItemAppleLapis.java   
@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
      }
    }
  }
}
项目:Cyclic    文件:ReflectionRegistry.java   
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");
  }
}
项目:iChunUtil    文件:HeadLlama.java   
@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);
        }
    }
}
项目:ForgeHax    文件:HorseStats.java   
@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());
    }
}
项目:UniversalRemote    文件:EntityPlayerMPProxy.java   
@Override
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn) {
    if (m_realPlayer == null) {
        super.openGuiHorseInventory(horse, inventoryIn);
    } else {
        syncToRealPlayer();
        m_realPlayer.openGuiHorseInventory(horse, inventoryIn);
        syncPublicFieldsFromReal();
    }
}
项目:UniversalRemote    文件:EntityPlayerProxy.java   
@Override
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn) {
    if (m_realPlayer == null) {
        super.openGuiHorseInventory(horse, inventoryIn);
    } else {
        m_realPlayer.openGuiHorseInventory(horse, inventoryIn);
    }
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
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);
}
项目:Zombe-Modpack    文件:EntityPlayer.java   
/**
 * 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);
            }
        }
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * 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();
    }
}
项目:Backmemed    文件:EntityAISkeletonRiders.java   
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;
}
项目:Backmemed    文件:EntityPlayerMP.java   
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);
}
项目:Backmemed    文件:EntityPlayer.java   
/**
 * 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);
            }
        }
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * 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();
    }
}
项目:Backmemed    文件:GuiScreenHorseInventory.java   
public GuiScreenHorseInventory(IInventory playerInv, IInventory horseInv, AbstractHorse horse)
{
    super(new ContainerHorseInventory(playerInv, horseInv, horse, Minecraft.getMinecraft().player));
    this.playerInventory = playerInv;
    this.horseInventory = horseInv;
    this.horseEntity = horse;
    this.allowUserInput = false;
}
项目:CrystalMod    文件:HorseAccessories.java   
public static ContainerHorseChest getHorseChest(AbstractHorse horse){
    try{
        Object obj = ReflectionUtils.getPrivateValue(horse, AbstractHorse.class, ObfuscatedNames.AbstractHorse_horseChest);
        if(obj !=null && obj instanceof ContainerHorseChest){
            return (ContainerHorseChest)obj;
        }
    } catch(Exception e){
        throw new RuntimeException("Error when trying to get the Horses chest check MCP mapping");
    }
    return null;
}
项目:CrystalMod    文件:HorseAccessories.java   
public static ItemStack getHorseShoes(AbstractHorse horse){
    NBTTagCompound nbt = EntityUtil.getCustomEntityData(horse);
    if(nbt.hasKey(NBT_ACCESSORY_HORSE_HORSESHOES)){
        ItemStack shoes = ItemStackTools.loadFromNBT(nbt.getCompoundTag(NBT_ACCESSORY_HORSE_HORSESHOES));
        return ItemStackTools.isValid(shoes) ? shoes : ItemStackTools.getEmptyStack();
    }
    return ItemStackTools.getEmptyStack();
}
项目:CrystalMod    文件:HorseAccessories.java   
public static void setHorseShoes(AbstractHorse horse, @Nonnull ItemStack shoes){
    NBTTagCompound nbt = EntityUtil.getCustomEntityData(horse);
    if(ItemStackTools.isEmpty(shoes)){
        nbt.removeTag(NBT_ACCESSORY_HORSE_HORSESHOES);
    } else {
        nbt.setTag(NBT_ACCESSORY_HORSE_HORSESHOES, shoes.writeToNBT(new NBTTagCompound()));
    }
    EntityUtil.setCustomEntityData(horse, nbt);
}
项目:CrystalMod    文件:ContainerHorseEnderChest.java   
public ContainerHorseEnderChest(IInventory playerInventory, final IInventory horseInventoryIn, final AbstractHorse horse, EntityPlayer player)
 {
     this.horseInventory = horseInventoryIn;
     this.enderchestInventory = player.getInventoryEnderChest();
     this.theHorse = horse;

     horseInventoryIn.openInventory(player);
     this.addSlotToContainer(new Slot(horseInventoryIn, 0, 8, 18)
     {
         @Override
public boolean isItemValid(@Nullable ItemStack stack)
         {
             return super.isItemValid(stack) && stack.getItem() == Items.SADDLE && !this.getHasStack();
         }
     });

     if (enderchestInventory !=null)
     {
         for (int k = 0; k < 3; ++k)
         {
             for (int l = 0; l < 9; ++l)
             {
                 this.addSlotToContainer(new Slot(enderchestInventory, l + k * 9, 8 + l * 18, 69 + k * 18));
             }
         }
     }

     for (int i1 = 0; i1 < 3; ++i1)
     {
         for (int k1 = 0; k1 < 9; ++k1)
         {
             this.addSlotToContainer(new Slot(playerInventory, k1 + i1 * 9 + 9, 8 + k1 * 18, 131 + i1 * 18));
         }
     }

     for (int j1 = 0; j1 < 9; ++j1)
     {
         this.addSlotToContainer(new Slot(playerInventory, j1, 8 + j1 * 18, 189));
     }
 }
项目:Gravestone-mod-Extended    文件:HorseCorpseHelper.java   
public static EnumHorseType getHorseType(AbstractHorse horse) {
    if (horse instanceof EntityHorse) {
        return EnumHorseType.HORSE;
    } else if (horse instanceof EntityDonkey) {
        return EnumHorseType.DONKEY;
    } else if (horse instanceof EntityMule) {
        return EnumHorseType.MULE;
    } else if (horse instanceof EntityZombieHorse || horse instanceof net.minecraft.entity.passive.EntityZombieHorse) {
        return EnumHorseType.ZOMBIE;
    } else if (horse instanceof EntitySkeletonHorse || horse instanceof net.minecraft.entity.passive.EntitySkeletonHorse) {
        return EnumHorseType.SKELETON;
    }
    return EnumHorseType.HORSE;
}
项目:Cyclic    文件:EventHorseFeed.java   
@SubscribeEvent
public void onEntityInteractEvent(EntityInteract event) {
  if (event.getEntity() instanceof EntityPlayer == false) {
    return;
  }
  EntityPlayer entityPlayer = (EntityPlayer) event.getEntity();
  ItemStack held = entityPlayer.getHeldItemMainhand();
  if (held != null && held.getItem() instanceof ItemHorseUpgrade && held.getCount() > 0
      && event.getTarget() instanceof AbstractHorse) {
    ItemHorseUpgrade.onHorseInteract((AbstractHorse) event.getTarget(), entityPlayer, held, (ItemHorseUpgrade) held.getItem());
    event.setCanceled(true);// stop the GUI inventory opening && horse mounting
  }
}
项目:iChunUtil    文件:HeadLlama.java   
@Override
public float getHeadPitch(AbstractHorse living, float partialTick, int eye)
{
    eyeOffsetNormal = new float[] { 0F, 14.2F/16F, 6F/16F };
    halfInterpupillaryDistanceNormal = 2.3F/16F;
    eyeScaleNormal = 0.8F;
    return iChunUtil.config.horseEasterEgg == 1 ? 0F : super.getHeadPitch(living, partialTick, eye);
}
项目:iChunUtil    文件:HeadHorse.java   
@Override
public void preChildEntHeadRenderCalls(AbstractHorse living, RenderLivingBase render)
{
    if(living.isChild()) //I don't like this if statement any more than you do.
    {
        float f1 = living.getHorseSize();

        if(iChunUtil.config.horseEasterEgg == 1)
        {
            GlStateManager.scale(f1, f1, f1);
            GlStateManager.translate(0.0F, 1.35F * (1.0F - f1), 0.0F);
        }
        else
        {
            float f = living.getGrassEatingAmount(0.0F);
            float f2 = 0.5F + f1 * f1 * 0.5F;
            GlStateManager.scale(f2, f2, f2);

            if (f <= 0.0F)
            {
                GlStateManager.translate(0.0F, 1.35F * (1.0F - f1), 0.0F);
            }
            else
            {
                GlStateManager.translate(0.0F, 0.9F * (1.0F - f1) * f + 1.35F * (1.0F - f1) * (1.0F - f), 0.15F * (1.0F - f1) * f);
            }
        }
    }
}
项目:Zombe-Modpack    文件:EntityPlayer.java   
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn)
{
}
项目:Zombe-Modpack    文件:EntityPlayerSP.java   
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn)
{
    this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, inventoryIn, horse));
}
项目:Zombe-Modpack    文件:PlayerControllerMP.java   
/**
 * Checks if the player is riding a horse, used to chose the GUI to open
 */
public boolean isRidingHorse()
{
    return this.mc.player.isRiding() && this.mc.player.getRidingEntity() instanceof AbstractHorse;
}
项目:Backmemed    文件:EntityAIRunAroundLikeCrazy.java   
public EntityAIRunAroundLikeCrazy(AbstractHorse horse, double speedIn)
{
    this.horseHost = horse;
    this.speed = speedIn;
    this.setMutexBits(1);
}
项目:Backmemed    文件:EntityPlayer.java   
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn)
{
}
项目:Backmemed    文件:EntityPlayerSP.java   
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn)
{
    this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, inventoryIn, horse));
}
项目:Backmemed    文件:RenderAbstractHorse.java   
/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
protected void preRenderCallback(AbstractHorse entitylivingbaseIn, float partialTickTime)
{
    GlStateManager.scale(this.field_191360_j, this.field_191360_j, this.field_191360_j);
    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
项目:Backmemed    文件:RenderAbstractHorse.java   
/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(AbstractHorse entity)
{
    return (ResourceLocation)field_191359_a.get(entity.getClass());
}
项目:Backmemed    文件:PlayerControllerMP.java   
/**
 * Checks if the player is riding a horse, used to chose the GUI to open
 */
public boolean isRidingHorse()
{
    return this.mc.player.isRiding() && this.mc.player.getRidingEntity() instanceof AbstractHorse;
}
项目:CrystalMod    文件:EventHandler.java   
@SubscribeEvent
public void onEntityLivingInteract(EntityInteract event)
{
    if(event.getTarget() == null)return;

    EntityPlayer player = event.getEntityPlayer();
    ItemStack held = event.getItemStack();
    Entity entity = event.getTarget();
    if(entity instanceof AbstractHorse){
      AbstractHorse horse = (AbstractHorse)entity;
      if(HorseAccessories.handleHorseInteract(player, held, event.getHand(), horse)){
          event.setCanceled(true);
      }
    }
    if(entity instanceof EntityWolf){
        if(WolfAccessories.handleWolfInteract(player, held, event.getHand(), (EntityWolf)entity)){
            event.setCanceled(true);
        }
    }
    if(entity instanceof EntityPolarBear){
        EntityPolarBear bear = (EntityPolarBear)entity;
        if(ItemStackTools.isValid(held)){
            if(held.getItem() == ModItems.miscFood && held.getMetadata() == FoodType.WHITE_FISH_RAW.getMetadata()){
                if (!player.capabilities.isCreativeMode)
                {
                    held.shrink(1);
                }
                if (!player.getEntityWorld().isRemote){
                    if (EntityUtil.rand.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(bear, player))
                    {
                        EntityTamedPolarBear.convertToTamed(player.getEntityWorld(), bear, player);
                    }   
                }
                event.setCanceled(true);
            }
        }
    }
    if(entity instanceof EntityShulkerBullet){
        if(ItemStackTools.isValid(held)){
            if(held.getItem() == Item.getItemFromBlock(ModBlocks.jar)){
                NBTTagCompound nbt = new NBTTagCompound();
                if(held.hasTagCompound() && held.getTagCompound().hasKey(BlockJar.TILE_NBT_STACK)){
                    nbt = ItemNBTHelper.getCompound(held).getCompoundTag(BlockJar.TILE_NBT_STACK);
                }
                if((!nbt.hasKey("IsShulker") || !nbt.getBoolean("IsShulker")) && (!nbt.hasKey("Count") || nbt.getInteger("Count") <=0)){
                    nbt.setBoolean("IsShulker", true);
                    if(ItemStackTools.getStackSize(held) == 1){
                        ItemNBTHelper.getCompound(held).setTag(BlockJar.TILE_NBT_STACK, nbt);
                    } else {
                        ItemStack newStack = ItemUtil.copy(held, 1);
                        ItemNBTHelper.getCompound(newStack).setTag(BlockJar.TILE_NBT_STACK, nbt);
                        player.setHeldItem(event.getHand(), ItemUtil.consumeItem(held));
                        if(!player.inventory.addItemStackToInventory(newStack)){
                            ItemUtil.dropFromPlayer(player, newStack, false);
                        }
                    }
                    entity.setDead();
                }
            }
        }
    }
}
项目:CrystalMod    文件:HorseAccessories.java   
public static boolean handleHorseInteract(EntityPlayer player, ItemStack held, EnumHand hand, AbstractHorse horse){
    if(handleEnderChestInteract(horse, held, hand, player))return true;
    return false;
}
项目:CrystalMod    文件:HorseAccessories.java   
public static void onHorseDeath(AbstractHorse horse) {
    if(hasEnderChest(horse)){
        horse.dropItem(Item.getItemFromBlock(Blocks.ENDER_CHEST), 1);
    }
}
项目:CrystalMod    文件:HorseAccessories.java   
public static boolean hasEnderChest(AbstractHorse horse){
    NBTTagCompound nbt = EntityUtil.getCustomEntityData(horse);
    return nbt.hasKey(NBT_ACCESSORY_HORSE_ENDERCHEST) && nbt.getBoolean(NBT_ACCESSORY_HORSE_ENDERCHEST);
}