Search in sources :

Example 1 with AgriSoil

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

the class PlayerConnectToServerHandler method syncSoils.

private void syncSoils(EntityPlayerMP player) {
    LOG.debug("Sending soils to player: " + player.getDisplayNameString());
    final int count = AgriCore.getSoils().getAll().size();
    Iterator<AgriSoil> it = AgriCore.getSoils().getAll().iterator();
    for (int i = 0; it.hasNext(); i++) {
        AgriSoil soil = it.next();
        LOG.debug("Sending Soil: {0} ({1} of {2})", soil, i + 1, count);
        new MessageSyncSoilJson(soil, i, count).sendTo(player);
    }
    LOG.debug("Finished sending soils to player: " + player.getDisplayNameString());
}
Also used : MessageSyncSoilJson(com.infinityraider.agricraft.network.json.MessageSyncSoilJson) AgriSoil(com.agricraft.agricore.plant.AgriSoil)

Example 2 with AgriSoil

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

the class CoreHandler method initSoils.

public static void initSoils() {
    // Announce Progress
    AgriCore.getLogger("agricraft").info("Registering Soils!");
    // See if soils are valid...
    final int raw = AgriCore.getSoils().getAll().size();
    AgriCore.getSoils().validate();
    final int count = AgriCore.getSoils().getAll().size();
    // Transfer
    AgriCore.getSoils().getAll().stream().filter(AgriSoil::isEnabled).map(JsonSoil::new).forEach(AgriApi.getSoilRegistry()::add);
    // Display Soils
    AgriCore.getLogger("agricraft").info("Registered Soils ({0}/{1}):", count, raw);
    for (IAgriSoil soil : AgriApi.getSoilRegistry().all()) {
        AgriCore.getLogger("agricraft").info(" - {0}", soil.getName());
    }
}
Also used : AgriSoil(com.agricraft.agricore.plant.AgriSoil) IAgriSoil(com.infinityraider.agricraft.api.v1.soil.IAgriSoil) IAgriSoil(com.infinityraider.agricraft.api.v1.soil.IAgriSoil)

Example 3 with AgriSoil

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

the class JsonSyncHandler method syncSoils.

protected void syncSoils(ServerPlayerEntity player) {
    LOG.debug("Sending soils to player: " + player.getDisplayName().getString());
    final int count = AgriCore.getSoils().getAll().size();
    Iterator<AgriSoil> it = AgriCore.getSoils().getAll().iterator();
    for (int i = 0; it.hasNext(); i++) {
        AgriSoil soil = it.next();
        LOG.debug("Sending Soil: {0} ({1} of {2})", soil, i + 1, count);
        new MessageSyncSoilJson(soil, i, count).sendTo(player);
    }
    LOG.debug("Finished sending soils to player: " + player.getDisplayName().getString());
}
Also used : AgriSoil(com.agricraft.agricore.plant.AgriSoil)

Example 4 with AgriSoil

use of com.agricraft.agricore.plant.AgriSoil in project AgriCore by AgriCraft.

the class AgriSoils method toString.

@Override
public String toString() {
    final StringBuilder sb = new StringBuilder();
    sb.append("\nSoils:");
    for (AgriSoil plant : soils.values()) {
        sb.append("\n\t- Soil: ");
        sb.append(plant.toString().replaceAll("\n", "\n\t").trim());
    }
    return sb.append("\n").toString();
}
Also used : AgriSoil(com.agricraft.agricore.plant.AgriSoil)

Aggregations

AgriSoil (com.agricraft.agricore.plant.AgriSoil)4 IAgriSoil (com.infinityraider.agricraft.api.v1.soil.IAgriSoil)1 MessageSyncSoilJson (com.infinityraider.agricraft.network.json.MessageSyncSoilJson)1