Search in sources :

Example 1 with IJobView

use of com.minecolonies.api.colony.jobs.IJobView in project minecolonies by ldtteam.

the class JobDataManager method createViewFrom.

@Override
public IJobView createViewFrom(final IColonyView colony, final ICitizenDataView citizenDataView, final PacketBuffer networkBuffer) {
    final ResourceLocation jobName = new ResourceLocation(networkBuffer.readUtf(32767));
    final JobEntry entry = IJobRegistry.getInstance().getValue(jobName);
    if (entry == null) {
        Log.getLogger().error(String.format("Unknown job type '%s'.", jobName), new Exception());
        return null;
    }
    final IJobView view = entry.getJobViewProducer().get().apply(colony, citizenDataView);
    if (view != null) {
        view.deserialize(networkBuffer);
    }
    return view;
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) IJobView(com.minecolonies.api.colony.jobs.IJobView) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 2 with IJobView

use of com.minecolonies.api.colony.jobs.IJobView in project minecolonies by Minecolonies.

the class JobDataManager method createViewFrom.

@Override
public IJobView createViewFrom(final IColonyView colony, final ICitizenDataView citizenDataView, final PacketBuffer networkBuffer) {
    final ResourceLocation jobName = new ResourceLocation(networkBuffer.readUtf(32767));
    final JobEntry entry = IJobRegistry.getInstance().getValue(jobName);
    if (entry == null) {
        Log.getLogger().error(String.format("Unknown job type '%s'.", jobName), new Exception());
        return null;
    }
    final IJobView view = entry.getJobViewProducer().get().apply(colony, citizenDataView);
    if (view != null) {
        view.deserialize(networkBuffer);
    }
    return view;
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) IJobView(com.minecolonies.api.colony.jobs.IJobView) ResourceLocation(net.minecraft.util.ResourceLocation)

Aggregations

IJobView (com.minecolonies.api.colony.jobs.IJobView)2 JobEntry (com.minecolonies.api.colony.jobs.registry.JobEntry)2 ResourceLocation (net.minecraft.util.ResourceLocation)2