Search in sources :

Example 1 with PublicWorkerCraftingRequestResolver

use of com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver in project minecolonies by ldtteam.

the class PublicWorkerCraftingRequestResolverFactory method deserialize.

@NotNull
@Override
public PublicWorkerCraftingRequestResolver deserialize(@NotNull final IFactoryController controller, @NotNull final CompoundNBT nbt) {
    final IToken<?> token = controller.deserialize(nbt.getCompound(NBT_TOKEN));
    final ILocation location = controller.deserialize(nbt.getCompound(NBT_LOCATION));
    final JobEntry entry = IJobRegistry.getInstance().getValue(new ResourceLocation(nbt.getString(NBT_JOB)));
    return new PublicWorkerCraftingRequestResolver(location, token, entry);
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) ILocation(com.minecolonies.api.colony.requestsystem.location.ILocation) ResourceLocation(net.minecraft.util.ResourceLocation) PublicWorkerCraftingRequestResolver(com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with PublicWorkerCraftingRequestResolver

use of com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver in project minecolonies by Minecolonies.

the class PublicWorkerCraftingRequestResolverFactory method deserialize.

@Override
public PublicWorkerCraftingRequestResolver deserialize(IFactoryController controller, PacketBuffer buffer) throws Throwable {
    final IToken<?> token = controller.deserialize(buffer);
    final ILocation location = controller.deserialize(buffer);
    final JobEntry entry = buffer.readRegistryId();
    return new PublicWorkerCraftingRequestResolver(location, token, entry);
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) ILocation(com.minecolonies.api.colony.requestsystem.location.ILocation) PublicWorkerCraftingRequestResolver(com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver)

Example 3 with PublicWorkerCraftingRequestResolver

use of com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver in project minecolonies by Minecolonies.

the class PublicWorkerCraftingRequestResolverFactory method deserialize.

@NotNull
@Override
public PublicWorkerCraftingRequestResolver deserialize(@NotNull final IFactoryController controller, @NotNull final CompoundNBT nbt) {
    final IToken<?> token = controller.deserialize(nbt.getCompound(NBT_TOKEN));
    final ILocation location = controller.deserialize(nbt.getCompound(NBT_LOCATION));
    final JobEntry entry = IJobRegistry.getInstance().getValue(new ResourceLocation(nbt.getString(NBT_JOB)));
    return new PublicWorkerCraftingRequestResolver(location, token, entry);
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) ILocation(com.minecolonies.api.colony.requestsystem.location.ILocation) ResourceLocation(net.minecraft.util.ResourceLocation) PublicWorkerCraftingRequestResolver(com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with PublicWorkerCraftingRequestResolver

use of com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver in project minecolonies by Minecolonies.

the class AbstractCraftingBuildingModule method createResolvers.

@Override
public List<IRequestResolver<?>> createResolvers() {
    final List<IRequestResolver<?>> resolvers = new ArrayList<>();
    resolvers.add(new PublicWorkerCraftingRequestResolver(building.getRequester().getLocation(), building.getColony().getRequestManager().getFactoryController().getNewInstance(TypeConstants.ITOKEN), jobEntry));
    resolvers.add(new PublicWorkerCraftingProductionResolver(building.getRequester().getLocation(), building.getColony().getRequestManager().getFactoryController().getNewInstance(TypeConstants.ITOKEN), jobEntry));
    return resolvers;
}
Also used : PublicWorkerCraftingProductionResolver(com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingProductionResolver) IRequestResolver(com.minecolonies.api.colony.requestsystem.resolver.IRequestResolver) PublicWorkerCraftingRequestResolver(com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver)

Example 5 with PublicWorkerCraftingRequestResolver

use of com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver in project minecolonies by ldtteam.

the class AbstractCraftingBuildingModule method createResolvers.

@Override
public List<IRequestResolver<?>> createResolvers() {
    final List<IRequestResolver<?>> resolvers = new ArrayList<>();
    resolvers.add(new PublicWorkerCraftingRequestResolver(building.getRequester().getLocation(), building.getColony().getRequestManager().getFactoryController().getNewInstance(TypeConstants.ITOKEN), jobEntry));
    resolvers.add(new PublicWorkerCraftingProductionResolver(building.getRequester().getLocation(), building.getColony().getRequestManager().getFactoryController().getNewInstance(TypeConstants.ITOKEN), jobEntry));
    return resolvers;
}
Also used : PublicWorkerCraftingProductionResolver(com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingProductionResolver) IRequestResolver(com.minecolonies.api.colony.requestsystem.resolver.IRequestResolver) PublicWorkerCraftingRequestResolver(com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver)

Aggregations

PublicWorkerCraftingRequestResolver (com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver)6 JobEntry (com.minecolonies.api.colony.jobs.registry.JobEntry)4 ILocation (com.minecolonies.api.colony.requestsystem.location.ILocation)4 IRequestResolver (com.minecolonies.api.colony.requestsystem.resolver.IRequestResolver)2 PublicWorkerCraftingProductionResolver (com.minecolonies.coremod.colony.requestsystem.resolvers.PublicWorkerCraftingProductionResolver)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 NotNull (org.jetbrains.annotations.NotNull)2