Search in sources :

Example 1 with ForestryEvent

use of forestry.api.core.ForestryEvent in project ForestryMC by ForestryMC.

the class BreedingTracker method registerSpecies.

@Override
public void registerSpecies(IAlleleSpecies species) {
    if (!discoveredSpecies.contains(species.getUID())) {
        discoveredSpecies.add(species.getUID());
        ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(speciesRootUID());
        ForestryEvent event = new ForestryEvent.SpeciesDiscovered(speciesRoot, username, species, this);
        MinecraftForge.EVENT_BUS.post(event);
        syncToPlayer(Collections.singleton(species.getUID()), emptyStringCollection, emptyStringCollection);
    }
}
Also used : ForestryEvent(forestry.api.core.ForestryEvent) ISpeciesRoot(forestry.api.genetics.ISpeciesRoot)

Example 2 with ForestryEvent

use of forestry.api.core.ForestryEvent in project ForestryMC by ForestryMC.

the class BreedingTracker method registerMutation.

@Override
public void registerMutation(IMutation mutation) {
    String mutationString = getMutationString(mutation);
    if (!discoveredMutations.contains(mutationString)) {
        discoveredMutations.add(mutationString);
        markDirty();
        ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(speciesRootUID());
        ForestryEvent event = new ForestryEvent.MutationDiscovered(speciesRoot, username, mutation, this);
        MinecraftForge.EVENT_BUS.post(event);
        syncToPlayer(emptyStringCollection, Collections.singleton(mutationString), emptyStringCollection);
    }
}
Also used : ForestryEvent(forestry.api.core.ForestryEvent) ISpeciesRoot(forestry.api.genetics.ISpeciesRoot)

Aggregations

ForestryEvent (forestry.api.core.ForestryEvent)2 ISpeciesRoot (forestry.api.genetics.ISpeciesRoot)2