use of com.minecolonies.coremod.colony.requestsystem.resolvers.StandardPlayerRequestResolver in project minecolonies by Minecolonies.
the class StandardPlayerRequestResolverFactory method getNewInstance.
@NotNull
@Override
public StandardPlayerRequestResolver getNewInstance(@NotNull final IFactoryController factoryController, @NotNull final IRequestManager iRequestManager, @NotNull final Object... context) throws IllegalArgumentException {
final ILocation location;
try {
location = factoryController.getNewInstance(TypeConstants.ILOCATION, iRequestManager.getColony().getCenter(), iRequestManager.getColony().getWorld().provider.getDimension());
} catch (final Exception ex) {
throw ex;
}
final IToken<?> token = factoryController.getNewInstance(TypeConstants.ITOKEN, iRequestManager.getColony().getID() * CONST_PLAYER_RESOLVER_ID_SCALE);
return new StandardPlayerRequestResolver(location, token);
}
use of com.minecolonies.coremod.colony.requestsystem.resolvers.StandardPlayerRequestResolver in project minecolonies by Minecolonies.
the class StandardPlayerRequestResolverFactory method deserialize.
@NotNull
@Override
public StandardPlayerRequestResolver deserialize(@NotNull final IFactoryController controller, @NotNull final NBTTagCompound nbt) {
final IToken token = controller.deserialize(nbt.getCompoundTag(NBT_TOKEN));
final ILocation location = controller.deserialize(nbt.getCompoundTag(NBT_LOCATION));
final Set<IToken<?>> assignedRequests = NBTUtils.streamCompound(nbt.getTagList(NBT_ASSIGNED_REQUESTS, Constants.NBT.TAG_COMPOUND)).map(c -> (IToken<?>) controller.deserialize(c)).collect(Collectors.toSet());
final StandardPlayerRequestResolver resolver = new StandardPlayerRequestResolver(location, token);
resolver.setAllAssignedRequests(assignedRequests);
return resolver;
}
Aggregations