Search in sources :

Example 1 with AgriPlant

use of com.agricraft.agricore.plant.AgriPlant in project AgriCraft by AgriCraft.

the class CoreHandler method initPlants.

public static void initPlants() {
    // Announce Progress
    AgriCore.getLogger("agricraft").info("Registering Plants!");
    // See if plants are valid...
    final int raw = AgriCore.getPlants().getAll().size();
    AgriCore.getPlants().validate();
    final int count = AgriCore.getPlants().getAll().size();
    // Transfer
    AgriCore.getPlants().validate();
    AgriCore.getPlants().getAll().stream().filter(AgriPlant::isEnabled).map(JsonPlant::new).forEach(AgriApi.getPlantRegistry()::add);
    // Display Plants
    AgriCore.getLogger("agricraft").info("Registered Plants ({0}/{1}):", count, raw);
    for (IAgriPlant plant : AgriApi.getPlantRegistry().all()) {
        AgriCore.getLogger("agricraft").info(" - {0}", plant.getPlantName());
    }
}
Also used : IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) AgriPlant(com.agricraft.agricore.plant.AgriPlant)

Example 2 with AgriPlant

use of com.agricraft.agricore.plant.AgriPlant in project AgriCraft by AgriCraft.

the class PlayerConnectToServerHandler method syncPlants.

private void syncPlants(EntityPlayerMP player) {
    log.debug("Sending plants to player: " + player.getDisplayNameString());
    final int count = AgriCore.getPlants().getAll().size();
    Iterator<AgriPlant> it = AgriCore.getPlants().getAll().iterator();
    for (int i = 0; it.hasNext(); i++) {
        AgriPlant plant = it.next();
        log.debug("Sending plant: {0} ({1} of {2})", plant.getPlantName(), i + 1, count);
        new MessageSyncPlantJson(plant, i, count).sendTo(player);
    }
    log.debug("Finished sending plants to player: " + player.getDisplayNameString());
}
Also used : MessageSyncPlantJson(com.infinityraider.agricraft.network.json.MessageSyncPlantJson) AgriPlant(com.agricraft.agricore.plant.AgriPlant)

Aggregations

AgriPlant (com.agricraft.agricore.plant.AgriPlant)2 IAgriPlant (com.infinityraider.agricraft.api.v1.plant.IAgriPlant)1 MessageSyncPlantJson (com.infinityraider.agricraft.network.json.MessageSyncPlantJson)1