net.minecraft.entity.passive.EntityHorse Java Examples

The following examples show how to use net.minecraft.entity.passive.EntityHorse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BiomeMeadow.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
public BiomeMeadow() {
	super(properties);
	decorator.treesPerChunk = 0;
	decorator.extraTreeChance = 0.2F;
	decorator.flowersPerChunk = 15;
	decorator.grassPerChunk = 15;
	decorator.reedsPerChunk = 2;

	spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 4));
	spawnableCreatureList.add(new SpawnListEntry(EntityDonkey.class, 1, 1, 2));

	this.flowers.clear();
	for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
		if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW)
			continue;
		if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID)
			type = BlockFlower.EnumFlowerType.POPPY;
		addFlower(net.minecraft.init.Blocks.RED_FLOWER.getDefaultState().withProperty(net.minecraft.init.Blocks.RED_FLOWER.getTypeProperty(), type), 10);
	}
}
 
Example #2
Source File: ItemRidingCrop.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
    stack.damageItem(1, player);
    if (victim instanceof EntityHorse || victim instanceof EntityPig)
        victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 5));
    else if (victim instanceof EntityPlayer || victim instanceof EntityGolem) {
        victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 1));
        victim.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 200, 1));
        victim.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 200, 1));
    }
    if (!player.worldObj.isRemote && !Config.noLust && player.worldObj.provider.dimensionId == -1 && player.worldObj.rand.nextInt(15) == 1) {
        EntityItem ent = victim.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F);
        ent.motionY += player.worldObj.rand.nextFloat() * 0.05F;
        ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
        ent.motionZ += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
    }
    return true;
}
 
Example #3
Source File: EntityHorseMetaProvider.java    From OpenPeripheral-Integration with MIT License 6 votes vote down vote up
@Override
public Object getMeta(EntityHorse target, Vec3 relativePos) {
	Map<String, Object> map = Maps.newHashMap();

	map.put("eatingHaystack", target.isEatingHaystack());
	map.put("hasReproduced", target.getHasReproduced());
	map.put("bred", target.func_110205_ce());
	map.put("horseType", target.getHorseType());
	map.put("horseVariant", target.getHorseVariant());
	map.put("horseTemper", target.getTemper());
	map.put("horseTame", target.isTame());
	map.put("ownerUUID", target.func_152119_ch());

	final boolean chested = target.isChested();
	map.put("chestedHorse", chested);
	if (chested) {
		IInventory invent = HORSE_CHEST.get(target);
		map.put("chest", InventoryMetaProvider.wrapToProxyTable(invent));
	}

	return map;
}
 
Example #4
Source File: ItemFootUpgrade.java    From Cyberware with MIT License 6 votes vote down vote up
@SubscribeEvent
public void handleHorseMove(LivingUpdateEvent event)
{
	EntityLivingBase e = event.getEntityLiving();
	if (e instanceof EntityHorse)
	{
		EntityHorse horse = (EntityHorse) e;
		for (Entity pass : horse.getPassengers())
		{
			if (pass instanceof EntityLivingBase && CyberwareAPI.isCyberwareInstalled(pass, new ItemStack(this, 1, 0)))
			{
				horse.addPotionEffect(new PotionEffect(MobEffects.SPEED, 1, 5, true, false));
				break;
			}
		}
	}
}
 
Example #5
Source File: BiomeMeadow.java    From Traverse-Legacy-1-12-2 with MIT License 6 votes vote down vote up
public BiomeMeadow() {
	super(properties);
	decorator.treesPerChunk = 0;
	decorator.extraTreeChance = 0.2F;
	decorator.flowersPerChunk = 15;
	decorator.grassPerChunk = 15;
	decorator.reedsPerChunk = 2;

	spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 4));
	spawnableCreatureList.add(new SpawnListEntry(EntityDonkey.class, 1, 1, 2));

	this.flowers.clear();
	for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
		if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW)
			continue;
		if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID)
			type = BlockFlower.EnumFlowerType.POPPY;
		addFlower(net.minecraft.init.Blocks.RED_FLOWER.getDefaultState().withProperty(net.minecraft.init.Blocks.RED_FLOWER.getTypeProperty(), type), 10);
	}
}
 
Example #6
Source File: CivilizationHandlers.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private boolean isAnimal(EntityLivingBase victim) {
	return victim instanceof EntityCow ||
			victim instanceof EntityHorse ||
			victim instanceof EntityPig ||
			victim instanceof EntityDonkey ||
			victim instanceof EntityChicken ||
			victim instanceof EntitySheep;
}
 
Example #7
Source File: RenderFallenMount.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
protected ResourceLocation getEntityTexture(EntityHorse horse) {
  if(horse.getTotalArmorValue() == 0) {
    return zombieHorseTexture;
  } else {
    return getArmoredTexture(horse);
  }
}
 
Example #8
Source File: WEntity.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isTamedHorse(Entity e)
{
	return e instanceof EntityHorse && ((EntityHorse)e).isTame();
}
 
Example #9
Source File: BiomeRockyPlains.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
public BiomeRockyPlains() {
	super(false, properties);
	this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityHorse.class, 4, 1, 5));
	this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityDonkey.class, 1, 1, 2));
}
 
Example #10
Source File: CraftAbstractHorse.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public void setJumpStrength(double strength) {
    Validate.isTrue(strength >= 0, "Jump strength cannot be less than zero");
    getHandle().getEntityAttribute(EntityHorse.JUMP_STRENGTH).setBaseValue(strength);
}
 
Example #11
Source File: CraftHorse.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityHorse getHandle() {
    return (EntityHorse) super.getHandle();
}
 
Example #12
Source File: PlayerEventHandler.java    From GriefPrevention with MIT License 4 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onPlayerInteractEntity(InteractEntityEvent.Secondary event, @First Player player) {
    if (!GPFlags.INTERACT_ENTITY_SECONDARY || !GriefPreventionPlugin.instance.claimsEnabledForWorld(player.getWorld().getProperties())) {
        return;
    }

    final Entity targetEntity = event.getTargetEntity();
    final HandType handType = event.getHandType();
    final ItemStack itemInHand = player.getItemInHand(handType).orElse(ItemStack.empty());
    final Object source = !itemInHand.isEmpty() ? itemInHand : player;
    if (GriefPreventionPlugin.isTargetIdBlacklisted(ClaimFlag.INTERACT_ENTITY_SECONDARY.toString(), targetEntity, player.getWorld().getProperties())) {
        return;
    }

    GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.startTimingIfSync();
    Location<World> location = targetEntity.getLocation();
    GPClaim claim = this.dataStore.getClaimAt(location);
    GPPlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());

    // if entity is living and has an owner, apply special rules
    if (targetEntity instanceof Living) {
        EntityBridge spongeEntity = (EntityBridge) targetEntity;
        Optional<User> owner = ((OwnershipTrackedBridge) spongeEntity).tracked$getOwnerReference();
        if (owner.isPresent()) {
            UUID ownerID = owner.get().getUniqueId();
            // if the player interacting is the owner or an admin in ignore claims mode, always allow
            if (player.getUniqueId().equals(ownerID) || playerData.canIgnoreClaim(claim)) {
                // if giving away pet, do that instead
                if (playerData.petGiveawayRecipient != null) {
                    SpongeEntityType spongeEntityType = (SpongeEntityType) ((Entity) spongeEntity).getType();
                    if (spongeEntityType.equals(EntityTypes.UNKNOWN) || !spongeEntityType.getModId().equalsIgnoreCase("minecraft")) {
                        final Text message = GriefPreventionPlugin.instance.messageData.commandPetInvalid
                                .apply(ImmutableMap.of(
                                "type", spongeEntityType.getId())).build();
                        GriefPreventionPlugin.sendMessage(player, message);
                        playerData.petGiveawayRecipient = null;
                        GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
                        return;
                    }
                    ((Entity) spongeEntity).setCreator(playerData.petGiveawayRecipient.getUniqueId());
                    if (targetEntity instanceof EntityTameable) {
                        EntityTameable tameable = (EntityTameable) targetEntity;
                        tameable.setOwnerId(playerData.petGiveawayRecipient.getUniqueId());
                    } else if (targetEntity instanceof EntityHorse) {
                        EntityHorse horse = (EntityHorse) targetEntity;
                        horse.setOwnerUniqueId(playerData.petGiveawayRecipient.getUniqueId());
                        horse.setHorseTamed(true);
                    }
                    playerData.petGiveawayRecipient = null;
                    GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.commandPetConfirmation.toText());
                    event.setCancelled(true);
                    this.sendInteractEntityDenyMessage(itemInHand, targetEntity, claim, player, handType);
                }
                GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
                return;
            }
        }
    }

    if (playerData.canIgnoreClaim(claim)) {
        GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
        return;
    }

    Tristate result = GPPermissionHandler.getClaimPermission(event, location, claim, GPPermissions.INTERACT_ENTITY_SECONDARY, source, targetEntity, player, TrustType.ACCESSOR, true);
    if (result == Tristate.TRUE && targetEntity instanceof ArmorStand) {
        result = GPPermissionHandler.getClaimPermission(event, location, claim, GPPermissions.INVENTORY_OPEN, source, targetEntity, player, TrustType.CONTAINER, false);
    }
    if (result == Tristate.FALSE) {
        event.setCancelled(true);
        this.sendInteractEntityDenyMessage(itemInHand, targetEntity, claim, player, handType);
        GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
    }
}
 
Example #13
Source File: CraftHorse.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public CraftHorse(CraftServer server, EntityHorse entity) {
    super(server, entity);
}
 
Example #14
Source File: CraftHorse.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityHorse getHandle() {
    return (EntityHorse) entity;
}
 
Example #15
Source File: CraftHorse.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public void setJumpStrength(double strength) {
    Validate.isTrue(strength >= 0, "Jump strength cannot be less than zero");
    getHandle().getEntityAttribute(EntityHorse.horseJumpStrength).setBaseValue(strength);
}
 
Example #16
Source File: CraftHorse.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftHorse(CraftServer server, EntityHorse entity) {
    super(server, entity);
}
 
Example #17
Source File: BiomeRockyPlains.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public BiomeRockyPlains() {
	super(false, properties);
	this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityHorse.class, 4, 1, 5));
	this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityDonkey.class, 1, 1, 2));
}
 
Example #18
Source File: RenderFallenMount.java    From EnderZoo with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Override
public Render<? super EntityHorse> createRenderFor(RenderManager manager) {
  return new RenderFallenMount(manager);
}