use of forestry.core.network.packets.PacketGenomeTrackerSync in project ForestryMC by ForestryMC.
the class BreedingTracker method synchToPlayer.
@Override
public void synchToPlayer(EntityPlayer player) {
if (player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) {
IBreedingTracker breedingTracker = getBreedingTracker(player);
String modeName = breedingTracker.getModeName();
setModeName(modeName);
NBTTagCompound nbttagcompound = new NBTTagCompound();
encodeToNBT(nbttagcompound);
PacketGenomeTrackerSync packet = new PacketGenomeTrackerSync(nbttagcompound);
NetworkUtil.sendToPlayer(packet, player);
}
}
use of forestry.core.network.packets.PacketGenomeTrackerSync in project ForestryMC by ForestryMC.
the class BreedingTracker method syncToPlayer.
private void syncToPlayer(Collection<String> discoveredSpecies, Collection<String> discoveredMutations, Collection<String> researchedMutations) {
if (world != null && username != null && username.getName() != null) {
EntityPlayer player = world.getPlayerEntityByName(username.getName());
if (player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) {
IBreedingTracker breedingTracker = getBreedingTracker(player);
String modeName = breedingTracker.getModeName();
setModeName(modeName);
NBTTagCompound nbtTagCompound = new NBTTagCompound();
writeToNBT(nbtTagCompound, discoveredSpecies, discoveredMutations, researchedMutations);
PacketGenomeTrackerSync packet = new PacketGenomeTrackerSync(nbtTagCompound);
NetworkUtil.sendToPlayer(packet, player);
for (String species : discoveredSpecies) {
SpeciesDiscoveredTrigger.INSTANCE.trigger((EntityPlayerMP) player, AlleleManager.alleleRegistry.getAllele(species));
}
}
}
}
Aggregations